SA-MP Forums Archive
How to save a player's score with Y_INI? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to save a player's score with Y_INI? (/showthread.php?tid=353050)



How to save a player's score with Y_INI? - rangerxxll - 22.06.2012

Good evening everyone. I've managed to save everything else, except the score for the player. How could I do this, with Y_INI? Here's my current enum.

pawn Код:
INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Frozen",PlayerInfo[playerid][pFrozen]);
    INI_Int("Mute",PlayerInfo[playerid][pMute]);
    INI_Int("Cookies",PlayerInfo[playerid][pCookies]);
    INI_Int("Vip",PlayerInfo[playerid][pVip]);
    INI_Int("TempVip",PlayerInfo[playerid][pTempVip]);
    INI_Int("Beta",PlayerInfo[playerid][pBeta]);
    INI_Int("Warns",PlayerInfo[playerid][pWarns]);
    INI_Int("Ban",PlayerInfo[playerid][pBan]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
And when a player gets a score, do I need to do like...
pawn Код:
PlayerInfo[playerid][pScore] +=2;
?
Because this is what I have so far.
pawn Код:
SetPlayerScore(playerid,GetPlayerScore(playerid) +5);
        PlayerInfo[playerid][pScore] +=5;
and it doesn't save. And when a player connects/disconnects, I have added this to the code.
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
and on disconnect
pawn Код:
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_Close(File);
What am I doing wrong? Any help is greatly appreciated.


Re: How to save a player's score with Y_INI? - Blunt - 22.06.2012

Add this OnPlayerUpdate

SetPlayerScore(playerid, PlayerInfo[playerid][pScore])


Re: How to save a player's score with Y_INI? - rangerxxll - 22.06.2012

What a simple mistake. Thank you. Would I do the same when I save the player's money as well?