Upon server restart - 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: Upon server restart (
/showthread.php?tid=453088)
Upon server restart -
Jernu - 23.07.2013
When the server restarts and you're still logged in, your coords get reset to 0.00000.
I got told it's a SA:MP bug and there's a work-around with a timer?
Is this true? If so, how?
Regards.
Re: Upon server restart -
Income - 23.07.2013
It doesn't sets your coordinates to the default 0.0000 etc, it just teleports you to the beach at Los Santos.
0 coords are referring to the middle of the San Andreas map, at Blueberry - next to the farm.
Since you're basically restarting the server, using a saving method won't help you out since it'll get reseted upon the reset; try to use the SetPlayerPos(...) function upon connecting to the server instead.
PHP код:
public OnPlayerConnect(playerid)
{
SetPlayerPos(playerid, X, Y, Z); // enter floats to the X/Y/Z
return 1;
}
Re: Upon server restart -
Jernu - 23.07.2013
Quote:
Originally Posted by Income
It doesn't sets your coordinates to the default 0.0000 etc, it just teleports you to the beach at Los Santos.
0 coords are referring to the middle of the San Andreas map, at Blueberry - next to the farm.
|
Wrong!
It teleports me to Blueberry(Default coords at 0.00000)
Meh, I'll try it.
Re: Upon server restart -
Income - 25.07.2013
Quote:
Originally Posted by Jernu
Wrong!
It teleports me to Blueberry(Default coords at 0.00000)
Meh, I'll try it.
|
That is a fact, how can I be wrong?
In your case, you get teleported to Blueberry somehow.
Re: Upon server restart -
Threshold - 25.07.2013
If you use a saving method for your coordinates upon OnPlayerDisconnect, and the server crashes or restarts, then they're most likely going to save as '0.00' for each coordinate, therefore placing you in your last saved coordinates (0, 0, 0) under OnPlayerSpawn... In this case, you will need to use a timer that gets the player's position every so often, and save that to their file rather than just using OnPlayerDisconnect. If it's not necessary, than I suggest removing it.