public OnPlayerDisconnect(playerid, reason)
{
new file[200]; // We declare the size of the file
GetPlayerName(playerid,file,sizeof(file)); // We get the file name
format(file,sizeof(file),DOF2_File(file));// We get the user path from DOF2_File (folder Users)
DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills]); // We set/update the players settings.
DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths]);
DOF2_SetInt(file, "Money",PlayerInfo[playerid][pMoney]);
DOF2_SetInt(file, "Score",PlayerInfo[playerid][pScore]);
DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin]);
DOF2_SetInt(file, "IP",PlayerInfo[playerid][pIP]);
DOF2_SetInt(file, "Hours",PlayerInfo[playerid][pHours]);
DOF2_SetInt(file, "Kidnaper",PlayerInfo[playerid][pKidnaper]);
DOF2_SetInt(file, "Hitman",PlayerInfo[playerid][pHitman]);
DOF2_SetInt(file, "Medic",PlayerInfo[playerid][pMedic]);
DOF2_SetInt(file, "GrabageMan",PlayerInfo[playerid][pGrabage]);
DOF2_SetInt(file, "ConArtist",PlayerInfo[playerid][pConArtist]);
DOF2_SetInt(file, "Mechanie",PlayerInfo[playerid][pMechanie]);
DOF2_SaveFile(); // Saves the file.
Why you need to save this under disconnect? if there will be a server crash? you should save it instantly when you make changes to your player files folder
|
lol R u really crazy if he didnt save the player's stats OnPlayerDisconnect...player's data will lose
|
I want same but why the score & money dose not saved? can u help me w
|
DOF2_SetInt(file, "Money",GetPlayerMoney(playerid));
DOF2_SetInt(file, "Score",GetPlayerScore(playerid));
PlayerInfo[playerid][pMoney] += sum;
SetPlayerMoney(playerid, PlayerInfo[playerid][pMoney]);