SA-MP Forums Archive
[Include] Single-Player Info Boxes - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Single-Player Info Boxes (/showthread.php?tid=592714)

Pages: 1 2


Re: Single-Player Info Boxes - Kevln - 30.10.2015

Quote:
Originally Posted by Gammix
Посмотреть сообщение
"Just after the timer ends", meaningful ?
Quote:
Originally Posted by Gammix
Посмотреть сообщение
"Just after the timer ends", meaningful ?
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:

pawn Код:
ShowInfoBox(..);
HideInfoBox's ID is 1.

Now the timer ID stored is 1. Just after the timer ends, we execute a custom timer:

pawn Код:
SetTimer("very_important_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!

pawn Код:
ShowInfoBox(..);
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!