08.10.2014, 17:15
I'm having a problem with the SII system(my preferable ini system) with saving data onto the file, I found this issue whilst testing a gamemode, the script says it should save all the data as normal but it doesn't save at all,
Example:
My player has the ryder skin(ID:271) and when I disconnect and then open up the player file it says its still ID: 0(the default skin id for the player data).
After registering, and then logging in(with the correct password), then selecting the skin, it would transfer back to the mansion with the skin you selected(assigned to PlayerInfo[playerid][pSkin] with the ID also) but then when you disconnect it reads on the file:
Heres my disonnect code: (Ignore indentation as its copied and pasted, focus on the INI codes)
Heres my dialog response codes from login and register(Ignore indentation again, focus on the INI codes):
If anyone can help with this or had previous issues like this and resolved it, please help me here. I would greatly appreciate it.
Example:
My player has the ryder skin(ID:271) and when I disconnect and then open up the player file it says its still ID: 0(the default skin id for the player data).
After registering, and then logging in(with the correct password), then selecting the skin, it would transfer back to the mansion with the skin you selected(assigned to PlayerInfo[playerid][pSkin] with the ID also) but then when you disconnect it reads on the file:
Code:
Password=******(obviously not going to write my password here lul) Score=0 Cash=0 Admin=0 Skin=0 SkinChanges=0 Spawned=0
Code:
public OnPlayerDisconnect(playerid, reason) { if(INI_Open(GetINI(playerid))) { INI_WriteInt("Score",PlayerInfo[playerid][pScore]); INI_WriteInt("Cash",GetPlayerMoney(playerid)); INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt("Skin",PlayerInfo[playerid][pSkin]); INI_WriteInt("SkinChanges",PlayerInfo[playerid][pSkinChanges]); INI_WriteInt("Spawned",0); INI_Close(); } return 1; }
Code:
case DIALOG_REGISTER: { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) { SendClientMessage(playerid,COLOR_GREY,#Invalid registeration password.); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"User account registration","Type in a password combination in order \nto registrate your new account.","Register","Leave"); } if(INI_Open(GetINI(playerid))) { INI_WriteString("Password",inputtext); INI_WriteInt("Score",0); INI_WriteInt("Cash",0); INI_WriteInt("Admin",0); INI_WriteInt("Skin",0); INI_WriteInt("SkinChanges",0); INI_WriteInt("Spawned",0); INI_Save(); INI_Close(); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave"); } } } case DIALOG_LOGIN: { if(!response) return Kick (playerid); if(response) { if(!strlen(inputtext)) { SendClientMessage(playerid,COLOR_GREY,#Invalid password combination); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave"); return 1; } if(INI_Open(GetINI(playerid))) { INI_ReadString(PlayerInfo[playerid][pPass],"Password",20); } if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) { SendClientMessage(playerid,COLOR_GREY,#Invalid password combination); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave"); return 1; } SetPlayerScore(playerid,INI_ReadInt("Score")); ResetPlayerMoney(playerid); GivePlayerMoney(playerid,INI_ReadInt("Cash")); PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin"); PlayerInfo[playerid][pSkin] = INI_ReadInt("Skin"); PlayerInfo[playerid][pSkinChanges] = INI_ReadInt("SkinChanges"); PlayerInfo[playerid][pSpawned] = INI_ReadInt("Spawned"); INI_Close(); SetPlayerInterior(playerid,5); SendClientMessage(playerid,COLOR_WHITE,"You have been successfully logged in to your user account."); TogglePlayerSpectating(playerid,false); SpawnPlayer(playerid); } }