Timerfix plugin - A fix for every ttime related issue -
Dan.. - 07.05.2013
Timerfix
Timerfix provides an improvement (increases the accuracy) to the timers system existent in SA-MP server.
Building- Windows: Open the samp-plugin-timerfix.sln and hit the `Build` button. Binaries will be located in the bin/ folder and will have the name timerfix.dll.
- Linux: Type in terminal make. Binaries will be located in the bin/ folder and will have the name timerfix.so.
Installing- Move the binaries in the plugins/ folder.
- Write timerfix (Windows) or timerfix.so (Linux) in the server.cfg at the end of the line containing plugins.
- Add the #include <timerfix> at the top of the script only if you want to use additional methods added.
Notes- This plugin fixes the basic timer system existent in SA:MP (SetTimer, SetTimerEx, KillTimer) and GetTickCount.
- This plugin also adds new natives (player timers, which are automatically killed when the player disconnects; there is a hook in the include file), which require `timerfix` include file.
Benchmarks
I haven't done any yet.
For downloads please check the downloads branch for anything else check the project on Github.com
AW: Timerfix plugin - A fix for every ttime related issue -
[DFE]Ike - 07.05.2013
Change
Code:
#if defined TIMERFIX_OnPlayerDisconnect
return TIMERFIX_OnPlayerDisconnect(playerid);
to
Code:
#if defined TIMERFIX_OnPlayerDisconnect
return TIMERFIX_OnPlayerDisconnect(playerid, reason);
EDIT: + Add something like "KillPlayerTimer(timerid)", because I don't want to define for every PlayerTimer the delay untill the PlayerTimer is deleted. KillPlayerTimers delete all PlayerTimers, that's useless for me.
Re: Timerfix plugin - A fix for every ttime related issue -
Bicentric - 07.05.2013
Looks good! Might actually consider using it, I want to see some benchmarks first
Re: Timerfix plugin - A fix for every ttime related issue -
ikey07 - 07.05.2013
Definitely will try
Re: Timerfix plugin - A fix for every ttime related issue -
Rock - 07.05.2013
I'm waiting for some benchmarking against fixes2.
Re: Timerfix plugin - A fix for every ttime related issue -
OpticKiller - 07.05.2013
May I ask what this thing does
?
Re: Timerfix plugin - A fix for every ttime related issue -
Pooh7 - 07.05.2013
Quote:
Originally Posted by SA-MP Wiki
Timer intervals are not accurate (roughly 25% off). There are fixes available for this on the SA-MP forums.
|
Apparently, this is one of the fixes.
Re: Timerfix plugin - A fix for every ttime related issue -
Dan.. - 08.05.2013
Quote:
Originally Posted by [DFE]Ike
Change
Code:
#if defined TIMERFIX_OnPlayerDisconnect
return TIMERFIX_OnPlayerDisconnect(playerid);
to
Code:
#if defined TIMERFIX_OnPlayerDisconnect
return TIMERFIX_OnPlayerDisconnect(playerid, reason);
EDIT: + Add something like "KillPlayerTimer(timerid)", because I don't want to define for every PlayerTimer the delay untill the PlayerTimer is deleted. KillPlayerTimers delete all PlayerTimers, that's useless for me.
|
KillTimer(timerid) works for player timers too!
Quote:
Originally Posted by Bicentric
Looks good! Might actually consider using it, I want to see some benchmarks first
|
Quote:
Originally Posted by Rockk
I'm waiting for some benchmarking against fixes2.
|
Why? This is as fast as the basic timer system and ******'s plugin.
Quote:
Originally Posted by OpticKiller
May I ask what this thing does ?
|
SA-MP timers and all time related functions aren't as accurate as you may think. This fixes them.
Re: Timerfix plugin - A fix for every ttime related issue -
Cell_ - 08.05.2013
I am pretty content with Slice's include:
https://sampforum.blast.hk/showthread.php?tid=289675 . Why should I use this over that include, if you can please explain?
Re: Timerfix plugin - A fix for every ttime related issue -
Dan.. - 08.05.2013
Quote:
Originally Posted by Cell_
|
It is faster, uses less resources, fixes more issues, adds new features.
Re: Timerfix plugin - A fix for every ttime related issue -
Dan.. - 09.05.2013
I've released v1.2. This fixes all player timers related issues. If you use them, please update!
Quote:
Originally Posted by Rajat_Pawar
Thanks, it's good. I don't know if it matters to you, but some reputation, you have earned! Cheers. Also, could you mind PMing me and sharing a few pointers with me about plugins? Writing them? Seeing that you are a plugin guy! (No, I don't want a link to the plugin tutorial.)
|
Well.. I started reading that plugin tutorial. I really don't know any better learning material.
Quote:
Originally Posted by Luis-
What would I do if I was too repeat the timer? I see nothing related to repeating.
|
Please read the documentation. There is a "repeating" paramter.
Re: Timerfix plugin - A fix for every ttime related issue -
Luis- - 09.05.2013
Ah, thanks!
Re: Timerfix plugin - A fix for every ttime related issue -
Edvin - 09.05.2013
Quote:
Originally Posted by Dan..
* This plugin also adds new natives (player timers, which are automatically killed when the player disconnects; there is a hook in the include file), which require `timerfix` include file.
|
This per-player timers are very useful (i think i will use they in the future). I know per-player timers are scriptable, but in my opinion, everything made in C++(plugin, like these functions) are more accurately than in pawn. Good Job !
Re: Timerfix plugin - A fix for every ttime related issue -
Luis- - 09.05.2013
I just updated to v1.2 to find I couldn't connect to my server, reverted back to v1.1 and could connect.
Re: Timerfix plugin - A fix for every ttime related issue -
Dan.. - 09.05.2013
Quote:
Originally Posted by Luis-
I just updated to v1.2 to find I couldn't connect to my server, reverted back to v1.1 and could connect.
|
Can you post your server_log.txt? I tested on multiple servers and it works fine.
Re: Timerfix plugin - A fix for every ttime related issue -
IstuntmanI - 26.05.2013
I tested the timers with a 1000ms interval without this plugin and they are executed at a interval of ~1050ms, with this plugin they are at 1000ms +- 5ms (very accurate).
I have a suggestion, this could be useful (at least for me):
pawn Code:
native GetTimerCountLeft( timerid );
/*
Returns:
-1: infinite timer (basic timers with repeating at 1 or improved timers with count at -1)
0: inexistent timers (timers with execution finished, or which didn't existed at all)
number of counts left: if there are counts left (improved timers)
*/
Re: Timerfix plugin - A fix for every ttime related issue -
Konstantinos - 01.07.2013
Pretty much a month has passed since the last post, but it's a really great and useful plugin.
I tested it on 1000 milliseconds timer with parameters and it was executed at 995-1005.
I'd like to learn though, how can I use the delay parameter. On the test, I set it to 1000, just like the interval.
Thanks and very good job!
EDIT: On a test at 5000 milliseconds, here's the results:
pawn Code:
[16:41:59] OnServerCheckMoney: 5006
[16:42:04] OnServerCheckMoney: 4773 // Ouch
[16:42:09] OnServerCheckMoney: 4999
[16:42:14] OnServerCheckMoney: 5001
[16:42:19] OnServerCheckMoney: 5003
[16:42:24] OnServerCheckMoney: 4998
[16:42:29] OnServerCheckMoney: 4996
[16:42:34] OnServerCheckMoney: 5004
[16:42:39] OnServerCheckMoney: 4997
[16:42:44] OnServerCheckMoney: 4997
[16:42:49] OnServerCheckMoney: 5001
[16:42:54] OnServerCheckMoney: 5002
[16:42:59] OnServerCheckMoney: 4998
[16:43:04] OnServerCheckMoney: 5000
[16:43:09] OnServerCheckMoney: 4997
[16:43:14] OnServerCheckMoney: 5002
[16:43:19] OnServerCheckMoney: 4993
[16:43:24] OnServerCheckMoney: 5004
[16:43:29] OnServerCheckMoney: 4914
[16:43:34] OnServerCheckMoney: 4994
[16:43:39] OnServerCheckMoney: 5000
[16:43:44] OnServerCheckMoney: 5001
[16:43:49] OnServerCheckMoney: 4997
[16:43:54] OnServerCheckMoney: 5000
[16:43:59] OnServerCheckMoney: 5003
[16:44:04] OnServerCheckMoney: 4998
[16:44:09] OnServerCheckMoney: 4996
[16:44:14] OnServerCheckMoney: 5001
[16:44:19] OnServerCheckMoney: 5001
[16:44:24] OnServerCheckMoney: 4996
[16:44:29] OnServerCheckMoney: 5000
[16:44:35] OnServerCheckMoney: 5003
[16:44:39] OnServerCheckMoney: 3703 // OUCH!
[16:44:44] OnServerCheckMoney: 4998
[16:44:49] OnServerCheckMoney: 5001
Excluding these 2 results, the rest of it seems to be good enough!
Re: Timerfix plugin - A fix for every ttime related issue -
Gigi-The-Beast - 01.07.2013
The delay should be the time that is required to pass after which the timer will start working.
Example: delay 5 sec, timer 1sec
5 seconds will pass and then a 1 second timer will start working.
Re: Timerfix plugin - A fix for every ttime related issue -
IstuntmanI - 20.07.2013
Quote:
Originally Posted by IstuntmanI
I have a suggestion, this could be useful (at least for me):
pawn Code:
native GetTimerCountLeft( timerid ); /* Returns: -1: infinite timer (basic timers with repeating at 1 or improved timers with count at -1) 0: inexistent timers (timers with execution finished, or which didn't existed at all) number of counts left: if there are counts left (improved timers) */
|
Also, another one:
pawn Code:
native GetTimerIntervalLeft( timerid );
/*
Returns:
0: inexistent timers (timers with execution finished, or which didn't existed at all)
interval left: how many milliseconds left until the timer is called again
*/
Well... ?
Re: Timerfix plugin - A fix for every ttime related issue -
Edvin - 29.07.2013
I have a problem. I have this in my script:
Code:
mytimer[playerid] = SetPlayerTimerEx(playerid, "FunctionName", 990, true, "i", playerid);
And after, in OnDialogResponse i use:
Code:
KillPlayerTimer(mytimer[playerid]);
to kill the repeating process, but i don't know why, the timer aren't getting destroyed. It still repeats... It's a plugin bug, or i did something wrong?