new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]); INI_WriteInt(File,"Score",GetPlayerScore(playerid)); INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]); INI_WriteInt(File,"Mute",PlayerInfo[playerid][pMuted]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_WriteInt(File,"SRank",PlayerInfo[playerid][pSRank]); INI_WriteInt(File,"Captures",PlayerInfo[playerid][pCarsCaptured]); INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]); INI_Close(File);
Are you resetting the values of the enumerated variables when the player disconnects? Otherwise if for example ID 0 joins and logs in and is a level 10 administrator, it will set the value in cell 0 of the array to 10. Then if that person leaves and you do not set the value of the cell 0 back to 0, the next person who connects with ID 0 will inherit that value.
|
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Mute",PlayerInfo[playerid][pMuted]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"SRank",PlayerInfo[playerid][pSRank]);
INI_WriteInt(File,"Captures",PlayerInfo[playerid][pCarsCaptured]);
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
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("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Vip",PlayerInfo[playerid][pVip]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Mute",PlayerInfo[playerid][pMuted]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("SRank",PlayerInfo[playerid][pSRank]);
INI_Int("Captures",PlayerInfo[playerid][pCarsCaptured]);
INI_Int("Cookies",PlayerInfo[playerid][pCookies]);
return 1;
}
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Mute",PlayerInfo[playerid][pMuted]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"SRank",PlayerInfo[playerid][pSRank]);
INI_WriteInt(File,"Captures",PlayerInfo[playerid][pCarsCaptured]);
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
return 1;
}
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pVip] = 0;
PlayerInfo[playerid][pCookies] = 0;
PlayerInfo[playerid][pScore] = 0;
PlayerInfo[playerid][pCash] = 0;
PlayerInfo[playerid][pSkin] = 0;
PlayerInfo[playerid][pMuted] = 0;
PlayerInfo[playerid][pDeaths] = 0;
PlayerInfo[playerid][pSRank] = 0;
PlayerInfo[playerid][pCarsCaptured] = 0;