View Single Post
  #9  
Old 08-12-2010, 10:15 PM
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:
if(player.chat="/setteams"){ 
needs to be

PHP Code:
if(player.chat=="/setteams"){ 
This isn't just personal preference, it's necessary because otherwise the engine tries to assign a value to player.chat.

You can simplify your script very easily:

PHP Code:
function onPlayerChats() {
  if (
player.guild == "Events Team") {
    if (
player.chat == "/setteams") {
      
temp.teams = { // team name, level, x, y
                     
{"TTW Team 1", "event_ttw-lobby.nw", 23.5, 30},
                     {
"TTW Team 2", "event_ttw-lobby.nw", 44, 30},
                     {
"TTW Team 3", "event_ttw-lobby.nw", 23.5, 44.5},
                     {
"TTW Team 4", "event_ttw-lobby.nw", 44, 44.5}
                   };
      
      
temp.i = 0;
      for (
temp.pl : players) {
        if (
pl.guild == "Events Team") {
          continue;
        }
        
        
temp.team = teams[i % teams.size()];
        
pl.guild = team[0];
        
pl.setLevel2(team[1], team[2], team[3]);
        
i ++;
      }
    }
  }
} 
__________________
Reply With Quote