Timer ID stored in a variable gets wiped when timer hits ? - 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: Timer ID stored in a variable gets wiped when timer hits ? (
/showthread.php?tid=631240)
Timer ID stored in a variable gets wiped when timer hits ? -
NeXoR - 25.03.2017
Lets say I have something like this:
PHP Code:
new TimerID = SetTimer("BlaBla", 1000, 0);
BlaBla();
BlaBla()
{
if(TimerID) // If the timer ID is still stored in the variable > the timer wasnt executed yet
{
KillTimer(TimerID);
// blablabla
}
}
If I call a timer, and store it's ID in a variable
When the function of the Timer is called (Timer is finished)
The Timer ID is still stored in the variable ?
Re: Timer ID stored in a variable gets wiped when timer hits ? -
Mencent - 25.03.2017
Hello!
When the timer is finish you needn't kill the timer because it is still killed.
Re: Timer ID stored in a variable gets wiped when timer hits ? -
NeXoR - 25.03.2017
Nevermind Solved
I just switched the Timer ID variable in a function local variable