y_ini not saving data correctly :/
here is the codes:
the variables are capturing them as well but when player disconnect it's not saving data
a player stats
only registered values save i mean OnPlayerRegister INI_WriteInt(File,"Cash",0);
here is the codes:
Code:
public OnPlayerDisconnect(playerid, reason)
{
new float:x,float:y,float:z;
GetPlayerPos(playerid,x,y,z);
new float:health,float:armour;
GetPlayerHealth(playerid,health);
GetPlayerArmour(playerid,armour);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"BankCash",BankCash[playerid]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Helmets",Helmets[playerid]);
INI_WriteInt(File,"Vests",Vests[playerid]);
INI_WriteInt(File,"Medikits",Medikits[playerid]);
INI_WriteInt(File,"Health",health);
INI_WriteInt(File,"Armour",armour);
INI_WriteInt(File,"Mats",PlayerInfo[playerid][pMats]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob]);
INI_WriteInt(File,"SalaryDate",PlayerInfo[playerid][SalaryDate]);
INI_WriteInt(File,"JobLevel",PlayerInfo[playerid][JobLevel]);
INI_WriteInt(File,"PosX",x);
INI_WriteInt(File,"PosY",y);
INI_WriteInt(File,"PosZ",z);
INI_Close(File);
return 1;
}
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("BankCash",PlayerInfo[playerid][pBankCash]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Helmets",Helmets[playerid]);
INI_Int("Vests",Vests[playerid]);
INI_Int("Medikits",Medikits[playerid]);
INI_Int("Health",PlayerInfo[playerid][pHealth]);
INI_Int("Armour",PlayerInfo[playerid][pArmour]);
INI_Int("Mats",PlayerInfo[playerid][pMats]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Job",PlayerInfo[playerid][pJob]);
INI_Int("SalaryDate",PlayerInfo[playerid][SalaryDate]);
INI_Int("JobLevel",PlayerInfo[playerid][JobLevel]);
INI_Int("PosX",PlayerInfo[playerid][PosX]);
INI_Int("PosY",PlayerInfo[playerid][PosY]);
INI_Int("PosZ",PlayerInfo[playerid][PosZ]);
OldMats[playerid] = PlayerInfo[playerid][pMats];
return 1;
}
a player stats
Code:
[data]
Password = 66912664
Cash = 0
BankCash = 20000
Score = 0
Admin = 0
Kills = 0
Deaths = 0
Helmets = 0
Vests = 0
Medikits = 0
Health = 100
Armour = 0
Mats = 0
Skin = 0
Job = 4
SalaryDate = 0
JobLevel = 0
PosX = 0
PosY = 0
PosZ = 0