Timer Problem
#1

Helo, everyone!

I have a small problem, or question, or whatever you want to call it:

I have a 0.3.7 'Test' Server (compiled with 0.3.7 Includes) that was since March (I think) on 0.3z.
I don't know when, but I discovered that my timers aren't working ok... After I /kick someone, the timer is not executed in 50ms, it's executed in about a minute...

To try to fix this, I created a Test Command:

Код:
forward Test();
public OnRconCommand(cmd[])
{
    if(!strcmp(cmd, "test", true))
    {
        print("The function should be executed in 50ms."), SetTimerEx("Test", 50, false, "d");
        return 1;
    }
    return 0;
}
public Test()
{
	print("Function Executed Now!");
	return 1;
}
And here is the result:

Код:
[22:36:48] Console input: test
[22:36:48] The function should be executed in 50ms.
[22:37:42] Function Executed Now!
This timer: SetTimerEx("Test", 50, false, "d"); was executed in 56 seconds.
Ok, so I tried to make this timer execute in about 15 seonds, and the result was:

Код:
forward Test();
public OnRconCommand(cmd[])
{
    if(!strcmp(cmd, "test", true))
    {
        print("The function should be executed in about 15 secs."), SetTimerEx("Test", 10, false, "d");
        return 1;
    }
    return 0;
}
public Test()
{
	print("Function Executed Now!");
	return 1;
}
After I recompilled and reloaded the FilterScript:

Код:
[22:38:57] Console input: reloadfs Maps
[22:38:57]   Filterscript 'Maps.amx' unloaded.
[22:38:57]   Filterscript 'Maps.amx' loaded.
[22:38:59] Console input: test
[22:38:59] The function should be executed in 50ms.
[22:39:17] Function Executed Now!
As you see, my code was executed in 18 seconds...
Ok, if this is a 0.3.7 Update... How can I make a /kick timer that should be executed in about 0.x seconds ? My /kick timers are looking like:

Код:
forward KickEx(playerid);
format(Str, 200, "%s {CEC8C8}was automatically kicked (Reason: {00BBF6}Exceding Mute Warnings{CEC8C8})!", ReturnName(playerid)), SendClientMessageToAll(LBLUE, Str), SetTimerEx("KickEx", 50, false, "d", playerid);
public KickEx(playerid) return Kick(playerid);
With what can I replace it ? Or how ? If I don't use a timer, the message don't appear to the Kicked player... And I have this problem with /Leave command too...
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=375925
- Timer intervals are not accurate therefore this fix could/ should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)