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



Freeze player on connect - patfay - 09.06.2011

Alright, well I have a complete built map I made, and Its going to be where the server is (Prison roleplay) and I wanted to make it so that, since its in the air and objects load slow sometimes, when you connect you freeze for about 5 seconds. I have the timer and everything set up, just dont know how to make it like that..

Timer:
pawn Code:
{
SetTimer("Antifreeze",1,false); //To prevent falling through the objects.
SendClientMessage(playerid, WHITE, "You have been frozen to prevent falling.");
}



Re: Freeze player on connect - *IsBack - 09.06.2011

Quote:
Originally Posted by patfay
View Post
Alright, well I have a complete built map I made, and Its going to be where the server is (Prison roleplay) and I wanted to make it so that, since its in the air and objects load slow sometimes, when you connect you freeze for about 5 seconds. I have the timer and everything set up, just dont know how to make it like that..

Timer:
pawn Code:
{
SetTimer("Antifreeze",1,false); //To prevent falling through the objects.
SendClientMessage(playerid, WHITE, "You have been frozen to prevent falling.");
}
I recommend you this:
Objects load slow if you use an object streamer and players may fall down (since objects are in air). But if you'd make the ground/floor (or whatever object players stands on) without streamer (using CreateObject(); ) that will make players stay on it even if it's not rendered yet (so they won't fall down).
But if you still wanna do it your way, use this:
pawn Code:
public OnPlayerSpawn(....)
{
     TogglePlayerControllable(playerid,0);
     SetTimerEx("Antifreeze",1000*5,false,d,playerid); //To prevent falling through the objects.
     SendClientMessage(playerid, WHITE, "You have been frozen to prevent falling.");
}

forward Antifreeze(playerid);
public Antifreeze(playerid)
{
     TogglePlayerControllable(playerid,1);
     SendClientMessage(playerid, WHITE, "You can move now.");
}