Y_ini and stats problem.
#1

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

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

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);
}
Reply
#4

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

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

Bumb.
Reply
#7

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

Already did that.
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)