SA-MP Forums Archive
Timers: Need help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timers: Need help (/showthread.php?tid=276122)



Timers: Need help - BigAl - 12.08.2011

Код:
public OnPlayerEnterCheckpoint(playerid)
{
    //-------------courier--------------
    {
    SetTimer("freeze", 3000, false);
	new freeze = TogglePlayerControllable(playerid, 0);
	freeze(playerid);
I need to know why this isn't working... and I was also wondering if you could describe or show me how to do this

Thanks, bigal


Re: Timers: Need help - MadeMan - 12.08.2011

If you want to freeze and unfreeze in 3 seconds, then

pawn Код:
public UnfreezePlayer(playerid)
{
    TogglePlayerControllable(playerid, 1);
}
pawn Код:
TogglePlayerControllable(playerid, 0);
SetTimerEx("UnfreezePlayer", 3000, false, "d", playerid);



Re: Timers: Need help - grand.Theft.Otto - 12.08.2011

Keep everything in that callback except ' new freeze ' and the ' toggleplayercontrollable '

add this to the bottom of your script:

pawn Код:
forward freeze(playerid)
public freeze(playerid)
{
      TogglePlayerControllable(playerid, 0);
      return 1;
}
Try that


Re: Timers: Need help - BigAl - 12.08.2011

Thanks Rep+


Re: Timers: Need help - Riddick94 - 12.08.2011

pawn Код:
function FreezePlayer(playerid, time)
{
    new string[16];
    if(time > 0)
    {
        TogglePlayerControllable(playerid, false);
        SetTimerEx("FreezePlayer", 1000, 0, "ii", playerid, time-1);
    }

    else
    {
        TogglePlayerControllable(playerid, true);
    }
    return true;
}
Usage:
pawn Код:
FreezePlayer(playerid, Your_time);