SA-MP Forums Archive
Help with save DATA dini - 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: Help with save DATA dini (/showthread.php?tid=179518)



Help with save DATA dini - martynas - 27.09.2010

Hi,


Help me to make save when player crashes...
Like when player play i make server restart and when he connects after restart there is first money and xp which you get when register...


Thanks in advance


Re: Help with save DATA dini - LarzI - 27.09.2010

Read up tutorials on dini, there are lots of them.


Re: Help with save DATA dini - martynas - 29.09.2010

but there is no tut about how to save data when server crashes...
OnPlayerDisconnect with cases it doesn't work... When i kill server over Putty everything gone for players..


Re: Help with save DATA dini - LarzI - 29.09.2010

The player is still disconnected when the server restarts, so OnPlayerDisconnect will be called.
There is probably something wrong elsewhere in your script.


Re: Help with save DATA dini - martynas - 30.09.2010

where it could be the error ?


Re: Help with save DATA dini - LarzI - 30.09.2010

Show us your code, and we might be able to help.


Re: Help with save DATA dini - martynas - 30.09.2010

My code is very big.. :S


Re: Help with save DATA dini - martynas - 30.09.2010

on player disconnect there are 3 cases lost connection disconnect or kick

when i make my save code on playerdisconnect it works when people press esc and press disconnect or exit anyway when i kill my server process on linux everything gone for people if people stand on save pickup and then i kill process for them save's all money and xp until the time they stand on save pickup after save pickup money wich they get after save gone...


Re: Help with save DATA dini - LarzI - 30.09.2010

Try adding this to "OnGameModeExit()"

pawn Код:
foreach(Player, i) //use a for loop if you don't have foreach
{
    if( IsPlayerConnected( i ))
    {
        //save stats for each player
    }
}



Re: Help with save DATA dini - Retardedwolf - 30.09.2010

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Try adding this to "OnGameModeExit()"

pawn Код:
foreach(Player, i) //use a for loop if you don't have foreach
{
    if( IsPlayerConnected( i ))
    {
        //save stats for each player
    }
}
I think foreach already checks if the player is connected so you don't have to put another check