View Full Version : SetTimerEx taking more time

17/10/2014, 01:15 AM
Alright so, this is more a question and any sort of help thread.

So okay I got simple timer to check something for the player (Example: SetTimerEx("Test",60000,true,"i",playerid))
but instead of it taking 60 seconds it actualy takes 66 seconds. Is this something normal with a script long lets roughly say 2500-3000 lines, or I did I fuck somewhere else in the code?

EDIT: Running script on localhost.

17/10/2014, 01:19 AM

17/10/2014, 01:23 AM


These functions are not very accurate and that they don't correctly support strings and arrays. Both these problems are now fixed to the best of my ability. I should note that the accuracy is still a little off because of the "sleep" call in the server internally, but they're MUCH better now.

I've also improved their performance through the use of "std::priority_queue" so the next timers to trigger are always at the top of the list.

A note when passing arrays, as with "CallLocalFunction" you MUST follow the array with its length as an extra parameter or the system has no way to know how big it is:

SetTimerEx("func", 1000, 0, "ai", arr, sizeof (arr));

These functions are not changed in ANY way, "0" still means "run once", anything else still means "run forever". You don't even need to recompile to use the new versions, just use the plugin.

17/10/2014, 01:33 AM
Thanks guys.

Timefix did really help!

[03:24:44] - 1 min has expired
[03:25:44] - 1 min has expired
[03:26:44] - 1 min has expired
[03:27:44] - 1 min has expired
Accurate, really really nice :)