View Single Post
  #10  
Old 06-19-2013, 05:04 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
When you post code, wrap it in [PHP] tags instead of [CODE] tags.

destroy() doesn't take any parameters, so you should just write this.destroy() instead of this.destroy(Weapon/BMPTier2);

Your first code looks fine; my guess is that your capitalization of the weapon name is off. I'm not certain but I'd guess player.removeWeapon might be case-sensitive. If it's not working, make sure you have the weapon name entered exactly as it should be (in some examples you use weapon/BMP and in others you use Weapon/BMP). You can also use this.name to refer to the current weapon name.

If you want to handle multiple possible actions serverside, send a parameter instead of null in your trigger. The parameter will be passed to the onActionServerSide event.

Something like this:

PHP Code:
function onActionServerSide(temp.cmd) {
  if (
temp.cmd == "levelUp") {
    
player.addWeapon("Weapon/BMPTier3");
    
player.removeWeapon(this.name);
  } else if (
temp.cmd == "levelDown") {
    
player.addWeapon("Weapon/BMPTier1");
    
player.removeWeapon(this.name);
  }
}

//#CLIENTSIDE
function GraalControl.onKeyDown(codekeyscan) {
  if (
key == "t") {
    
freezeplayer(this.equip);
    
triggerServer("gui"this.name"levelUp");
  } else if (
key == "g") {
    
freezeplayer(this.equip);
    
triggerServer("gui"this.name"levelDown");
  }

__________________
Reply With Quote