Freezing when on a teleport - 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: Freezing when on a teleport (
/showthread.php?tid=98239)
Freezing when on a teleport -
Stunterz - 19.09.2009
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.
Re: Freezing when on a teleport -
Badger(new) - 19.09.2009
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;
}
Re: Freezing when on a teleport -
Stunterz - 19.09.2009
Thanks, is works, but the vehicles dont freeze, how do i do that?, thanks
Re: Freezing when on a teleport -
Badger(new) - 19.09.2009
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.
Re: Freezing when on a teleport -
Stunterz - 19.09.2009
i know, but on serevrs i have seen it where all the vehicles and the player freeze so that the objects can load
Re: Freezing when on a teleport -
Badger(new) - 19.09.2009
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;
}
Re: Freezing when on a teleport -
Stunterz - 19.09.2009
ty