03.10.2013, 23:17
Bom pessoal tentei criar uma include que salva posiзгo do player ao deslogar sу que nгo cria o arquivo.
Код:
new Float:PosX[MAX_PLAYERS], Float:PosY[MAX_PLAYERS], Float:PosZ[MAX_PLAYERS], Float:PosA[MAX_PLAYERS], Float:Interior[MAX_PLAYERS], Float:VW[MAX_PLAYERS]; stock getName(playerid) { new Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, MAX_PLAYER_NAME); return Nome; } stock Spawn(playerid) { static Arquivo[31]; format(Arquivo, sizeof(Arquivo), "Spawn/%s.sav", getName(playerid)); return Arquivo; } stock SalvarSpawn(playerid) { GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]); GetPlayerFacingAngle(playerid, PosA[playerid]); Interior[playerid] = GetPlayerInterior(playerid); VW[playerid] = GetPlayerVirtualWorld(playerid); DOF2_SetFloat(Spawn(playerid), "CoordenadaX", PosX[playerid]); DOF2_SetFloat(Spawn(playerid), "CoordenadaY", PosY[playerid]); DOF2_SetFloat(Spawn(playerid), "CoordenadaZ", PosZ[playerid]); DOF2_SetFloat(Spawn(playerid), "FacingAngle", PosA[playerid]); DOF2_SetFloat(Spawn(playerid), "Interior", Interior[playerid]); DOF2_SetFloat(Spawn(playerid), "VirtualWorld", VW[playerid]); DOF2_SaveFile(); return 1; } stock CarregarSpawn(playerid) { PosX[playerid] = DOF2_GetFloat(Spawn(playerid), "CoordenadaX"); PosY[playerid] = DOF2_GetFloat(Spawn(playerid), "CoordenadaY"); PosZ[playerid] = DOF2_GetFloat(Spawn(playerid), "CoordenadaZ"); PosA[playerid] = DOF2_GetFloat(Spawn(playerid), "FacingAngle"); Interior[playerid] = DOF2_GetFloat(Spawn(playerid), "Interior"); VW[playerid] = DOF2_GetFloat(Spawn(playerid), "VirtualWorld"); if(Interior[playerid] > 0) return SetPlayerInterior(playerid, Interior[playerid]); if(VW[playerid] > 0) return SetPlayerVirtualWorld(playerid, VW[playerid]); SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]); SetPlayerFacingAngle(playerid, PosA[playerid]); return 1; }