How to save a player's score with Y_INI?
#1

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.
Reply
#2

Add this OnPlayerUpdate

SetPlayerScore(playerid, PlayerInfo[playerid][pScore])
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)