PDA

View Full Version : OnPlayerDisconnect Callback


Konstantinos
19/01/2012, 04:46 PM
It saves only when player disconnect with reason 1 Left normally (/q or ESC menu and quit)
If the player crashed or kicked/banned, the data aren't saved.
Is there any way to check the reason like the part of code below and in the two cases to save the Player's Data?
public OnPlayerDisconnect( playerid, reason )
{
OnPlayerLogout( playerid ); // Save Player Data

return 1;
}


// Instead of Message to save the data| OnPlayerLogout( playerid ); |
new
LeavingMsg[ 64 ];

switch( reason ) {
case 0: format( LeavingMsg, sizeof( LeavingMsg ), "%s left the server. (Timed out)", GetName( playerid ) );
case 1: format( LeavingMsg, sizeof( LeavingMsg ), "%s left the server. (Leaving)", GetName( playerid ) );
case 2: format( LeavingMsg, sizeof( LeavingMsg ), "%s left the server. (Kicked/Banned)", GetName( playerid ) );
}
SendClientMessageToAll( COLOR_YELLOW, LeavingMsg );

milanosie
19/01/2012, 05:06 PM
Make it save every 2 minutes with a timer? So the rollback wont be bigger then 2 minuts if someone crashes