Em alguns momentos quando reinicio meu servidor, algum player acaba voltando com sua conta tendo o dinheiro, level, cargo, emprego e skins deletadas. Estou utilizando DOF2 para realizar o salvamento, mas simplesmente não consigo encontrar o que pode estar causando isso (Obs.: a parte de salvamento foi feita por um colega da equipe que também codifica na GM). De começo eu notei que estava faltando a função DOF2_SaveFile() ao final da SaveAccount(playerid), mas mesmo após a inserir, continua acontecendo o mesmo problema. Não é sempre que acontece, geralmente é quando eu reinicio o servidor várias vezes enquanto estou adicionando novas funcionalidades, daí em uma delas, ao voltar para o game ele acaba dando uma mensagem de crash ou fechando do nada, e quando volto estou setado com a skin do CJ e caindo no limbo. Se alguém puder me ajudar com isso, ficarei grato! Caso precisem de mais informações, basta me perguntar.
SaveAccount:
OnPlayerDisconnect:
Caso sirva de algo, aqui está a mensagem de crash:
SaveAccount:
Código PHP:
stock SaveAccount(playerid) {
format(File, sizeof(File), PASTA_CONTAS, GetPlayerNameEx(playerid));
DOF2_SetInt(File, "Level", PlayerInfo[playerid][pLevel]);
DOF2_SetInt(File, "EXP", PlayerInfo[playerid][pExp]);
DOF2_SetInt(File, "Admin", PlayerInfo[playerid][pAdmin]);
DOF2_SetInt(File, "Dinheiro", PlayerInfo[playerid][pGrana]);
DOF2_SetInt(File, "Skin", PlayerInfo[playerid][pSkin]);
DOF2_SetInt(File, "Sexo", PlayerInfo[playerid][pSexo]);
DOF2_SetInt(File, "Fome", PlayerInfo[playerid][pFome]);
DOF2_SetInt(File, "Sede", PlayerInfo[playerid][pSede]);
DOF2_SetInt(File, "Sono", PlayerInfo[playerid][pSono]);
DOF2_SetInt(File, "Emprego", PlayerInfo[playerid][pEmprego]);
DOF2_SetInt(File, "CategoriaEmprego", PlayerInfo[playerid][pEmpregoCategoria]);
DOF2_SetInt(File, "NivelProcurado", PlayerInfo[playerid][pWantedLevel]);
DOF2_SetInt(File, "TempoPreso", PlayerInfo[playerid][pTempoPreso]);
DOF2_SetBool(File, "Preso", PlayerInfo[playerid][pPreso]);
DOF2_SetBool(File, "Mutado", PlayerInfo[playerid][pMutado]);
DOF2_SetInt(File, "TempoMutado", PlayerInfo[playerid][pTempoMutado]);
DOF2_SetBool(File, "Contrato", PlayerInfo[playerid][pContrato]);
DOF2_SetInt(File, "ValorContrato", PlayerInfo[playerid][pValorContrato]);
DOF2_SetInt(File, "Organizacao", PlayerInfo[playerid][pOrganizacao]);
DOF2_SetInt(File, "Cargo", PlayerInfo[playerid][pCargo]);
new day, month, year;
getdate(year, month, day);
format(STRX, 128, "%02d/%02d/%04d", day, month, year);
DOF2_SetString(File, "UltimoLogin", STRX);
new Float:X, Float:Y, Float:Z, intid;
GetPlayerPos(playerid, X, Y, Z);
intid = GetPlayerInterior(playerid);
PlayerInfo[playerid][pPosX] = X;
PlayerInfo[playerid][pPosY] = Y;
PlayerInfo[playerid][pPosZ] = Z;
PlayerInfo[playerid][pInterior] = intid;
DOF2_SetFloat(File, "PosX", PlayerInfo[playerid][pPosX]);
DOF2_SetFloat(File, "PosY", PlayerInfo[playerid][pPosY]);
DOF2_SetFloat(File, "PosZ", PlayerInfo[playerid][pPosZ]);
DOF2_SetInt(File, "Interior", PlayerInfo[playerid][pInterior]);
DOF2_SaveFile();
return 1;
}
OnPlayerDisconnect:
Código PHP:
public OnPlayerDisconnect(playerid, reason) {
SaveAccount(playerid);
if(GetPVarInt(playerid, "Fardado")) {
DeletePVar(playerid, "Fardado");
SetPlayerSkin(playerid, GetPVarInt(playerid, "PreviousSkin"));
DeletePVar(playerid, "PreviousSkin");
}
if(GetPVarInt(playerid, "Alugou")) {
DestroyVehicle(GetPVarInt(playerid, "AlugadoID"));
DestroyDynamic3DTextLabel(TrashTruckInfo[GetPVarInt(playerid, "AlugadoID")][tLabel]);
TrashTruckInfo[GetPVarInt(playerid, "AlugadoID")][tLabel] = Text3D:INVALID_3DTEXT_ID;
DeletePVar(playerid, "AlugadoID");
DeletePVar(playerid, "Alugou");
}
if(GetPVarInt(playerid, "criouv")) {
DeletePVar(playerid, "criouv");
if(GetPVarInt(playerid, "cvehid") != INVALID_VEHICLE_ID) DestroyVehicle(GetPVarInt(playerid, "cvehid"));
DeletePVar(playerid, "cvehid");
}
if(PlayerInfo[playerid][pPreso]) {
DOF2_SetInt(FormatAccFile(playerid), "TempoPreso", PlayerInfo[playerid][pTempoPreso]);
KillTimer(TimerPrisao[playerid]);
}
// Timers
KillTimer(ClockTimer[playerid]);
KillTimer(TimerHunger[playerid]);
KillTimer(TimerSono[playerid]);
KillTimer(TimerSede[playerid]);
KillTimer(TimerCar[playerid]);
KillTimer(TimerExpirarLogin[playerid]);
KillTimer(TimerAbastecer[playerid]);
KillTimer(TimerProcurado[playerid]);
DeletePVar(playerid, "Abastecendo");
HideGlobalGasolinaText(playerid);
HidePlayerGasolinaText(playerid);
if(HotelInfo[playerid][hInHotel]) {
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 332.0835,-1515.6294,35.8672);
SetPlayerVirtualWorld(playerid, 0);
HotelInfo[playerid][hInHotel] = false;
HotelInfo[playerid][hVWorld] = 0;
}
// Reset
PlayerInfo[playerid][pRcon] = false;
PlayerInfo[playerid][pAFK] = false;
if(GetPVarInt(playerid, "Algemado")) {
SendClientMessageToAllEx(Verde, "| INFO | %s saiu algemado e portanto foi punido automaticamente", GetPlayerNameEx(playerid));
GivePlayerWanted(playerid, GetPlayerWanted(playerid) * 2);
GivePlayerLevel(playerid, -3);
GivePlayerCash(playerid, -15000);
}
if(PlayerInfo[playerid][pPegouEmprego]) {
RemovePlayerMapIcon(playerid, 1);
PlayerInfo[playerid][pPegouEmprego] = false;
DeletePVar(playerid, "EmpregoID");
}
if (GetPVarInt(playerid, "Called")) {
CallStarted[playerid] = false;
InCall[playerid] = false;
DeletePVar(playerid, "Called");
}
return 1;
}
Caso sirva de algo, aqui está a mensagem de crash:
Código:
SA-MP 0.3.7-R5
Exception At Address: 0x0460D9D1
Base: 0x04570000
Registers:
EAX: 0x00000045 EBX: 0xFFFFFFFF ECX: 0x00000040 EDX: 0x00619000
ESI: 0x49F764FF EDI: 0x00000003 EBP: 0x0177F688 ESP: 0x0177F618
EFLAGS: 0x00010206
Stack:
+0000: 0x0421EB08 0x007F99B0 0x045E4836 0x007F99B0
+0010: 0x007F99C7 0x041312C0 0x007FB1C3 0x0421EB08
+0020: 0x00060E7E 0x00000000 0x01974178 0x041BE8B4
+0030: 0x007EE388 0x0421EB08 0x00060E7E 0x00000000
+0040: 0x0177F708 0x0074526A 0x041BE8B4 0x00060E7E
+0050: 0x00000000 0x0053EC06 0x041BE8B4 0x041BE8B4
+0060: 0x44700000 0x44070000 0x5F82FC50 0x00000001
+0070: 0x0177F6D0 0x5F82B8E9 0x0177F6DC 0x0198D120
+0080: 0x5F888A9C 0x01974178 0x00060E7E 0x00000000
+0090: 0x0177F6C0 0x7548E74B 0x00000113 0x00000001
+00A0: 0x00000000 0x0177F698 0x0177F698 0x0177F6F4
+00B0: 0x5F883B40 0x00000001 0x0177F6E4 0x5F82FC02
+00C0: 0x0198D134 0x00000001 0x0177F888 0x0177F700
+00D0: 0x5F82E267 0x0177F708 0x0177F888 0x0177F868
+00E0: 0x5F883B58 0x00000000 0x0177F874 0x5F830246
+00F0: 0x5F8889A4 0x01974178 0x00060E7E 0xDCBAABCD
+0100: 0x00000000 0x0177F868 0x5F883D85 0xFFFFFFFF
+0110: 0x0177F874 0x00000000 0x0177F888 0x0000001A
+0120: 0x00000001 0x00000000 0x00000000 0x003B7000
+0130: 0x00000001 0xA8A5E770 0x00000000 0x77698850
+0140: 0x00000001 0x00000000 0x00000000 0x00000070
+0150: 0x00000000 0x00760994 0x00000000 0x0177F74C
+0160: 0x02262DD0 0x0177F7D8 0x75475A70 0xDC9FFB14
+0170: 0xFFFFFFFE 0x0177F7C8 0x7546D6DF 0x0233F9F0
+0180: 0x776767AC 0x7546D6F7 0x0177F7B0 0x00000018
+0190: 0x00000000 0x0177F8F8 0x00000000 0x00000000
+01A0: 0x00000000 0x00000000 0x00000000 0x00000000
+01B0: 0x0177F850 0x77678D6D 0x0177F7E4 0x00000020
+01C0: 0x0177F980 0x7FFE8000 0x0000AA64 0x77661532
+01D0: 0x0177F840 0x0177F844 0x00000000 0xFFFFFFFF
+01E0: 0x72D5AE20 0x77698850 0x00000000 0x7546C70F
+01F0: 0x0177F8F8 0x00000000 0x00000000 0x00000000
+0200: 0x6576CE2C 0x0177F894 0x77661220 0xFFFFFFFF
+0210: 0x0177F844 0x7766133A 0x5F8889A4 0x01974178
+0220: 0x00000000 0x00000001 0xA8A58664 0x0000014C
+0230: 0x9FBFDFA1 0x00B1750F 0x00192FD4 0x00000000
+0240: 0x01974178 0x01973930 0x7FFE8000 0x546C6148
+0250: 0x0177F980 0x5F883CEC 0x00000000 0x0177F880
+0260: 0x5F83013C 0x0177F888 0x754D78F0 0x0053ECC2
+0270: 0x00000001 0x00619B71 0x0000001A 0x00000001
SCM Op: 0x248, lDbg: 0 LastRendObj: 3276
Game Version: US 1.0
State Information: Ped Context: 0