saving players stats on server restart.
#1

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

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

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

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

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

so OnGameModeExit()
Reply
#7

Ok done.

Thanks.
Reply
#8

Or try it OnPlayerDisconnect too. Since restart disconnects a player...
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)