12.10.2011, 16:18
(
Последний раз редактировалось Slice; 27.07.2015 в 16:09.
)
Note: The fixes2 or timerfix plugins takes care of this much better. Consider using it instead.
Hey,
I've recently been struggling with timers, and the fact that they aren't accurate by a damn sight. Here's an include that will make your timers accurate by ~5ms.
For example, it will turn this output from one 250ms timer and one 1500ms timer:
As you can see, the timer is roughly 25% off!
into this:
Usage
You just have to add one single line of code after you included a_samp:
Limitations
You can, by default, have only 128 timers running at the same time. If you feel the need to increase this, define TIMER_FIX_TIMER_SLOTS before you include the script.
Something to keep in mind is this include causes PAWN to work harder; therefore, you shouldn't have loads of timers running at the same time as it will require higher CPU usage.
Compatibility
Here: timerfix.inc
Hey,
I've recently been struggling with timers, and the fact that they aren't accurate by a damn sight. Here's an include that will make your timers accurate by ~5ms.
For example, it will turn this output from one 250ms timer and one 1500ms timer:
Код:
[17:54:33] Time since last call: 293ms (43 ms off) [17:54:34] Time since last call: 292ms (42ms off) [17:54:34] Time since last call: 292ms (42ms off) [17:54:34] Time since last call: 292ms (42ms off) [17:54:35] Time since last call: 292ms (42ms off) [17:54:35] Time since last call: 1786ms (286ms off) [17:54:37] Time since last call: 1756ms (256ms off) [17:54:38] Time since last call: 1756ms (256ms off) [17:54:40] Time since last call: 1756ms (256ms off) [17:54:42] Time since last call: 1756ms (256ms off)
into this:
Код:
[17:55:11] Time since last call: 251ms (1ms off) [17:55:11] Time since last call: 252ms (2ms off) [17:55:12] Time since last call: 252ms (2ms off) [17:55:12] Time since last call: 251ms (1ms off) [17:55:12] Time since last call: 251ms (1ms off) [17:55:12] Time since last call: 1498ms (2ms off) [17:55:14] Time since last call: 1499ms (1ms off) [17:55:15] Time since last call: 1499ms (1ms off) [17:55:17] Time since last call: 1500ms (0ms off) [17:55:18] Time since last call: 1499ms (1ms off)
You just have to add one single line of code after you included a_samp:
pawn Код:
#include <timerfix>
You can, by default, have only 128 timers running at the same time. If you feel the need to increase this, define TIMER_FIX_TIMER_SLOTS before you include the script.
Something to keep in mind is this include causes PAWN to work harder; therefore, you shouldn't have loads of timers running at the same time as it will require higher CPU usage.
Compatibility
- It works for SetTimer and SetTimerEx, though not with strings and arrays.
- It works very well with y_timers.
Here: timerfix.inc