Save stats problem
#2

Because OnPlayerDisconnect can't be called when player time outs. You need to make a timer to save all players stats.
pawn Код:
// GameModeInit
SetTimer( "SaveStats", 120000, 1 ); // Saves all stats every 2 minutes.
Later in script
pawn Код:
forward SaveStats( );
public SaveStats( )
{
    for( new playerid = 0; playerid < MAX_PLAYERS; playerid++ ) if( IsPlayerConnected( playerid ) && !IsPlayerNPC( playerid ) )
    {
        // Your save code, from OnPlayerDisconnect goes here
    }
    return 1;
}
Also, make sure you include a_npc,
pawn Код:
#include < a_npc >
You need it because the loop I made works like foreach, it excludes NPCs and skips non-connected players.
Reply


Messages In This Thread
Save stats problem - by tuuker - 04.03.2011, 09:12
Re: Save stats problem - by Mean - 04.03.2011, 09:18
Re: Save stats problem - by tuuker - 04.03.2011, 09:25
Re: Save stats problem - by iggy1 - 04.03.2011, 09:40
Re: Save stats problem - by tuuker - 04.03.2011, 09:48
Re: Save stats problem - by Mean - 04.03.2011, 09:51
Re: Save stats problem - by iggy1 - 04.03.2011, 09:53
Re: Save stats problem - by tuuker - 04.03.2011, 10:07
Re: Save stats problem - by BMUK - 04.03.2011, 11:06
Re: Save stats problem - by [MWR]Blood - 04.03.2011, 11:20

Forum Jump:


Users browsing this thread: 2 Guest(s)