Thread: Get a message
View Single Post
  #2  
Old 01-17-2011, 04:32 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
PHP Code:
function onPlayerChats() { 
  if (
player.chat != "/prhelp") {
    return; 
// use return here to end the function, before you ended the if statement with a semicolon which doesn't work
  
}
  
  
say2("You sent a message!");
  
  
// tell RC that someone needs help
  
sendToRC("Someone needs PR help!");
  
  
// loop through every player online
  
for (temp.pl allplayers) {
    if (
pl.hasWeapon("PrTag")) { // I think this works?
      
pl.say2("Someone needs PR help!");
    }
  }

This would work in a level NPC. If it's meant to be used in a weapon you will have to use onPlayerChats on clientside, trigger serverside, then use sendToRC and loop through the players on serverside.

I'm not quite sure what the weapon "PrHelp" is supposed to be. Does the player need it to use the help? If so, you should probably just do what I advised above and put the script in the weapon.

Let me know if you don't understand anything I said.
__________________
Reply With Quote