Server Crashing. Losing data. - 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: Server Crashing. Losing data. (
/showthread.php?tid=94349)
Server Crashing. Losing data. -
RaFsTar - 29.08.2009
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.
Re: Server Crashing. Losing data. -
James_Alex - 29.08.2009
you have something like that
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if( reason == anything)
...
?
Re: Server Crashing. Losing data. -
Correlli - 29.08.2009
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.
Re: Server Crashing. Losing data. -
Hiitch - 29.08.2009
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..
Re: Server Crashing. Losing data. -
snoob - 29.08.2009
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.