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



Timer dosent work. - gnoomen2 - 09.02.2013

I got:

pawn Код:
if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 548)
    {
        TogglePlayerControllable(playerid, 0);
        SetTimer("Unfreeze", 1000, false);
        SetPlayerPos(playerid, 315.745086,984.969299,1958.919067);
        SetPlayerInterior(playerid, 9);
        SetCameraBehindPlayer(playerid);
        Bobcat = GetPlayerVehicleID(playerid);
        InAndro[playerid] = 1;
    }
    return 1;
}
And:

pawn Код:
forward Unfreeze(playerid);
public Unfreeze(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}
The position sets the player, but i do not get unfreezed..


Re: Timer dosent work. - MP2 - 09.02.2013

SetTimerEx must be used if you wish to pass arguments (in this case 'playerid') to the timer function:

pawn Код:
SetTimerEx("Unfreeze", 1000, false, "i", playerid);
https://sampwiki.blast.hk/wiki/SetTimerEx

Also, I recommend calling your functions/variables etc. better names. 'UnfreezePlayer' would be a start. 'Unfreeze' is too vague - unfreeze what? The chicken?


Re: Timer dosent work. - gnoomen2 - 09.02.2013

Alright, Thanks!