Freezing when on a teleport
#1

Hi, i have seen it on other server, when you teleport to a place, all the vehicles and the player freeze while the objects load, please can you tell me how this is done?
Thanks.
Reply
#2

Easy. Use a timer.

Example:
pawn Код:
//After the includes
forward FreezeTimer(playerid);

//When they teleport
TogglePlayerControllable(playerid,0);
SetTimerEx("FreezeTimer",3000,0,"d",playerid);

//When The Timer Stops
public FreezeTimer(playerid)
{
  TogglePlayerControllable(playerid,1);
  return 1;
}
Reply
#3

Thanks, is works, but the vehicles dont freeze, how do i do that?, thanks
Reply
#4

You mean the vehicles don't fall through the objects, until the objects are loaded? I fixed that by making objects that the vehicles spawn on, with createobject, then stream everything else.
Reply
#5

i know, but on serevrs i have seen it where all the vehicles and the player freeze so that the objects can load
Reply
#6

Hmm. You could have something like this:
pawn Код:
//Next to the other forward
forward VFreeze(vehicleid,Float:x,Float:y,Float:z);

//When they teleport
New Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
for(new v; v<750; v++)
{
  if(GetVehicleModel(vehicleid)!=0)
  {
    New Float:vx,Float:vy, Float:vz;
    GetVehiclePos(v,vx,vy,vz);
    if((vx-x<50)&&(vy-y<50)&&(vz-z<50))
    {
      SetTimerEx("VFreeze",3000,0,"dfff",v,vx,vy,vz);
    }
  }
}

//The Timer ending
public VFreeze(vehicleid,Float:x,Float:y,Float:z)
{
  for(new i;i<200;i++)
  {
    if(IsPlayerConnected(i))
    {
      if(IsPlayerInVehicle(i,vehicleid))return 0;
      SetVehiclePos(vehicleid,x,y,z);
    }
  }
  return 1;
}
Reply
#7

ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)