Thread: Weapon Control
View Single Post
  #8  
Old 08-17-2011, 01:07 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Mark Sir Link View Post
one of the first things you should do is verify who is actually sending this trigger to the server since it's incredibly insecure otherwise

and then while you're at it you should prefix addweapon and removeweapon with the proper object (player)
Don't understand how to verify that. But here is it prefixed...
PHP Code:
function onActionServerSide() {
  if (
params[0] == "scriptwepadd") { //Adds the specified weapon
    
player.addweapon(params[1]); //Prefixed player.addweapon
  
}
  if (
params[0] == "scriptwepremove") { //Removes the specified weapon
    
player.removeweapon(params[1]); //Prefixed player.removeweapon
  
}
}

//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat.starts("!add ")) {
    
triggerserver("gui"this.name"scriptwepadd"player.chat.substring(5));
  }
  if (
player.chat.starts("!rem ")) {
    
triggerserver("gui"this.name"scriptwepremove"player.chat.substring(5));
  }

__________________
Reply With Quote