SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Plugin Development (https://forum.sa-mp.com/forumdisplay.php?f=18)
-   -   [Plugin] Timerfix plugin - A fix for every ttime related issue (https://forum.sa-mp.com/showthread.php?t=435525)

Dan.. 07/05/2013 12:37 PM

Timerfix plugin - A fix for every ttime related issue
 

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
  1. Move the binaries in the plugins/ folder.
  2. Write timerfix (Windows) or timerfix.so (Linux) in the server.cfg at the end of the line containing plugins.
  3. Add the #include <timerfix> at the top of the script only if you want to use additional methods added.

Notes
  1. This plugin fixes the basic timer system existent in SA:MP (SetTimer, SetTimerEx, KillTimer) and GetTickCount.
  2. 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

[DFE]Ike 07/05/2013 07:13 PM

AW: Timerfix plugin - A fix for every ttime related issue
 
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.

Bicentric 07/05/2013 08:11 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
Looks good! Might actually consider using it, I want to see some benchmarks first :)

ikey07 07/05/2013 08:51 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
Definitely will try

Rock 07/05/2013 09:15 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
I'm waiting for some benchmarking against fixes2.

OpticKiller 07/05/2013 10:14 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
May I ask what this thing does????

Pooh7 07/05/2013 10:54 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
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.

Dan.. 08/05/2013 04:24 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
Quote:

Originally Posted by [DFE]Ike (Post 2515544)
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 (Post 2515632)
Looks good! Might actually consider using it, I want to see some benchmarks first :)

Quote:

Originally Posted by Rockk (Post 2515713)
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 (Post 2515825)
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.

Cell_ 08/05/2013 04:27 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
I am pretty content with Slice's include: http://forum.sa-mp.com/showthread.php?t=289675 . Why should I use this over that include, if you can please explain?

Dan.. 08/05/2013 04:34 PM

Re: Timerfix plugin - A fix for every ttime related issue
 
Quote:

Originally Posted by Cell_ (Post 2516717)
I am pretty content with Slice's include: http://forum.sa-mp.com/showthread.php?t=289675 . Why should I use this over that include, if you can please explain?

It is faster, uses less resources, fixes more issues, adds new features.


All times are GMT. The time now is 05:32 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.