SA-MP Forums Archive
saving players stats on server restart. - 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: saving players stats on server restart. (/showthread.php?tid=198846)



saving players stats on server restart. - Face9000 - 13.12.2010

Hi all,i've this function:

Code:
public SaveAllStats()
{
	new playername[MAX_PLAYER_NAME];
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(Registered[i])
			{
			    GetPlayerName(i, playername, MAX_PLAYER_NAME);
		    	dUserSetINT(playername).("Money",GetPlayerMoney(i));
		    	dUserSetINT(playername).("Kills",pInfo[i][pKills]);
		    	dUserSetINT(playername).("Deaths",pInfo[i][pDeaths]);
		    	dUserSetINT(playername).("Admin",pInfo[i][pAdmin]);
		    	dUserSetINT(playername).("Wantedlvl",GetPlayerWantedLevel(i));
		  	}
		}
	}
}
With a forward too.

I need to call this function when server restart,so,before the restart,stats are autosaved.


Re: saving players stats on server restart. - XePloiT - 13.12.2010

why would you do this? its extra work... just do that when player connects its loads his information


Re: saving players stats on server restart. - Face9000 - 13.12.2010

Lol yeah i know,but if i restart se.rver for updates,the scores arent saved..


Re: saving players stats on server restart. - XePloiT - 13.12.2010

hm i think on "OnGameModeExit()" if its game mode...
if its a FS "OnFilterScriptExit()"... i think it'll work... try and tell me


Re: saving players stats on server restart. - Face9000 - 13.12.2010

I dont use the FS;it's included in the gm


Re: saving players stats on server restart. - XePloiT - 13.12.2010

so OnGameModeExit()


Re: saving players stats on server restart. - Face9000 - 13.12.2010

Ok done.

Thanks.


Re: saving players stats on server restart. - Mean - 13.12.2010

Or try it OnPlayerDisconnect too. Since restart disconnects a player...


Re: saving players stats on server restart. - [MWR]Blood - 13.12.2010

Quote:
Originally Posted by Mean
View Post
Or try it OnPlayerDisconnect too. Since restart disconnects a player...
It's not going to work at all.
Do like Xeploit said.