y_ini position loading issue
#1

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?
Reply
#2

Try freezing the player for 2-3 seconds.
Reply
#3

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

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

Код:
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.
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)