/*
* Replacement for a standart native function that includes additional parameters.
* delay - the delay before the timer starts.
* count - count of executions.
*/
native SetCustomTimer(funcname[], interval, delay, count);
/*
* The same function but with argument passing.
*/
native SetCustomTimerEx(funcname[], delay, count, const format[], {Float,_}:...);
native KillAllTimers();
native IsValidTimer(timerid);
native GetTimerInterval(timerid);
native SetTimerInterval(timerid, interval);
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(timerid, handler[]);
/*
* Removes the added handler.
*/
native RemoveTimerHandler(timerid, handler[]);
#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();
}
Originally Posted by ******
What's the advantage of this version over udan's, YSF's, Slice's, or any other?
|
// this plugin (v0.7)
5000ms
5000ms
5000ms
5000ms
5000ms
// udan's plugin (v1.5)
5004ms
4997ms
5000ms
5004ms
5000ms
Timer Fix v0.7 Description This plugin makes timers more accurate Natives PHP Code:
PHP Code:
Binaries(Windows, Linux) Source code |
[10:57:29] Loading plugin: timerfix.so [10:57:29] Timer Fix plugin v0.7 by KashCherry loaded [10:57:29] Loaded. [10:57:29] Loaded 9 plugins. [10:57:29] [10:57:29] Filterscripts [10:57:29] --------------- [10:57:29] Loaded 0 filterscripts. [10:57:30] MySQL baza, a fost conectata! [10:57:30] ----------- Vehicle: 156 MaterialObjects: 112 Objects: 750 DynamicObjects: 2424 Pickps: 20 ----------- [10:57:30] Number of vehicle models: 46 [10:58:24] Kicking 92.119.39.147 because they didn't logon to the game. [10:58:24] Kicking 200.53.203.103 because they didn't logon to the game. [10:58:30] [connection] incoming connection: 200.53.203.103:29209 id: 0 [10:58:30] Invalid client connecting from 200.53.203.103 [10:58:30] [connection] incoming connection: 92.119.39.147:54599 id: 1 [10:58:30] [connection] incoming connection: 200.53.203.103:29217 id: 2 [10:58:30] Invalid client connecting from 92.119.39.147 [10:58:30] Invalid client connecting from 200.53.203.103
the idea is good ... but when I put this plugin the server blocks the players from connecting.
Code:
[10:57:29] Loading plugin: timerfix.so [10:57:29] Timer Fix plugin v0.7 by KashCherry loaded [10:57:29] Loaded. [10:57:29] Loaded 9 plugins. [10:57:29] [10:57:29] Filterscripts [10:57:29] --------------- [10:57:29] Loaded 0 filterscripts. [10:57:30] MySQL baza, a fost conectata! [10:57:30] ----------- Vehicle: 156 MaterialObjects: 112 Objects: 750 DynamicObjects: 2424 Pickps: 20 ----------- [10:57:30] Number of vehicle models: 46 [10:58:24] Kicking 92.119.39.147 because they didn't logon to the game. [10:58:24] Kicking 200.53.203.103 because they didn't logon to the game. [10:58:30] [connection] incoming connection: 200.53.203.103:29209 id: 0 [10:58:30] Invalid client connecting from 200.53.203.103 [10:58:30] [connection] incoming connection: 92.119.39.147:54599 id: 1 [10:58:30] [connection] incoming connection: 200.53.203.103:29217 id: 2 [10:58:30] Invalid client connecting from 92.119.39.147 [10:58:30] Invalid client connecting from 200.53.203.103 |
Fixed, download from here.
|
[12:15:08] [Timer Fix] KillTimer: cannot find timer with id 0
#define INVALID_TIMER_ID (0xFFFF) stock IsValidTimer(timerid) { if(timerid != INVALID_TIMER_ID) return true; return false; }
I use some a few fast timer for animation callbacks, and maybe it will useful for me. i'll try it, thanks!
hmm, okay Code:
[2018/03/23 14:36:01] [Timer Fix] Cannot call function [EL: 1] [2018/03/23 14:36:01] [Timer Fix] Cannot call function [EL: 1] Code:
[2018/03/23 14:36:01] [Timer Fix] KillTimer: cannot find timer with id 0 |
if(IsValidTimer(timerid)) KillTimer(timerid);
new timerid; public OnGameModeInit() { timerid = SetTimer("UpDate",1000, true); return true; } forward UpDate(); public UpDate() { if(IsValidTimer(timerid)) KillTimer(timerid); return true; }
I use some a few fast timer for animation callbacks, and maybe it will useful for me. i'll try it, thanks!
hmm, okay Code:
[2018/03/23 14:36:01] [Timer Fix] Cannot call function [EL: 1] [2018/03/23 14:36:01] [Timer Fix] Cannot call function [EL: 1] Code:
[2018/03/23 14:36:01] [Timer Fix] KillTimer: cannot find timer with id 0 |
Thanks @KashCherry
I have a problem with KillTimer function. Can you check please? |
Kicking 127.0.0.1 because they didn't logon to the game.