Thread: Shovel Script
View Single Post
  #10  
Old 07-26-2009, 06:43 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
PHP Code:
function onActionServerSidecmd )
{
  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.
Reply With Quote