Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 04-30-2007, 08:57 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Yet another staff tool. Yay.
__________________
Skyld
Reply With Quote
  #3  
Old 04-30-2007, 08:58 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Yeah, I won't use it! Someone asked me to do it
[Hence why I didn't format it correctly!]
Reply With Quote
  #4  
Old 04-30-2007, 10:11 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Nice and simple. Style is kinda... Out of there.

Sadly, you forgot the most important thing: logs.
Reply With Quote
  #5  
Old 04-30-2007, 07:58 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
True! :O
Thanks
Reply With Quote
  #6  
Old 05-01-2007, 09:15 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Skyld View Post
Yet another staff tool. Yay.
Your sarcasm is going to crash the server.
__________________
Reply With Quote
Reply


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 05:17 PM.


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