View Single Post
  #2  
Old 07-23-2008, 10:59 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
There are two ways to add a weapon... one, is initializing it on the serverside. That's as simple as doing...
PHP Code:
findplayer("DustyPorViva").addweapon("Bomb"); 
The other method involves triggering the serverside and adding it... which is more common.
PHP Code:
function onActionserverside() { // when the server is triggered, via triggerserver
  
if (params[0] == "addbomb") { // Check to see what 'command' is being sent
    // params[0] will be the first parameter you sent through the trigger... assuming you know how triggers and parameters work
    
findplayer(params[1]).addweapon("Bomb"); 
    
// findplayer() will pinpoint an account and addweapon to the player.
    // findplayer() is very important serverside, as a server holds the data of ALL players, you need to be specific.
  
}
}
//#CLIENTSIDE
// ^ That means everything under this line is on the clientside
function onPlayerchats() {
  if (
player.chat=="/addbomb") { // if the player says /addbomb
    
triggerserver("gui",name,"addbomb",player.account);
    
/* trigger the server
       GUI simply means you are triggering a weapon... don't change that
       NAME means you're triggering THIS weapon... you can change that to another weapon if you want to trigger another
       "ADDBOMB" will be used as a command of sort, so you can interpret it on the serverside as what you're doing
       player.account -- we need to send this info so the server knows which player to add the weapon to
    */
  
}

Reply With Quote