SA-MP Forums Archive
Timer danger - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer danger (/showthread.php?tid=503563)



Timer danger - Urukhay - 30.03.2014

Why SetTimerEx dangerous? And PVar is cool?


Re: Timer danger - Evocator - 30.03.2014

SetTimerEx are roughly 25% off.
So i prefer including *****'s fixes2 and use SetTimerEx_

https://sampwiki.blast.hk/wiki/SetTimerEx


Re: Timer danger - newbienoob - 30.03.2014

or just use onplayerupdate. more accurate
pawn Код:
static Timer[MAX_PLAYERS][2], bool:TimerRepeat[MAX_PLAYERS][2];
public OnPlayerUpdate(playerid)
{
    if(gettime() - Timer[playerid][0] > 3 && TimerRepeat[playerid][0] == false)
    {
        SendClientMessage(playerid, -1, "3 seconds have passed and this message will not be shown again.");
        Timer[playerid][0] = gettime();
    }
    if(gettime() - Timer[playerid][1] > 3 && TimerRepeat[playerid][1] == true)
    {
        SendClientMessage(playerid, -1, "3 seconds have passed and this message will be shown again in 3 seconds.");
        Timer[playerid][1] = gettime();
    }
    return 1'
}
correct me if the code was wrong. didnt test it