PHP Code:
function onActionServerSide( cmd )
{
switch( cmd )
{
case "shovel":
{
temp.shoveling_prizes = {"Treasure/Map", "Treasure/Chest", "Treasure/Key"};
findplayer(params[1]) {
setani jamerson_shovel,NULL;
freezeplayer 1;
clientr.item.( @ shoveling_prizes[int(random(0,3))])++;
}
}
}
}
//#CLIENTSIDE
function onWeaponFired()
{
if ( player.level ="jamerson-shovel.nw" )
{
triggerserver( "weapon", name, "shovel",player.account);
}
else
player.addMsg2("You must be in the shovel room to use shovel!");
}
Should work. On the serverside, it is rare to have a reference to a player since the server deals with
all players, so you must pass the account name of the player in the triggerserver() so you can find the player who triggered it, and then deal with them.
Also, if your servers systems are any good they would have a public function for adding items... like:
Inventory.additem(itemname,quantity);
If they don't, get them to add it.