Making last position saving script work on playerspawn?
#1

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!
Reply
#2

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
Reply
#3

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]);
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)