Thread: Lottery NPC
View Single Post
  #7  
Old 08-19-2011, 10:31 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
Quote:
Originally Posted by Gunderak View Post
PHP Code:
function onAwardWinner(){
  for (
temp.pl allplayers){
    
findplayer(temp.pl).clientr.Ticket=0;
  } 
In addition to what Jer said, the above code is incorrect, although it technically works. allPlayers is an array of player objects, not accounts. That means you could just do this:

PHP Code:
for (temp.pl allplayers) {
  
temp.pl.clientr.Ticket=0;

For comparison, using findPlayer like you did would be equivalent to doing

PHP Code:
findPlayer(player).client.Ticket=0
The reason it works even though temp.pl is not an account is that the object is coerced into a string, which just happens to be the player's account (since temp.pl.name would equal temp.pl.account).

Thanks for taking the time to either style your code or run it through Jer's beautifier before posting it.
__________________
Reply With Quote