SA-MP Forums Archive
Making last position saving script work on playerspawn? - 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: Making last position saving script work on playerspawn? (/showthread.php?tid=306092)



Making last position saving script work on playerspawn? - PlayHard - 25.12.2011

Hello,

I have this script of saving last position:

pawn Код:
new Float:X, Float:Y, Float:Z, Float:A, Float:I, Float:W;
    GetPlayerPos(playerid, X,Y,Z);
    GetPlayerFacingAngle(playerid, A);// I Added this Incase you asked later // A saves Players ANGLE
    I = GetPlayerInterior(playerid);//  This Saves Players Interior
    W = GetPlayerVirtualWorld(playerid); //  This saves Players Virtual World if you plan on using it
    INI_WriteFloat(File,"Health",HEALTH);
    INI_WriteFloat(File,"Armour",ARMOUR);
    INI_WriteFloat(File,"Posx",X);
    INI_WriteFloat(File,"Posy",Y);
    INI_WriteFloat(File,"Posz",Z);
    INI_WriteFloat(File,"Posa",A);
    INI_WriteFloat(File,"Posi",I);
    INI_WriteFloat(File,"Posw",W);
I have it under OnPlayerDisconnect. I want to make like, when a player spawn it reads the file and sets his pos to the last pos!


Re: Making last position saving script work on playerspawn? - Max_Coldheart - 25.12.2011

Just read the pos from the file and set the coordinates to it. I can't tell you the functions as I don't know Y_INI


Re: Making last position saving script work on playerspawn? - Artix - 25.12.2011

Simple
under the
OnPlayerSpawn

Put this

Код:
SetPlayerPos(playerid, PlayerInfo[playerid][posx],PlayerInfo[playerid][posy],PlayerInfo[playerid][posz],PlayerInfo[playerid][posa],PlayerInfo[playerid][posi],PlayerInfo[playerid][posw]);
INI_WriteFloat(File,"Posx",X);
INI_WriteFloat(File,"Posy",Y);
INI_WriteFloat(File,"Posz",Z);
INI_WriteFloat(File,"Posa",A);
INI_WriteFloat(File,"Posi",I);
INI_WriteFloat(File,"Posw",W);


and why you have have such to many float
only need 3

Код:
INI_WriteFloat(File,"Posx",X);
    INI_WriteFloat(File,"Posy",Y);
    INI_WriteFloat(File,"Posz",Z);
if you change your mind use this

Код:
SetPlayerPos(playerid, PlayerInfo[playerid][posx],PlayerInfo[playerid][posy],PlayerInfo[playerid][posz]);



Re: Making last position saving script work on playerspawn? - Artix - 25.12.2011

Quote:

Just read the pos from the file and set the coordinates to it. I can't tell you the functions as I don't know Y_INI

man it's to easy for a beginners like me