Saving spawn pos
#1

Okay so I have my enum all that etc.. Everything works fine compiles and everything. But how do I have it so it saves my position when I log off and puts it into my .ini file? I have
Код:
    INI_WriteInt(File,"PosX",PlayerInfo[playerid][pPosX]);
    INI_WriteInt(File,"PosY",PlayerInfo[playerid][pPosY]);
    INI_WriteInt(File,"PosZ",PlayerInfo[playerid][pPosZ]);
    INI_WriteInt(File,"RotX",PlayerInfo[playerid][pRotX]);
    INI_WriteInt(File,"RotY",PlayerInfo[playerid][pRotY]);
    INI_WriteInt(File,"RotZ",PlayerInfo[playerid][pRotZ]);
in my OnPlayerDisconnect callback but how do I get it so it reads my position and rotation of where I am and puts it into those categories? Sorry if I making it hard to understand but could you please help?
Reply
#2

pawn Код:
new Float:PosX, Float:PosY, Float:PosZ;
GetPlayerPos(playerid, PosX, PosY, PosZ);
If this is what your looking for, here ya go, if not, PM me
Reply
#3

It is what I am looking for just, I want to connect it to my enum for my .ini file so it reads it..
Reply
#4

I will also help you with this on TV
Reply
#5

pawn Код:
new
    Float: P[ 3 ]
;
GetPlayerPos( playerid, P[ 0 ], P[ 1 ], P[ 2 ] );

INI_WriteInt( File,"PosX", P[ 0 ] );
INI_WriteInt( File,"PosX", P[ 1 ] );
INI_WriteInt( File,"PosX", P[ 2 ] );
Reply
#6

Quote:
Originally Posted by SmiT
Посмотреть сообщение
pawn Код:
new
    Float: P[ 3 ]
;
GetPlayerPos( playerid, P[ 0 ], P[ 1 ], P[ 2 ] );

INI_WriteInt( File,"PosX", P[ 0 ] );
INI_WriteInt( File,"PosX", P[ 1 ] );
INI_WriteInt( File,"PosX", P[ 2 ] );
Код:
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(500) : warning 213: tag mismatch
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(501) : warning 213: tag mismatch
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(502) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
500 INI_WriteInt( File,"PosX", P[ 0 ] );
501 INI_WriteInt( File,"PosX", P[ 1 ] );
502 INI_WriteInt( File,"PosX", P[ 2 ] );
Reply
#7

My bad, it should be "INI_WriteFloat" -

pawn Код:
INI_WriteFloat( File,"PosX", P[ 0 ] );
INI_WriteFloat( File,"PosX", P[ 1 ] );
INI_WriteFloat( File,"PosX", P[ 2 ] );
Reply
#8

Quote:
Originally Posted by SmiT
Посмотреть сообщение
My bad, it should be "INI_WriteFloat" -

pawn Код:
INI_WriteFloat( File,"PosX", P[ 0 ] );
INI_WriteFloat( File,"PosX", P[ 1 ] );
INI_WriteFloat( File,"PosX", P[ 2 ] );
That code writes to "PosX" for all 3 co-ordinates?

You'll also need:
pawn Код:
new Float:rot;
GetPlayerFacingAngle(playerid, rot);
INI_WriteFloat(File, "PosRot", rot);
for the player's rotation/facing angle.

or, an addition to SmiT's code: (with fixed tag names)
pawn Код:
new
    Float: P[4]
;
GetPlayerPos(playerid, P[0], P[1], P[2]);
GetPlayerFacingAngle(playerid, P[3]);

INI_WriteFloat(File,"PosX", P[0]);
INI_WriteFloat(File,"PosY", P[1]);
INI_WriteFloat(File,"PosZ", P[2]);
INI_WriteFloat(FIle, "PosRot", P[3]
Reply
#9

THANKYOU!
Reply
#10

No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)