Autosave stats
#1

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

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;
}
Reply
#3

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
Reply
#4

Thanks...!
Reply
#5

where i put that?!?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)