YINI player stats doesn't save correctly
#1

When I have an updated stats now and then I re joined turns out that I don't have the updated stats I have the normal one.

Codes:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new pName2[24];
    new str[128];
    GetPlayerName(playerid, pName2, 24);

    switch(reason)
        {
            case 0: format(str, 128, "%s (%d) Has Left The Server. (Timeout/Crashed)", pName2,playerid);
            case 1: format(str, 128, "%s (%d) Has Left The Server. (Leaving)", pName2,playerid);
            case 2: format(str, 128, "%s (%d) Has Left The Server. (Kicked/Banned)", pName2,playerid);
        }
    SendClientMessageToAll(0xAFAFAFAA, str);
    if(fexist(UserPath(playerid)))
    {
    if(Info[playerid][Logged] == 1)
    {
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(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,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Drugs",LPinfo[playerid][Drugs]);
    INI_WriteInt(File,"Adrenaline",LPinfo[playerid][Adre]);
    INI_WriteInt(File,"Registered",1);
    INI_WriteInt(File,"Logged",0);
    INI_WriteInt(File,"VIPLevel",Info[playerid][VIPLevel]);
    INI_WriteInt(File,"FavouriteSkin",Info[playerid][Favouriteskin]);
    INI_WriteInt(File,"FavouriteSong",Favouritesong[playerid]);
    INI_WriteInt(File,"BankMoney",BankMoney[playerid]);
    INI_WriteInt(File,"Daysalive",Daysalive[playerid]);
    INI_WriteInt(File,"Banned",Info[playerid][Banned]);
    INI_WriteInt(File,"MissionsCompleted",Info[playerid][MissionsCompleted]);
    INI_WriteInt(File,"MissionsFailed",Info[playerid][MissionsFailed]);
    INI_WriteInt(File,"Robbed",Info[playerid][Robbed]);
    INI_WriteInt(File,"MaximumRobbed",Info[playerid][MaximumRobbed]);
    INI_WriteInt(File,"Muted",Info[playerid][Muted]);
    INI_WriteInt(File,"Jailed",Info[playerid][Jailed]);
    INI_WriteInt(File,"MuteWarnings",Info[playerid][MuteWarnings]);
    INI_WriteInt(File,"MaxMuteWarnings",Info[playerid][MaxMuteWarnings]);
    INI_WriteInt(File,"Warnings",Info[playerid][Warnings]);
    INI_WriteInt(File,"TimesKicked",Info[playerid][TimesKicked]);
    INI_WriteInt(File,"EventsWon",Info[playerid][EventsWon]);
    INI_WriteInt(File,"EventsLost",Info[playerid][EventsLost]);
    INI_WriteInt(File,"StartingMusic",Info[playerid][StartingMusic]);
    INI_Close(File);
    }
    }
    return 1;
}
Reply
#2

Put under OnPlayerConnect
Before loadplayerdata

PlayerInfo[playerid][pPass] = 0;
PlayerInfo[playerid][pCash] = 0;
PlayerInfo[playerid][pAdmin] = 0;
and etc players info ...
Reply
#3

already
Reply
#4

CHeck when player logged in value = 1 or not
(Info[playerid][Logged] == 1)
Reply
#5

I know this won't fix your problem, but shouldn't this be INIWriteString?
Код:
INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]); ---> INI_WriteString(File,"Password",PlayerInfo[playerid][pPass], 129); // I suppose you use whirlpool for hashing
Reply
#6

both works but i want a damn fix in this damn problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)