SA-MP Forums Archive
Problem with objects - 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: Problem with objects (/showthread.php?tid=299868)



Problem with objects - [PS]NightborN - 27.11.2011

I have big problem with objects... I use incognito streamer.. And the problem - I maked Island over water and when i spawn cars falling on water and some times me ..


Re: Problem with objects - manchestera - 27.11.2011

use a timer to freeze yourself for so many seconds to give the objects sometime to load this is what i do and works fine for me


in you teleport cmd put this

Код:
Freeze(playerid, 5000);
at the bottom of your script

Код:
stock Freeze(playerid, time)
	{
	TogglePlayerControllable(playerid, false);
	SetTimerEx("Unfreeze", time, false, "i", playerid);
}
and this below it

Код:
forward Unfreeze(playerid);
public Unfreeze(playerid)
	{
	TogglePlayerControllable(playerid, true);
	return 1;
}



Re: Problem with objects - [PS]NightborN - 27.11.2011

How ?


Re: Problem with objects - manchestera - 27.11.2011

edit my post before might have missed a few bits just say what the errors are.


Respuesta: Problem with objects - OPremium - 27.11.2011

In my server I use something like this:

pawn Код:
stock Ex_SetPlayerPos(playerid, Float:x, Float:y, Float:z)
{
        if(floatabs(x) > 3000.0 || floatabs(y) > 3000.0) //Checks if the coords are outside the main land
        {
                TogglePlayerControllable(playerid, false); //Freezes the player
                SetTimerEx("SPP_Unfreeze", 5000, false, "d", playerid); //Sets a timer of ~5 seconds (Change the value if needed) to unfreeze the player
        }
        Streamer_UpdateEx(playerid, x, y, z); //Makes the streamer 'update' and load the objects in the position where the player will teleport
        return SetPlayerPos(playerid, x, y, z); //Sets the pos :P
}
#define SetPlayerPos Ex_SetPlayerPos
//^ "hooks" SetPlayerPos, no need to call the function in every teleport command, you just add this in top of script (after includes)

forward SPP_Unfreeze(playerid);
public SPP_Unfreeze(playerid)
{
        return TogglePlayerControllable(playerid, true); //Unfreezes the player :D
}