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



Problem with saving position - Outcast - 13.01.2011

Well, when I log out and log in to the server it works. Position is saved and player spawns on the place where he logged out. But when I restart the server, player gets spawned somewhere in the air, the screen is all white and there's a message saying "Stay within the world boundaries". When I check saved position in the .ini file it says:

PosX=0.000000
PosY=0.000000
PosZ=-95.604408


I don't get it, what is the problem here. I uploaded my whole GM code in hope you guys would help. I know the GM is shit atm but I plan to improve it.

Also, the position is loaded on login and put in AddPlayerClass on playerspawn. OnPlayerDisconnect is the position saving code.

EDIT: Pastebin http://pastebin.com/AgcWz68k


Re: Problem with saving position - Joe Staff - 13.01.2011

Ongamemodeinit, set every to login/register when that is called


Re: Problem with saving position - Outcast - 13.01.2011

Quote:
Originally Posted by SilentHuntR
Посмотреть сообщение
Ongamemodeinit, set every to login/register when that is called
They do. That's not the problem. The problem is that the position where the player logged off doesn't load after restarting the server.


Re: Problem with saving position - Joe Staff - 13.01.2011

Create a function to save all players' information, and then gmx. Make sure to not save their info tagain in OnGameModeExit


Re: Problem with saving position - Outcast - 13.01.2011

Quote:
Originally Posted by SilentHuntR
Посмотреть сообщение
Create a function to save all players' information, and then gmx. Make sure to not save their info tagain in OnGameModeExit
After I restart the server but before I log into it for the second time, the co-ordinates are saved in the .ini. I read them . When you log in then you go to X,Y,Z 0,0,-90 for some reason. So, before logging in, info is saved, but after logging in it gets messed up and not read properly.