Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Player Manipluation (https://forums.graalonline.com/forums/showthread.php?t=73761)

Chandler 04-30-2007 08:51 AM

Player Manipluation
 
Hmm, here :p
HTML Code:

function onActionServerside(findOption, playersChat)
  switch(temp.findOption)
  {
    case "doControl": this.doAction(temp.playersChat); break;
    case "doWarp": this.doWarp(findPlayer(temp.playersChat)); break;
    case "displayHelp": this.displayHelp(); break;
  }

function displayHelp()
  {
  temp.commandList =
    "heal 'account'\n head 'account' 'image'\n gani 'account' 'name'\n" @
    "gralat 'account' 'amount'\n name 'account' 'name'\n" @
    "guild 'account' 'guild'\n chat 'account' 'text'\n" @
    "pm 'account' 'text'\n addweapon 'account' 'weapon'\n" @
    "removeweapon 'account' 'weapon'";
  say2(temp.commandList);
  }

function doWarp(warpAccount)
  if (temp.warpAccount != "")
      setlevel2(temp.warpAccount.level.name, temp.warpAccount.x, temp.warpAccount.y);

function doAction(actionName)
  {
  temp.actionTokens = temp.actionName.tokenize();
  temp.playerCommands = {
    {"head", "headimg"},
    {"ap", "ap"},
    {"chat", "chat"},
    {"gani", "ani"},
    {"name", "nick"},
    {"heal", "hearts"},
    {"gralat", "rupees"},
    {"addweapon", "addWeapon", true},
    {"removeweapon", "removeWeapon", true},
    {"pm", "sendpm", true}
  };
 
  for (temp.currentCommand: temp.playerCommands)
    if (temp.currentCommand[0] == temp.actionTokens[0])
      if (temp.actionTokens[1] == "server")
        this.doServer(temp.currentCommand[1], temp.actionTokens[2], temp.currentCommand[2]);
      else
        if (temp.currentCommand[2])
          findPlayer(temp.actionTokens[1]).( @temp.currentCommand[1])(temp.actionTokens[2]);
        else
          findPlayer(temp.actionTokens[1]).( @temp.currentCommand[1]) = temp.actionTokens[2];
         
  }
function doServer(actionName, setValue, valueType)
  for (temp.currentPlayer: allplayers)
    if (!temp.valueType)
      temp.currentPlayer.( @temp.actionName) = temp.setValue;
    else
      temp.currentPlayer.( @temp.actionName)(temp.setValue);
   
//#CLIENTSIDE
function onPlayerChats()
{
  temp.allowedCommands = {
    {"-control", "doControl", 9},
    {"goto", "doWarp", 5},
    {"help", "displayHelp", 4}
  };
  for (temp.currentWord: temp.allowedCommands)
    if (temp.currentWord[0].starts(player.chat.tokenize()[0]))
      triggerserver("weapon", this.name, temp.currentWord[1], player.chat.substring(temp.currentWord[2]));
}


Skyld 04-30-2007 08:57 AM

Yet another staff tool. Yay.

Chandler 04-30-2007 08:58 AM

Yeah, I won't use it! Someone asked me to do it^^
[Hence why I didn't format it correctly!]

Novo 04-30-2007 10:11 AM

Nice and simple. Style is kinda... Out of there.

Sadly, you forgot the most important thing: logs.

Chandler 04-30-2007 07:58 PM

True! :O
Thanks :)

Inverness 05-01-2007 09:15 AM

Quote:

Originally Posted by Skyld (Post 1304523)
Yet another staff tool. Yay.

Your sarcasm is going to crash the server.


All times are GMT +2. The time now is 02:52 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.