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(code, key, scan) {
if (key == "t") {
freezeplayer(this.equip);
triggerServer("gui", this.name, "levelUp");
} else if (key == "g") {
freezeplayer(this.equip);
triggerServer("gui", this.name, "levelDown");
}
}