SA-MP Forums Archive
Autosave Position Saving - 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: Autosave Position Saving (/showthread.php?tid=315923)



Autosave Position Saving - ~Light~ - 04.02.2012

Hello everyone, I'm new to the forum, and am a newbie in scripting. Alright, I have got an autosave script, but the problem is it doesn't save your position. How can I make it so you could save your position?


Re: Autosave Position Saving - milanosie - 04.02.2012

Make 3 floats

like this:

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
Then just for the saving system x position is x
y is y etc.

what saving system do u use


Re: Autosave Position Saving - ~Light~ - 05.02.2012

Quote:
Originally Posted by milanosie
Посмотреть сообщение
Make 3 floats

like this:

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
Then just for the saving system x position is x
y is y etc.

what saving system do u use
I use a special one, made for the gamemode. It's in another language, the system is similar to SavePlayerData, but it doesn't save position. I tried this system, but I need that for example I am standing near a car, I would quit, the next time I log I would appear right there, near the car that I was standing, or for example I move to a roof, I quit, I appear there, so everytime your position would change, because you move around the map.


Re: Autosave Position Saving - milanosie - 05.02.2012

I know, I am doing it myself.


Re: Autosave Position Saving - ~Light~ - 05.02.2012

Quote:
Originally Posted by milanosie
Посмотреть сообщение
I know, I am doing it myself.
But this script somehow doesn't work :\ I used it in OnPlayerDisconnect


Re: Autosave Position Saving - milanosie - 05.02.2012

dont,
On player discconect it sets its pos to blueberry,
save it in a timer


Re: Autosave Position Saving - ~Light~ - 05.02.2012

Quote:
Originally Posted by milanosie
Посмотреть сообщение
dont,
On player discconect it sets its pos to blueberry,
save it in a timer
Sorry for bothering you, but I don't understand what you mean "in a timer" :\ Can you explain more widely? Thanks for the script tho


Re: Autosave Position Saving - milanosie - 05.02.2012

top of script:

pawn Код:
new savetimer[MAX_PLAYERS];
At, Onplayerspawn
pawn Код:
savetimer[playerid] = SetTimerEx("asave", 10000, true, "i", playerid);
somewhere else:
pawn Код:
forward asave(playerid);
public asave(playerid)
{
//Here the pos saving and everything else u want to save, instead of onplayer disconnect
}
at OnPlayerDisconnect
pawn Код:
killtimer(savetimer[playerid]);