Advertisement
kolton

join

Nov 11th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Name(Account) joined our world. Diablo's minions grow stronger.
  2.  
  3. RegisterEvent(EVENT_GAMEMSG,
  4.     function (msg, type) {
  5.         if (type === 4 && msg.indexOf('stronger') > -1) { // join message
  6.             var userName = msg.split('(')[0];   // split is ["Name", "Account) joined our world. Diablo's minions grow stronger."]
  7.                                                 // split[0] is "Name"
  8.            
  9.             // for reference only, can be done in one line with 2 splits as well - var userAccount = msg.split('(')[1].split(')')[0];
  10.             var userAccount = msg.split('(')[1];    // split is ["Name", "Account) joined our world. Diablo's minions grow stronger."]
  11.                                                     // split[1] is "Account) joined our world. Diablo's minions grow stronger."
  12.                 userAccount = userAccount.split(')')[0];    // split is ["Account", " joined our world. Diablo's minions grow stronger."]
  13.                                                             // split[0] is "Account"
  14.            
  15.             Print(userName + " " + userAccount);
  16.             Say("/ignore " + userName);
  17.         }
  18.     }
  19. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement