Here is my SaveUser code:
when data saved it send client message to player "Data saved!"
but when i updated the script it showing Unknown command and also not saving data
full code(included : command,disconnect,loaduser,saveuser):
Code:
forward SaveUser(playerid);
public SaveUser(playerid)
{
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,"Job",PlayerJob[playerid]);
INI_WriteFloat(File,"Health",health,2);
INI_WriteFloat(File,"Armour",armour,2);
INI_WriteInt(File,"Mats",PlayerInfo[playerid][pMats]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"SalaryDate",SalaryDate[playerid]);
INI_WriteInt(File,"JobLevel",PlayerInfo[playerid][JobLevel]);
INI_WriteFloat(File,"PosX",x);
INI_WriteFloat(File,"PosY",y);
INI_WriteFloat(File,"PosZ",z);
INI_Close(File);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Data saved!");
return 1;
}
but when i updated the script it showing Unknown command and also not saving data
full code(included : command,disconnect,loaduser,saveuser):
Code:
public OnPlayerDisconnect(playerid, reason)
{
SaveUser(playerid);
return 1;
}
CMD:savedata(playerid, params[])
{
SaveUser(playerid);
return 1;
}
forward SaveUser(playerid);
public SaveUser(playerid)
{
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,"Job",PlayerJob[playerid]);
INI_WriteFloat(File,"Health",health,2);
INI_WriteFloat(File,"Armour",armour,2);
INI_WriteInt(File,"Mats",PlayerInfo[playerid][pMats]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"SalaryDate",SalaryDate[playerid]);
INI_WriteInt(File,"JobLevel",PlayerInfo[playerid][JobLevel]);
INI_WriteFloat(File,"PosX",x);
INI_WriteFloat(File,"PosY",y);
INI_WriteFloat(File,"PosZ",z);
INI_Close(File);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Data saved!");
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("Job",PlayerJob[playerid]);
INI_Float("Health",PlayerInfo[playerid][pHealth]);
INI_Float("Armour",PlayerInfo[playerid][pArmour]);
INI_Int("Mats",PlayerInfo[playerid][pMats]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("SalaryDate",SalaryDate[playerid]);
INI_Int("JobLevel",PlayerInfo[playerid][JobLevel]);
INI_Float("PosX",PlayerInfo[playerid][PosX]);
INI_Float("PosY",PlayerInfo[playerid][PosY]);
INI_Float("PosZ",PlayerInfo[playerid][PosZ]);
OldMats[playerid] = PlayerInfo[playerid][pMats];
return 1;
}