i use y_ini but my stats are lost some time when we join they are set to 0 all stats go reset just the password doesn't change
i think my auto save feature for the player is causing it it saves after every 4 mins so can you tell how to make an better one
Код:
public AUTO_SAVE(playerid)
{
if(playerid == INVALID_PLAYER_ID || !IsPlayerConnected(playerid)) return SCM(playerid, -1,"");
new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
GetPlayerName(playerid,name,sizeof(name)); //Get player's name
//new pname = strtolower(name);
new INI:file = INI_Open(Path(playerid)); //will open their file
INI_SetTag(file,"Players_Data");//We will set a tag inside of user's account called "Players_Data"
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
INI_WriteInt(file,"Pills",pInfo[playerid][Pills]);
INI_WriteInt(file,"Savedskin",pInfo[playerid][Savedskin]);
INI_WriteInt(file,"Last",pInfo[playerid][Last]);
INI_WriteInt(file,"NoPM",pInfo[playerid][NoPM]);
INI_WriteInt(file,"Drugs",pInfo[playerid][Drugs]);
INI_WriteInt(file,"belt",pInfo[playerid][belt]);
INI_WriteInt(file,"Jailed",pInfo[playerid][Jailed]);
INI_WriteInt(file,"ad",pInfo[playerid][ad]);
INI_WriteInt(file,"raped",pInfo[playerid][raped]);
INI_WriteInt(file,"gotraped",pInfo[playerid][gotraped]);
INI_WriteInt(file,"rape_kills",pInfo[playerid][rape_kills]);
INI_WriteInt(file,"rape_deaths",pInfo[playerid][rape_deaths]);
INI_WriteInt(file,"flash",pInfo[playerid][flash]);
INI_WriteInt(file,"flash_kills",pInfo[playerid][flash_kills]);
INI_WriteInt(file,"flash_deaths",pInfo[playerid][flash_deaths]);
INI_WriteInt(file,"foff_kills",pInfo[playerid][foff_kills]);
INI_WriteInt(file,"foff_deaths",pInfo[playerid][foff_deaths]);
INI_WriteInt(file,"Weapons_kit",pInfo[playerid][Weapons_kit]);
INI_WriteInt(file,"fighting",pInfo[playerid][fighting]);
INI_WriteInt(file,"MoneyBag_Founded",pInfo[playerid][MoneyBag_Founded]);
INI_Close(file);//Now after we've done saving their data, we now need to close the file
//SCM(playerid, COLOR_WHITE, "Your {00B9FF}Stats {FFFFFF}Have Been Automatically {FF0015}Saved.");
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,24);
new str[120];
//format(str,sizeof(str),"<AUTO - SAVED> Stats for account: %s(%d) has been saved automatically.", playername, playerid);
print(str);
return 1;
}
and when player disconnects check if he is logged in or not if he isn't do not save stats
okay i never killed the time so now i kill it when player leave and made the variable too