SA-MP Forums Archive
Freeze timer - 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: Freeze timer (/showthread.php?tid=78072)



Freeze timer - Snyper - 16.05.2009

I need someone to help me make a freeze timer when people exit their house. I need it so when you type /exit , it freezes you for 3 seconds and then unfreeze you.

This is what I have but it's not working. It freezes you, but doesn't unfreeze.

Quote:

if(strcmp(cmd, "/exit", true) == 0)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(Froze[i] == 0)
{
TogglePlayerControllable(i,0);
Froze[i] = 1;
}
if(Froze[i] == 1)
{
TogglePlayerControllable(i,1);
Froze[i] = 0;
}

}

Quote:

SetTimer("Froze", 3000, 1);




Re: Freeze timer - ICECOLDKILLAK8 - 16.05.2009

Code:
pawn Код:
// Top of script
forward Unfreeze(playerid);

// In Command
TogglePlayerControllable(playerid,0);
SetTimerEx("Unfreeze",3000,0,"i",playerid);

// Anywhere in script (Apart from in another function)
public Unfreeze(playerid)
{
  TogglePlayerControllable(playerid,1);
  return 1;
}
Functions Used:
TogglePlayerControllable
SetTimerEx


Re: Freeze timer - Snyper - 16.05.2009

Oh so sexy, exactly what I wanted. Thank you.