SA-MP Forums Archive
YINI problem | Reseting account on login - 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: YINI problem | Reseting account on login (/showthread.php?tid=288303)



YINI problem | Reseting account on login - OUL - 07.10.2011

When i click on 'login' button ALL my stats in account file reset on 0 float stats on 0.00000 JUST password hash stay... I don't understand why....

pawn Код:
INI_ParseFile(Data, "LoadUser", .bExtra = true, .extra = playerid);

forward LoadUser(playerid,name[],value[]);
public LoadUser(playerid,name[],value[])
{
    INI_Int("Lozinka", PlayerInfo[playerid][Lozinka]);
    INI_Int("pMoney", PlayerInfo[playerid][pMoney]);
    INI_Int("pLevel", PlayerInfo[playerid][pLevel]);
    INI_Int("pKills", PlayerInfo[playerid][pKills]);
    INI_Int("pDeaths", PlayerInfo[playerid][pDeaths]);
    INI_Int("pBank", PlayerInfo[playerid][pBank]);
    INI_Int("pAdmin", PlayerInfo[playerid][pAdmin]);
    INI_Int("pSpawn", PlayerInfo[playerid][pSpawn]);
    INI_Float("ucpX", PlayerInfo[playerid][ucpX]);
    INI_Float("ucpY", PlayerInfo[playerid][ucpY]);
    INI_Float("ucpZ", PlayerInfo[playerid][ucpZ]);
    INI_Float("ucpFact", PlayerInfo[playerid][ucpFact]);
    INI_Int("ucpInt", PlayerInfo[playerid][ucpInt]);
    INI_Int("ucpVw", PlayerInfo[playerid][ucpVw]);
    return (true);
}



Re: YINI problem | Reseting account on login - brett7 - 07.10.2011

How are they saved?


Re: YINI problem | Reseting account on login - OUL - 07.10.2011

pawn Код:
stock UpdatePlayer(playerid)
{
    new
       Data[128];
    format(Data, (sizeof Data), USER_DATA, GetName(playerid));
    if(fexist(Data))
    {
       new INI:USER_ = INI_Open(Data);
       INI_WriteInt(USER_, "pAdmin", PlayerInfo[playerid][pAdmin]);
       INI_WriteInt(USER_, "pMoney", PlayerInfo[playerid][pMoney]);
       INI_WriteInt(USER_, "pLevel", PlayerInfo[playerid][pLevel]);
       INI_WriteInt(USER_, "pKills", PlayerInfo[playerid][pKills]);
       INI_WriteInt(USER_, "pDeaths", PlayerInfo[playerid][pDeaths]);
       INI_WriteInt(USER_, "pBank", PlayerInfo[playerid][pBank]);
       INI_WriteInt(USER_, "pSpawn", PlayerInfo[playerid][pSpawn]);
       INI_WriteFloat(USER_, "ucpX", PlayerInfo[playerid][ucpX]);
       INI_WriteFloat(USER_, "ucpY", PlayerInfo[playerid][ucpY]);
       INI_WriteFloat(USER_, "ucpZ", PlayerInfo[playerid][ucpZ]);
       INI_WriteFloat(USER_, "ucpFact", PlayerInfo[playerid][ucpFact]);
       INI_WriteInt(USER_, "ucpInt", PlayerInfo[playerid][ucpInt]);
       INI_WriteInt(USER_, "ucpVw", PlayerInfo[playerid][ucpVw]);
       INI_Close(USER_);
    }
    return (true);
}
I think its not problem in save because when i exit or shutdown server and check my account file values it's fine... it's not 0 or 0.0000 but when i click on 'login' value's transform in 0 or 0.0000


Re: YINI problem | Reseting account on login - park4bmx - 07.10.2011

If u have autosave in ur FS
And when you press login the players data doesn't get loaded probably And becouse of not getting it load properly all the values are set to 0 and then the AutoSave saves the values as 0


Re: YINI problem | Reseting account on login - OUL - 07.10.2011

I don't use FS but i use 'UpdatePlayer()' in my timer, when i remove it it's work fine... I use UpdatePlayer() just on player disconnect callback...


Re: YINI problem | Reseting account on login - park4bmx - 08.10.2011

When you press the login can you show. The code how you load the player's status pls