Thread: Weapon Control
View Single Post
  #6  
Old 08-17-2011, 01:00 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
I decided to take on board what crow said about how using the players chat is more efficient for adding weapons. I have decided to make a quick weapon adder using !add and !rem. Thank you crow <3
PHP Code:
function onActionServerSide() {
  if (
params[0] == "scriptwepadd") { //Adds the specified weapon
    
addweapon(params[1]);
  }
  if (
params[0] == "scriptwepremove") { //Removes the specified weapon
    
removeweapon(params[1]);
  }
}

//#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));
  }

Obviously, if I wanted to I could branch off of that and expand it to add weapons to all players, certain players, a specified player etc.

Styled using FowlPlay4's GS2 Beautifier
__________________
Reply With Quote