Server Crashing. Losing data.
#1

Well, I am having a big big problem on my server.
When it crashes, it does not runs OnPlayerDisconnect, and if it dont run that, player account, money, other stuff are not saved.
How can I prevent such thing ?
This is real important, and this problem is annoying me harder, I hop get some help over here.


Best Regards.
Reply
#2

you have something like that
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if( reason == anything)
...
?
Reply
#3

Quote:
Originally Posted by RaFsTar
Well, I am having a big big problem on my server.
When it crashes, it does not runs OnPlayerDisconnect
Of course it doesn't if it crashes.

Quote:
Originally Posted by RaFsTar
and if it dont run that, player account, money, other stuff are not saved.
How can I prevent such thing ?
This is real important, and this problem is annoying me harder, I hop get some help over here.
Create a timer (every minute as an example) and create loop for all connected players and save their stats.
Reply
#4

I would do what Don_Correlli said, create a timer to save their stats.

But what do you have under OnPlayerDisconnect? Stuff like stat saving?

Example from my gamemode :

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  if(Logged[playerid])
  {
    dUserSetINT(PlayerName(playerid)).("Admin",GetPlayerAdminz(playerid));
  dUserSetINT(PlayerName(playerid)).("Score",GetPlayerScore(playerid));
  dUserSetINT(PlayerName(playerid)).("Money",GetPlayerMoney(playerid));
    }
    return 1;
}
Sorry if this wasnt necessary, but I just want to see what is under OnPlayerDisconnect..
Reply
#5

i personaly save my data in onplayerchangestate. this way i dont have to loop all the player.
i save when the player get on foot, driver, or passenger using a code similar to that.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
   if( 1 <= newstate <= 3 )
   {
     //save data for playerid
   }
   return 1;
}
this wont save the data just before crashing but it will give you a more acurate data save without using a timer and a player loop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)