Score saving problem (DINI) - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Score saving problem (DINI) (
/showthread.php?tid=207275)
Score saving problem (DINI) -
Mean - 05.01.2011
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:
Any fix?
Re: Score saving problem (DINI) -
blackwave - 05.01.2011
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));
}
Re: Score saving problem (DINI) -
Mean - 05.01.2011
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
Re: Score saving problem (DINI) -
blackwave - 05.01.2011
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;
}
Re: Score saving problem (DINI) -
Mean - 05.01.2011
Lol, I'm so stupid, how could I forget that rofl, it works! Thanks al0t!