30.10.2015, 03:13
(
Последний раз редактировалось Kevln; 30.10.2015 в 03:46.
)
What don't you understand by "Timer IDs are never used twice.".
Timers don't re-use IDs, these increment consecutively. Timer IDs also start at 1; therefore, there is NO need to initialize variables or even reset them.
I'll use your example to explain this to you:
Let's say we use your function:
HideInfoBox's ID is 1.
Now the timer ID stored is 1. Just after the timer ends, we execute a custom timer:
very_important_timer's ID is 2.
Its id is 1 as well, but just after execution, we use your function again (note the custom timer is still alive):
Its ID is 2!
Kills timer ID 1.
HideInfoBox's ID is 3.
Your include kills "very_important_timer" timer, because as i previously mentioned, you don't have a check, or you don't reset the variable to "0" when the timers are no more running.
No it doesn't!
Timers don't re-use IDs, these increment consecutively. Timer IDs also start at 1; therefore, there is NO need to initialize variables or even reset them.
I'll use your example to explain this to you:
Let's say we use your function:
pawn Код:
ShowInfoBox(..);
Now the timer ID stored is 1. Just after the timer ends, we execute a custom timer:
pawn Код:
SetTimer("very_important_timer", ...);
Its id is 1 as well, but just after execution, we use your function again (note the custom timer is still alive):
Its ID is 2!
pawn Код:
ShowInfoBox(..);
HideInfoBox's ID is 3.
Your include kills "very_important_timer" timer, because as i previously mentioned, you don't have a check, or you don't reset the variable to "0" when the timers are no more running.
No it doesn't!