View Single Post
  #1  
Old 04-30-2007, 08:51 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Player Manipluation

Hmm, here
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]));
}
Reply With Quote