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
*/
}
}