30.03.2013, 15:01
Hmm take a look at this.
Just make sure you make it that it will write the play pos on register.
Command example
Код:
enum pInfo { Float:pPosX, Float:pPosY, Float:pPosZ, Float:pPosA, pInterior, pVw } new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
forward loadaccount_user(playerid, name[], value[]); public loadaccount_user(playerid, name[], value[]) { INI_Float("PositionX", PlayerInfo[playerid][pPosX]); INI_Float("PositionY", PlayerInfo[playerid][pPosY]); INI_Float("PositionZ", PlayerInfo[playerid][pPosZ]); INI_Float("Angle", PlayerInfo[playerid][pPosA]); INI_Int("Interior", PlayerInfo[playerid][pInterior]); INI_Int("VirtualWorld", PlayerInfo[playerid][pVw]); return 1; } public OnPlayerDisconnect(playerid, reason) { GetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]); GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPosA]); if(fexist(Path(playerid))) { new INI:file = INI_Open(Path(playerid)); INI_SetTag(file,"Player's Data"); INI_WriteFloat(file,"PositionX", PlayerInfo[playerid][pPosX]); INI_WriteFloat(file,"PositionY", PlayerInfo[playerid][pPosY]); INI_WriteFloat(file,"PositionZ", PlayerInfo[playerid][pPosZ]); INI_WriteFloat(file,"Angle", PlayerInfo[playerid][pPosA]); INI_WriteInt(file,"Interior", GetPlayerInterior(playerid)); INI_WriteInt(file,"VirtualWorld", GetPlayerVirtualWorld(playerid)); return 1; } public OnPlayerSpawn(playerid) { if (PlayerInfo[playerid][pPosX] != 0 && PlayerInfo[playerid][pPosY] != 0 && PlayerInfo[playerid][pPosZ] != 0) { SetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]); SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPosA]); SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]); SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVw]); return 1; } else { //Set normal pos here if they dont have acc } return 1; }
Код:
INI_WriteFloat(file,"PositionX", 0); INI_WriteFloat(file,"PositionY", 0); INI_WriteFloat(file,"PositionZ", 0); INI_WriteFloat(file,"Angle", 0); INI_WriteInt(file,"Interior", 0); INI_WriteInt(file,"VirtualWorld", 0);
Код:
CMD:gotpos(playerid, params[]) { if (PlayerInfo[playerid][pPosX] != 0 && PlayerInfo[playerid][pPosY] != 0 && PlayerInfo[playerid][pPosZ] != 0) { SetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]); SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPosA]); SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]); SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVw]); } } CMD:savepos(playerid, params[]) { new INI:file = INI_Open(Path(playerid)); INI_SetTag(file,"Player's Data"); INI_WriteFloat(file,"PositionX", PlayerInfo[playerid][pPosX]); INI_WriteFloat(file,"PositionY", PlayerInfo[playerid][pPosY]); INI_WriteFloat(file,"PositionZ", PlayerInfo[playerid][pPosZ]); INI_WriteFloat(file,"Angle", PlayerInfo[playerid][pPosA]); INI_WriteInt(file,"Interior", GetPlayerInterior(playerid)); INI_WriteInt(file,"VirtualWorld", GetPlayerVirtualWorld(playerid)); return 1; }