Quote:
Originally Posted by Gunderak
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.