Save Stats every 30 seconds
#1

I'm having problem with save player stats. Everytime server host restart all stats of connected players are always reseting. They must quit first before there stats save.

This is what under OnPlayerDisconnect
pawn Код:
SavePlayer(playerid);
        LogPlayerOut(playerid);
Now I want this to run every 30 seconds. So If ever server automatically restarts. Their stats saved at least every 30 seconds.
Reply
#2

Every 30 seconds may cause you to lag if you are saving a bunch, however perhaps something like this:
pawn Код:
OnPlayerConnect
{
    SetTimer("SavePlayer", 30000, true);
}
pawn Код:
forward SavePlayer(playerid);
pawn Код:
public SavePlayer(playerid)
{
    //What is saving every 30 seconds
}
pawn Код:
OnGameModeExit
{
    SavePlayer(playerid);
}
NOTE: Not tested

EDIT: Also, your signature caught my eye, you spelled sever it should be server.
Reply
#3

pawn Код:
forward savestats(playerid);

gamemode int
SetTimer("SaveStats", 30000,true);

public SaveStats(playerid)
{
blah blah blah // save stats stuff
return 1;
}
Reply
#4

Quote:
Originally Posted by nmader
Посмотреть сообщение
Every 30 seconds may cause you to lag if you are saving a bunch, however perhaps something like this:
pawn Код:
OnPlayerConnect
{
    SetTimer("SavePlayer", 30000, true);
}
pawn Код:
forward SavePlayer(playerid);
pawn Код:
public SavePlayer(playerid)
{
    //What is saving every 30 seconds
}
pawn Код:
OnGameModeExit
{
    SavePlayer(playerid);
}
NOTE: Not tested

EDIT: Also, your signature caught my eye, you spelled sever it should be server.
u cannot put playerid under gamodeexit u need to put foreach(player, i)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)