SA-MP Forums Archive
OnGameModeExit saving player's 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)
+--- Thread: OnGameModeExit saving player's stats (/showthread.php?tid=421891)



OnGameModeExit saving player's stats - PaulDinam - 11.03.2013

It doesn't work, anyidea?

pawn Код:
public OnGameModeExit()
{
    foreach(Player, i)
    {
        OnPlayerDisconnect(i, 1);
    }
    mysql_close(dbHandle);
    return 1;
}
On playerdisconnect has a function which saves all player stats


Re: OnGameModeExit saving player's stats - JaKe Elite - 11.03.2013

Calling OnPlayerDisconnect in OnGameModeExit will not really work.

How about putting the save stats function OnGameModeExit inside the loop.

That's it. Simple problem..


Re: OnGameModeExit saving player's stats - InfiniTy. - 11.03.2013

I don't think you can use ongamemodeexit to save player stats
A timer for 5 or 10 minutes and onplayerdisonnect should be just what you need..


Re: OnGameModeExit saving player's stats - mineralo - 11.03.2013

if you want to restart server then do
pawn Код:
CMD:gmx(playerid,params[])
{
          #pragma unused params
          if(!IsPlayerAdmin(playerid))return 0;
          for(new i=0;i<MAX_PLAYERS;i++)
          {
                    Kick(i); // change it if want
          }
}
you can put replace Kick the saving function, like you have SavePlayer(playerid)


Re: OnGameModeExit saving player's stats - PaulDinam - 11.03.2013

I have a command which saves all player stats, thanks anyway.