Code: Select all
if (timeleft < 301)
timeleft = 1000;
return timeleft;
Code: Select all
while (timeleft() > 301)
wait 1;
Pseudocode:
While the timeleft (If the time left is less than 301, pretend its 1000) is greater than 301, wait one second.
---
So everytime timeleft() is called, you program is saying, "there is less than 300 seconds left, but I am going to say 1000" and then the loop is thinking, well there is 1000 seconds remaining, I will wait another seconds and check again... rinse and repeat... forever.
Code: Select all
if (timeleft < 301) timeleft = 1000; //if timelimit is less than 5 minutes, do not let the script print anything to players