Save and load player's position in/to RAM
#1

Hello everybody.

I wouldn't post here if I haven't tried to make it myself all the whole day and night.
I'm not a scripter but just a man who edits others' scripts using self logic and not a true knowledge.
So my examples can seem awkward to you. Sorry in advance.


I need to get player's position (including facing angle), then series of teleports must pass (it's kinda tutorial in the mod, where a player gets teleported to several locations consequentially and gets tutorial messages on screen while "traveling" across SA), and then, when the tutorial ends, player must teleport back to his previous location.

So I don't need player's coordinates to be stored in file, I need them to be temporarily stored in RAM and then (but not immediately) called back.

My example:

pawn Код:
if(Tut[playerid]==1)
            {
                new Float:xPos, Float:yPos, Float:zPos, Float:Angle;
                GetPlayerPos(playerid,xPos,yPos,zPos);
                GetPlayerFacingAngle(playerid,Angle);
                if(TutTime[playerid]==0)
                {
                    SetPlayerInterior(playerid,0);
                    SetPlayerPos(playerid,55.55,55.55,55.55);
                    SetPlayerCameraPos(playerid,66.66,66.66,66);
                    SetPlayerCameraLookAt(playerid,-99.9877,-5678.1234,2.0367);
                    ShowPlayerDialog(playerid,59,DIALOG_STYLE_MSGBOX,"Tutorial","My message","OK","");
                }
                if(TutTime[playerid]==15)
                {
                    SetPlayerPos(playerid,66.66,66.66,66.66);
                    SetPlayerCameraPos(playerid,77.77,77.77,77);
                    SetPlayerCameraLookAt(playerid,-99.9877,-5678.1234,2.0367);
                    ShowPlayerDialog(playerid,61,DIALOG_STYLE_MSGBOX,"Tutorial","My message","OK","");
                }
                if(TutTime[playerid]==25)
                {
                    SetPlayerPos(playerid,77.77,77.77,77.77);
                    SetPlayerCameraPos(playerid,88.88,88.88,88);
                    SetPlayerCameraLookAt(playerid,-99.9877,-5678.1234,2.0367);
                    ShowPlayerDialog(playerid,62,DIALOG_STYLE_MSGBOX,"Tutorial","My message","OK","");
                }
                if(TutTime[playerid]==60)
                {
                    Tut[playerid]=0;
                    SetPlayerPos(playerid,xPos,yPos,zPos);
                    SetPlayerFacingAngle(playerid,Angle);
                     
                }

            }
(all coordinates here are only for example purposes)

But with this kind of code player does not get teleported back to his previous location... Instead he remains in the tutorial area with the adjusted camera and everything... So I suppose that GetPlayerPos does not remember that location but switches to the new location every time, so when SetPlayerPos(playerid,xPos,yPos,zPos) is applying, the coordiantes are already new, not old.


I don't know how to make SA-MP teleport player back in this situation.

Many thanks in advance for the help, it would be greatly appreciated.



Solution found: http://forum.sa-mp.com/showpost.php?...0&postcount=16
Reply


Messages In This Thread
SavePlayerPos, then load this pos after a while, but not from file - by WellDone - 17.01.2013, 23:15
Re: Save and load player's position in/to RAM - by u3ber - 17.01.2013, 23:25
Re: Save and load player's position in/to RAM - by WellDone - 18.01.2013, 08:23
Re: Save and load player's position in/to RAM - by InfiniTy. - 18.01.2013, 08:29
Re: Save and load player's position in/to RAM - by WellDone - 18.01.2013, 08:46
Re: Save and load player's position in/to RAM - by InfiniTy. - 18.01.2013, 08:54
Re: Save and load player's position in/to RAM - by Jakku - 18.01.2013, 09:02
Re: Save and load player's position in/to RAM - by WellDone - 18.01.2013, 09:11
Re: Save and load player's position in/to RAM - by WellDone - 18.01.2013, 14:24
Re: Save and load player's position in/to RAM - by WellDone - 19.01.2013, 07:37

Forum Jump:


Users browsing this thread: 1 Guest(s)