Posts: 1,199
Threads: 238
Joined: Feb 2016
Reputation:
0
Is it possible to kill all timers with one 'for loop'. Can I somehow collect all timers in one place??
Posts: 1,219
Threads: 51
Joined: Jul 2012
20.12.2016, 19:00
(
Последний раз редактировалось BiosMarcel; 20.12.2016 в 19:52.
)
If they all were in an array, it would work, but otherwise you can't , afaik.
I might be wrong according to his post:
http://forum.sa-mp.com/showpost.php?...07&postcount=4
Posts: 1,219
Threads: 51
Joined: Jul 2012
Quote:
Originally Posted by Micko123
Is it possible to kill all timers with one 'for loop'. Can I somehow collect all timers in one place??
|
You could do it like that:
To access them, since you don't want to use the index:
PHP код:
#define TIMER_NAME_1 0
#define TIMER_NAME_2 1
#define TIMER_NAME_3 2
#define TIMER_NAME_4 3
#define TIMER_NAME_5 4
timers[TIMER_NAME_1] = new Timer(...);
To kill them:
PHP код:
for(new count = 0; count < sizeof(timers); count++)
{
KillTimer(timers[count]);
}
THat's kinda dirty tho, don't do it xD
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
Either save all timer IDs in an array, hook the set timer functions, or make a function that kills the timers without a loop.
I think YSF has a function that can get the active timers btw.