View Single Post
  #1  
Old 07-04-2011, 03:37 AM
xuntasi xuntasi is offline
Registered User
xuntasi's Avatar
Join Date: Jun 2011
Location: Deadaccountsville, Internet
Posts: 14
xuntasi is on a distinguished road
How to script chat-operated weapons?

Ok, so I am deeply confused about how to script weapons that are affected by player chat. I made this script, and it is operated by chat commands, but when I make it a weapon it doesn't work. I've literally been sitting at my computer for over 2 hours now stuck on this one script. It works perfectly when made into a regular NPC, but it doesn't do jack as a weapon. I'm not asking for anyone to give me any script, I just need advice on what commands I should change to make this a weapon (or just a script that will work in all levels, not necessarily a weapon. Really the only problem now is that it only works in the room with the NPC.)

Here is my script:
PHP Code:
function onPlayerChats() {
  if(
player.chat.starts("/shonmessage ") && player.account=="Graal780973") {
    
shon.mess player.chat.substring("/shonmessage ".length());
    echo(
"Shonspeak message set to "@shon.mess);
  }
  if(
player.chat.starts("/shonaccount ") && player.account=="Graal780973") {
    
shon.acc findplayer(player.chat.substring("/shonaccount ".length()));
    echo(
"Shonspeak target set to "@shon.acc.account);
  }
  if(
player.chat=="/shonspeak" && player.account=="Graal780973") {
  
shon.acc.chat shon.mess;
  }

Any advice as to what I should do?
__________________
This account is DEAD!
Reply With Quote