Freeze player on connect
#1

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.");
}
Reply
#2

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.");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)