Quote:
Originally Posted by pez307
Okay so, i took this script from chris posted on forums, and i've added it, yet when players log off the light remains on the ground, how would i prevent that?
|
1. Count the number of players. I.e: this.player_count = players.size();
2. Check if the number has changed from the last time you checked. I.e: if (players.size() != this.player_count)
3. If the number changed hide the images. I.e: hideimgs(200,1000);
It looks something like this:
PHP Code:
function checkPlayerCount() {
// Get current playercount
temp.current_count = players.size();
// Compare to the last playercount
if (this.player_count != temp.current_count) {
// Playercount has changed.
doSomething();
// Update last playercount
this.player_count = temp.current_count;
}
}
Hint: You'll have to do this in your timeout loop.