SA-MP Forums Archive
Killing false 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: Killing false timers (/showthread.php?tid=617527)



Killing false timers - MerryDeer - 22.09.2016

Hi,

I have some timer with false that will be complete only once. And i have variable where i write that timer id. So when timer completes, i make that variable = -1, so that timer is disappear when it calls in public end?


Re: Killing false timers - Jochemd - 22.09.2016

If you set repeating to false (or 0), it will not run a second time. You will have to set the variable to -1 yourself, but the timer is automatically destroyed.


Re: Killing false timers - MerryDeer - 22.09.2016

Yes, i set variable in public inside, but i need know deeper when timer id is destroyed, because i have like that

Код:
if( variablettimer != -1 )
{
KillTimer(  variablettimer);
 variablettimer = -1;
}
So this can kill new timer, if it instantly get created and it ID match with variablettimer


Re: Killing false timers - SickAttack - 22.09.2016

No need, timer IDs are always unique, and the initial value doesn't reset on gmx.

Setting the variable to -1 will do nothing, timers that aren't set to repeat run once and get killed. Use KillTimer to stop timers at any time, mostly for timers that repeat.

http://forum.sa-mp.com/showpost.php?...6&postcount=12