SA-MP Forums Archive
y_ini position loading issue - 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: y_ini position loading issue (/showthread.php?tid=652956)



y_ini position loading issue - Mike861 - 22.04.2018

So im making my gamemode from scratch using yini, everything is going neatly but this one thing is bothering me, position saving/loading.When players first ever register they spawn fine, but when they join the server and login they spawn at their last location but they fall through the ground and get automatically tp-ed to the surface.
Code:
Код:
if(PlayerInfo[playerid][NewReg] == 0)
	{
	    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
		SetPlayerPos(playerid, PlayerInfo[playerid][Xpos], PlayerInfo[playerid][Ypos]+1.0, PlayerInfo[playerid][Zpos]+0.3);
	}
That code is OnPlayerSpawn and checks the players last pos and skin and loads it.I tried to higher up the Zpos but i still get the same issue.What to do?


Re: y_ini position loading issue - StefaNO [ITA] - 22.04.2018

Try freezing the player for 2-3 seconds.


Re: y_ini position loading issue - Mike861 - 22.04.2018

Quote:
Originally Posted by StefaNO [ITA]
Посмотреть сообщение
Try freezing the player for 2-3 seconds.
I'll try tomorrow, but im not using custom map.


Re: y_ini position loading issue - Mike861 - 23.04.2018

It didn't work, i fixed it by highering up the zPos way high like this:
Код:
PlayerInfo[playerid][Zpos]+31.0001);



Re: y_ini position loading issue - andrejc999 - 23.04.2018

Код:
stock Freeze(playerid, sec)
{
    TogglePlayerControllable(playerid, false);
    SetTimerEx("FreezeStop", sec * 1000, false, "i", playerid);
    return 1;
}
forward FreezeStop(playerid);
public FreezeStop(playerid)
{
    TogglePlayerControllable(playerid, true);
    return 1;
}
Add this to your GM, it's useful, and than just use Freeze(playerid, 1/2); to freeze a player for 1/2 seconds.


Re: y_ini position loading issue - Mike861 - 23.04.2018

It turned out that if i set zPos to 31.0001 it does spawn you good on higher zPos that are saved, but when your pos saves from a smaller zPos you will start falling from the sky depending on how high is zPos between saved one and 31.0001.Anyone got a fix for this?Its a pain in the ass