[Plugin] Timer Fix
#1

Timer Fix v1.1.1


Description
This plugin makes timers more accurate


Natives
PHP Code:
/*
 * Replacement for a standart native function that includes additional parameters.
 * delay - the delay before the timer starts.
 * count - count of executions.
 */
native SetCustomTimer(funcname[], intervaldelaycount);
/*
 * The same function but with argument passing.
 */
native SetCustomTimerEx(funcname[], delaycount, const format[], {Float,_}:...);
native KillAllTimers();
native IsValidTimer(timerid);
native GetTimerInterval(timerid);
native SetTimerInterval(timeridinterval);
native GetTimerRemainingTime(timerid);
/*
 * Stops the timer but doesn't delete it.
 * Use the ContinueTimer() to start it again.
 * Note: the callback will execute after the time remaining before the call.
 */
native PauseTimer(timerid);
/*
 * Continues the timer after pausing.
 */
native ContinueTimer(timerid);
/*
 * Adds the custom callback for timer.
 * For example:
 * new a = SetTimer("function_1");
 * AddTimerHandler(a, "function_2");
 * The timer will execute both callbacks.
 *
 * Note: arguments will also be passed to both functions.
 */
native AddTimerHandler(timeridhandler[]);
/*
 * Removes the added handler.
 */
native RemoveTimerHandler(timeridhandler[]); 
Example
PHP Code:
#include <timerfix>
new num 0;
new 
timer;
main() {
  
timer SetTimer("callback",1000,true)
}
forward callback();
public 
callback() {
  if(++
num >= 5) {
    if(
IsValidTimer(timer)) KillTimer(timer);
    
SetTimerEx("callbackEx",1000,false,"d",num);
  }
}
forward callbackEx(num);
public 
callbackEx(num) {
  
printf("Num: %d",num);
  
KillAllTimers();

Download
Binaries(Windows, Linux)
Source code
Reply


Messages In This Thread
Timer Fix - by KashCherry - 05.03.2018, 16:13
Re: Timer Fix - Do not miss a one second - by Sting. - 05.03.2018, 17:22
Re: Timer Fix - Do not miss a one second - by KashCherry - 05.03.2018, 17:31
Re: Timer Fix - Do not miss a one second - by iKarim - 05.03.2018, 18:28
Re: Timer Fix - Do not miss a one second - by KashCherry - 05.03.2018, 19:17
Re: Timer Fix - Do not miss a one second - by KashCherry - 06.03.2018, 19:07
Re: Timer Fix - Do not miss a one second - by Dim4Shift - 16.03.2018, 14:39
Re: Timer Fix - Do not miss a one second - by KashCherry - 16.03.2018, 16:06
Re: Timer Fix - Do not miss a one second - by Dim4Shift - 16.03.2018, 16:22
Re: Timer Fix - Do not miss a one second - by KashCherry - 16.03.2018, 18:59
Re: Timer Fix - Do not miss a one second - by ForCop - 23.03.2018, 14:12
Re: Timer Fix - Do not miss a one second - by KashCherry - 23.03.2018, 15:09
Re: Timer Fix - by m4karow - 23.03.2018, 17:06
Re: Timer Fix - by JustNothing - 01.04.2018, 13:18
Re: Timer Fix - by AroseKhanNiazi - 02.04.2018, 17:30
Re: Timer Fix - by must006 - 24.04.2018, 20:33
Re: Timer Fix - by KashCherry - 26.04.2018, 13:06
Re: Timer Fix - by must006 - 01.05.2018, 03:10
Re: Timer Fix - by KashCherry - 01.05.2018, 06:12
Re: Timer Fix - by must006 - 01.05.2018, 12:22
Re: Timer Fix - by KashCherry - 01.05.2018, 21:28
Re: Timer Fix - by Injury - 01.05.2018, 22:21
Re: Timer Fix - by KashCherry - 01.05.2018, 22:43
Re: Timer Fix - by Injury - 01.05.2018, 22:54
Re: Timer Fix - by Salik - 02.06.2018, 14:07
Re: Timer Fix - by KashCherry - 02.06.2018, 21:47
Re: Timer Fix - by Salik - 05.06.2018, 14:32
Re: Timer Fix - by KashCherry - 05.06.2018, 15:58
Re: Timer Fix - by Salik - 05.06.2018, 19:49
Re: Timer Fix - by Salik - 06.06.2018, 05:17
Re: Timer Fix - by Salik - 06.06.2018, 07:04
Re: Timer Fix - by KashCherry - 06.06.2018, 19:59
Re: Timer Fix - by Salik - 07.06.2018, 06:24
Re: Timer Fix - by GuyYahood1 - 07.07.2018, 00:06
Re: Timer Fix - by Dayrion - 07.07.2018, 11:48
Re: Timer Fix - by GuyYahood1 - 08.07.2018, 22:46
Re: Timer Fix - by GangstaSunny. - 10.07.2018, 02:20
Re: Timer Fix - by coool - 10.07.2018, 11:11
Re: Timer Fix - by Moldova - 14.07.2018, 19:45
Re: Timer Fix - by KashCherry - 19.08.2018, 11:53
Re: Timer Fix - by Florin48 - 19.08.2018, 16:10
Re: Timer Fix - by KashCherry - 21.08.2018, 11:05
Re: Timer Fix - by desu - 22.08.2018, 10:11
Re: Timer Fix - by KashCherry - 30.08.2018, 18:52
Re: Timer Fix - by GangstaSunny. - 02.09.2018, 14:06
Re: Timer Fix - by KashCherry - 22.09.2018, 08:52
Re: Timer Fix - by CantBeJohn - 24.09.2018, 16:07
Re: Timer Fix - by KashCherry - 24.09.2018, 19:48
Re: Timer Fix - by CantBeJohn - 25.09.2018, 02:04
Re: Timer Fix - by KashCherry - 25.09.2018, 13:05
Re: Timer Fix - by KashCherry - 25.09.2018, 18:27
Re: Timer Fix - by GangstaSunny. - 27.09.2018, 08:35
Re: Timer Fix - by KashCherry - 28.09.2018, 13:19
Re: Timer Fix - by Infin1ty - 07.10.2018, 07:18
Re: Timer Fix - by KashCherry - 07.10.2018, 08:23
Re: Timer Fix - by DeLTi - 20.10.2018, 22:29
Re: Timer Fix - by KashCherry - 21.10.2018, 10:59
Re: Timer Fix - by StRaphael - 03.11.2018, 13:37
Re: Timer Fix - by KashCherry - 04.11.2018, 06:43
Re: Timer Fix - by KashCherry - 04.11.2018, 06:59
Re: Timer Fix - by StRaphael - 04.11.2018, 12:12
Re: Timer Fix - by KashCherry - 07.11.2018, 11:41
Re: Timer Fix - by StRaphael - 07.11.2018, 18:25
Re: Timer Fix - by KashCherry - 07.11.2018, 18:50
Re: Timer Fix - by StRaphael - 07.11.2018, 20:30
Re: Timer Fix - by KashCherry - 08.11.2018, 07:55
Re: Timer Fix - by StRaphael - 08.11.2018, 11:28
Re: Timer Fix - by KashCherry - 08.11.2018, 12:26
Re: Timer Fix - by HommeDieu - 28.01.2019, 10:13
Re: Timer Fix - by gurmani11 - 17.09.2019, 13:10
Re: Timer Fix - by KashCherry - 13.01.2020, 19:50
Re: Timer Fix - by KashCherry - 14.01.2020, 16:19
Re: Timer Fix - by TokicMajstor - 17.01.2020, 09:53
Re: Timer Fix - by UserName12 - 06.02.2020, 21:15
Re: Timer Fix - by WestCoast1337 - 05.03.2020, 10:10
Re: Timer Fix - by RudeWorld - 01.05.2020, 00:00
Re: Timer Fix - by DmitriyShift - 25.05.2020, 14:53
Re: Timer Fix - by Unrea1 - 26.05.2020, 16:38

Forum Jump:


Users browsing this thread: 1 Guest(s)