SA-MP Forums Archive
Timer problem - 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 problem (/showthread.php?tid=545395)



Timer problem - buburuzu19 - 08.11.2014

I make a code who slaps a player and freeze it for 3 seconds in the air when he press "F" for entering in a vehicle.I am using settimerex for unfreezing him but if 2 players press F to the car one of them is remaining stucked ( the timer isn't executing for him too) , i looped it but it's a bad ideea because it's unfreezing all the server when the timer is executing.
What to do?
pawn Код:
SLD = SetTimerEx("UnSlap", 1000, 0, "i", playerid);
public UnSlap(playerid)
{
    PlayerV[playerid][pFreezeTime] = 0;
    PlayerV[playerid][pFreezeType] = 0;
    TogglePlayerControllable(playerid, 1);
    KillTimer(SLD);
    return 1;
}



Re: Timer problem - Virtual1ty - 08.11.2014

Remove the 'SLD' variable referencing a player timer and remove the KillTimer line of code. It's a non-looping timer, hence it will finish executing and internally be removed from the SA-MPs timer queue so no need to 'kill' it.

Should work after that, I see no other problem with it.


Re: Timer problem - buburuzu19 - 08.11.2014

Thanks REP !