Score saving problem (DINI)
#1

So, this is my code:

pawn Код:
public OnFilterScriptInit()
{
    SetTimer("SaveStats", 15*1000, 1);
    return 1;
}
pawn Код:
public SaveStats()
{
    for(new i=0; i<MAX_PLAYERS; i++) if(Acc[i][Logged] == 1)
    {
        dUserSetINT(S(i)).("Score",GetPlayerScore(i));
    }
    return 1;
}
And, score keeps at 0, it doesn't save every 15 secs... I added dis to OnPlayerDisconnect:
pawn Код:
if(Acc[playerid][Logged] == 1)
{
    dUserSetINT(S(playerid)).("Score",GetPlayerScore(playerid));
}
And, score @ my userfile is always like this:
Код:
Score=0
Any fix?
Reply
#2

Why dont you use that?

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++) if(Acc[i][Logged] == 1)
    {
        new name; GetPlayerName(i,name,sizeof(name));
        dini_IntSet(file,"Score",GetPlayerScore(i));
    }
Reply
#3

It doesn't work, my code now is:
pawn Код:
public SaveStats()
{
    new file[256];
    for(new i=0; i<MAX_PLAYERS; i++) if(Acc[i][Logged] == 1)
    {
        new name[24];
    GetPlayerName(i,name,sizeof(name));
        dini_IntSet(file,"Score",GetPlayerScore(i));
    }
    return 1;
}
Still
Код:
Score=0
Reply
#4

Hm, I forgot something. Try this:
pawn Код:
public SaveStats()
{
    new file[256];
    for(new i=0; i<MAX_PLAYERS; i++) if(Acc[i][Logged] == 1)
    {
        new name[24];
    GetPlayerName(i,name,sizeof(name));
    format(file,sizeof(file),FILE_DIRECTORY_HERE,name);
        dini_IntSet(file,"Score",GetPlayerScore(i));
    }
    return 1;
}
Reply
#5

Lol, I'm so stupid, how could I forget that rofl, it works! Thanks al0t!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)