SA-MP Forums Archive
Autosave 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Autosave stats (/showthread.php?tid=196673)



Autosave stats - Face9000 - 06.12.2010

Hi guys,i've this code to save players stats by a cmd.

Код:
	for(new i=0; i<=MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i)) SavePlayer(i);
	}
And it's working very well. SavePlayer is a stock.

I need to make the auto save every 10 minutes,how?


Re: Autosave stats - Rachael - 06.12.2010

pawn Код:
forward Autosave();

SetTimer("Autosave",600000,true); //600 seconds = 600000ms, true = repeating timer

public Autosave()
{
    for(new i=0; i<=MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) SavePlayer(i);
    }
               return 1;
}



Re: Autosave stats - rjjj - 06.12.2010

Put:

pawn Код:
//In The OnGameModeInit:


SetTimer("SaveAccounts",600000,1);


//In the End of the GameMode

forward SaveAccounts();
public SaveAccounts()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SavePlayer(i);
        }  
    }
}

I hope that i have helped


Re: Autosave stats - Face9000 - 06.12.2010

Thanks...!


Re: Autosave stats - umast97thebest - 31.12.2010

where i put that?!?