Timer problem
#1

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;
}
Reply
#2

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.
Reply
#3

Thanks REP !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)