SA-MP Forums Archive
Y_ini and stats problem. - 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: Y_ini and stats problem. (/showthread.php?tid=425406)



Y_ini and stats problem. - ]Rafaellos[ - 25.03.2013

Yesterday i change my Registration System from Dini to Y_ini and i am having some problems with loading the stats. No always player stats are setting back to 0.

I create the system with THIS tutorial.

Any help?


Re: Y_ini and stats problem. - Scenario - 25.03.2013

Is the player's data saving correctly? If so, show the code you're using to LOAD the data. If not, show the code you're using to SAVE the data, as well as the code to LOAD the data.


Re: Y_ini and stats problem. - ]Rafaellos[ - 25.03.2013

Loading:
pawn Код:
forward LoadAccount_User(playerid, name[], value[]);
public LoadAccount_User(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][Password],129);
    INI_String("RegisterDate", pInfo[playerid][RegisterDate],50);
    INI_String("LastLogin", pInfo[playerid][LastLogin],50);
    INI_Int("Admin", pInfo[playerid][Admin]);
    INI_Int("VIP", pInfo[playerid][VIP]);
    INI_Int("Money", pInfo[playerid][Money]);
    INI_Int("Score", pInfo[playerid][Score]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Float("PositionX", pInfo[playerid][SPX]);
    INI_Float("PositionY", pInfo[playerid][SPY]);
    INI_Float("PositionZ", pInfo[playerid][SPZ]);
    INI_Float("Angle", pInfo[playerid][SPA]);
    INI_Int("Interior", pInfo[playerid][SPI]);
    return 1;
}
Saving:
pawn Код:
if(fexist(Path(playerid)))
{
    new string[128];
    new year,month,day;
    new hours, minutes, seconds;
    getdate(year,month,day);
    gettime(hours, minutes, seconds);
    format(string, sizeof(string), "%d/%d/%d - %d:%d:%d", day,month,year,hours,minutes,seconds);
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file,"Player's Data");
    INI_WriteString(file,"LastLogin",string);
    INI_WriteInt(file,"Admin",pInfo[playerid][Admin]);
    INI_WriteInt(file,"VIP",pInfo[playerid][VIP]);
    INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
    INI_WriteInt(file,"Score",GetPlayerScore(playerid));
    INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
    INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
    INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
    INI_WriteFloat(file,"PositionX", pInfo[playerid][SPX]);
    INI_WriteFloat(file,"PositionY",pInfo[playerid][SPY]);
    INI_WriteFloat(file,"PositionZ", pInfo[playerid][SPZ]);
    INI_WriteFloat(file,"Angle", pInfo[playerid][SPA]);
    INI_WriteInt(file,"Interior", pInfo[playerid][SPI]);
    INI_Close(file);
}



Re: Y_ini and stats problem. - Scenario - 25.03.2013

Okay, so the player's data isn't being saved properly?


Re: Y_ini and stats problem. - ]Rafaellos[ - 25.03.2013

I dont what actually happening, but sometimes when player login, his score, money is set back to 0.


Re: Y_ini and stats problem. - ]Rafaellos[ - 27.03.2013

Bumb.


Respuesta: Y_ini and stats problem. - MiGu3X - 27.03.2013

I think u need to update players data every some time and when he disconnectas also....


Re: Y_ini and stats problem. - ]Rafaellos[ - 27.03.2013

Already did that.


Re: Y_ini and stats problem. - Saw® - 27.03.2013

Well I think that something missing when you read the tutorial, I suggest you to read this tutorial it will work perfectly : https://sampforum.blast.hk/showthread.php?tid=273088