Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:10 PM.


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