PDA

View Full Version : Player Manipluation


Chandler
04-30-2007, 09:51 AM
Hmm, here :p

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, 09:57 AM
Yet another staff tool. Yay.

Chandler
04-30-2007, 09: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, 11:11 AM
Nice and simple. Style is kinda... Out of there.

Sadly, you forgot the most important thing: logs.

Chandler
04-30-2007, 08:58 PM
True! :O
Thanks :)

Inverness
05-01-2007, 10:15 AM
Yet another staff tool. Yay.
Your sarcasm is going to crash the server.