Save STATS - 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: Save STATS (
/showthread.php?tid=447580)
Save STATS -
DAVIDXP - 30.06.2013
Hi SA-MP.com, i have small problem, when i enter on my server, i register my account, but when i exit, and enter second date, it says what i'm dont registered, I puted all on OnPlayerDisconnect:
pawn Код:
if( P_INFO[ playerid ][ Logged ] == true ) SaveFile( playerid );
This is function SaveFile:
pawn Код:
SaveFile(playerid )
{
dUserSetINT ( P_NAME (playerid)).("money",GetPlayerMoney(playerid));
dUserSetINT ( P_NAME2(playerid)).("kills",P_INFO[playerid][Kills]);
dUserSetINT ( P_NAME (playerid)).("deaths",P_INFO[playerid][Deaths]);
new h, m, s;
SpentTime(playerid, h, m, s);
dUserSetINT ( P_NAME (playerid)).("hours", h);
dUserSetINT ( P_NAME (playerid)).("minutes", m);
dUserSetINT ( P_NAME (playerid)).("seconds", s);
new Float:health; GetPlayerHealth(playerid, Float:health);
new Float:armour; GetPlayerArmour(playerid, Float:armour);
new year,month,day; getdate(year, month, day);
new strdate[20]; format(strdate, sizeof(strdate), "%d.%d.%d",day,month,year);
new file[256]; format(file,sizeof(file),"/SFL/users/%s.sav",udb_encode(P_NAME(playerid)) );
dUserSetINT ( P_NAME (playerid)).("health",floatround(health));
dUserSetINT ( P_NAME (playerid)).("armour",floatround(armour));
dini_Set (file,"LastOn",strdate);
dUserSetINT ( P_NAME (playerid)).("Logat",0);
dUserSetINT ( P_NAME (playerid)).("TimesOnServer",(dUserINT(P_NAME(playerid)).("TimesOnServer"))+1);
}
I have all in my scriptfiles.
Thanks
Re: Save STATS -
dEcooR - 30.06.2013
i think this have to be only
format(file,sizeof(file),"/SFL/users/%s.sav",udb_encode(P_NAME(playerid)) );
format(file,sizeof(file),"/SFL/users/%s.sav",P_NAME(playerid));