How to get timer current count? - 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: How to get timer current count? (
/showthread.php?tid=612166)
How to get timer current count? -
GunZsmd - 14.07.2016
Hi guys,
Any chance we can get how much time the SetTimer is counting? like imagine it has 5 min of countdown and some time passes, can we do a line that gets how much time is left?
Cumpz,
Vasco
Re: How to get timer current count? -
yutaruta - 14.07.2016
yes.
You create a var for hold the timer initial time.
Код:
new timerInitTime;
timerInitTime = gettime();
SetTimerEx("yourfunc", 666666, true, "i", YourParam);
Then, to get the time :
Код:
timeCount = (gettime() - timerInitTime;
Notice that the time you get is in seconds.
You can multiply the result with 1000 to get the time in miliseconds.
Re: How to get timer current count? -
Threshold - 15.07.2016
You can use gettime() for seconds, or GetTickCount() for milliseconds. Multiplying seconds by 1000 won't give you an accurate measurement of milliseconds.