About timers. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: About timers. (
/showthread.php?tid=354917)
About timers. -
budelis - 28.06.2012
Hi i want to ask something. I have set a timer for 5 min and no repeat ( false ). But if i go from server, and that time ( 5 min ) will not pass, what will happen timer? do i need to kill him ?
Re: About timers. -
JaTochNietDan - 28.06.2012
The timer will finish on the 5 minute mark and carry out the code you intended it to carry out. Whether or not the functions actually work depends on if the playerid is present in the server at the time, so if you leave and someone else joins with the same ID and the timer you started finishes, it will carry out the actions on him.
So yes, it's good practice to killer per-player timers when they disconnect from the server.
Re: About timers. -
Vince - 28.06.2012
Timers are not tied to players and will keep running regardless of what other functions you call (except KillTimer, ofcourse). Implementing an IsPlayerConnected check in the function that is to be called by the timer is probably the easiest solution.
Edit: Too late, and didn't think about another player connecting with same id.