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



Freeze player - ,TomY' - 02.08.2016

How to freeze player for 3 seconds? I know, that freeze player with TogglePlayerControllable(playerid,0); , but how for 3 secs?


Re: Freeze player - J0sh... - 02.08.2016

You could use a timer.
PHP код:
SetTimerEx("Player_Frozen"3000false"i"playerid);
forward Player_Frozen(playerid);
public 
Player_Frozen(playerid) {
    
TogglePlayerControllable(playerid1);
    return 
1;




Re: Freeze player - SyS - 02.08.2016

add these codes in the part you want its use.
PHP код:
//You code......
    
TogglePlayerControllable(playeridfalse);
    
SetTimerEx("UnfreezePlayer"3000false"i"playerid); 
add this function as global.
PHP код:
forward UnfreezePlayer(playerid);
public 
UnfreezePlayer(playerid)
{
    return 
TogglePlayerControllable(playeridtrue);