Quote:
Originally Posted by Gambet
I would probably do so for better organization:
|
Why not this?
PHP Code:
function purchaseItem(temp.itemID)
{
switch (temp.itemID)
{
case "Juggling":
{
if (clientr.etcoins >= 30)
{
player.clientr.etcoins -= 30;
player.addweapon("*Prizes/Juggle");
}
else
{
player.chat = "Insufficient funds!";
}
break;
}
}
}
function onPlayerChats()
{
temp.tokens = player.chat.tokenize();
if (temp.tokens[0] == "buy")
{
if (temp.tokens[0] in {"Juggling"})
{
this.purchaseItem(player.chat.substring(4));
}
}
}
The clientside does not need to be involved, therefore there is no reason to involve it.