Some time ago, I learned that
is better than
in terms of performance, which I do see. However, I noticed that if you logged out and logged on to the server fast enough, you could make the loop run multiple times.
Example:
This would make a new loop start for the player, while the old one, after waiting 5 seconds, sees that the player is in fact still online, and continues.
Is there a way to make sure that this won't happen? Thanks so much!
Code:
on join:
while player is online:
#do stuff
wait 5 seconds
is better than
Code:
every 5 seconds:
loop all players:
#do stuff for that player
in terms of performance, which I do see. However, I noticed that if you logged out and logged on to the server fast enough, you could make the loop run multiple times.
Example:
Code:
on join:
while player is online:
send "This loop was run" to player
#Player leaves and rejoins during this 5 second time period
wait 5 seconds
This would make a new loop start for the player, while the old one, after waiting 5 seconds, sees that the player is in fact still online, and continues.
Is there a way to make sure that this won't happen? Thanks so much!