call onplayerdisconnect
#1

hey, public OnPlayerDisconnect is calling a litle bit after OnGameModeExit, After OnGameModeExit al PVar's are deleting, i'm saving all player information with PVar's on OnPlayerDisconnect but they doesn't save becouse they deleted earlyer in OnGameModeExit so how can i call OnPlayerDisconnect earlyer? to get my info saved?
Reply
#2

pawn Code:
public OnGameModeExit( )
{
    for( new i = 0; i < MAX_PLAYERS; i++ ) OnPlayerDisconnect( i, 1 );
    return 1;
}
Reply
#3

Quote:
Originally Posted by Dwane
View Post
pawn Code:
public OnGameModeExit( )
{
    for( new i = 0; i < MAX_PLAYERS; i++ ) OnPlayerDisconnect( i, 1 );
    return 1;
}
not saving still
Reply
#4

It does save fine for me. How do you save in OnPlayerDisconnect?
Reply
#5

pawn Code:
new Query[ 512 ];

            format( Query, sizeof( Query ),"UPDATE `"#MYSQL_TABLE"` SET pinigai = '%i', patirtis = '%i', admin = '%i', vip = '%i', radija = '%i', nuzudymai = '%i', mirtis = '%i' WHERE vardas = '%s'",
            GetMoney( playerid ),
            GetPatirtis( playerid ),
            zInfo[ playerid ][ Admin ],
            zInfo[ playerid ][ Vip ],
            zInfo[ playerid ][ Radija ],
            zInfo[ playerid ][ Kill ],
            zInfo[ playerid ][ Mirtis ],
            GetPlayerNameEx( playerid ) );

            mysql_query(Query);
            mysql_free_result();
i put your script in gamemode but my saving script is in filterscript
Reply
#6

It was just an example, I don't know where you're saving to. Replace OnGameModeExit with OnFilterScriptExit and use it to your filterscript. Or if this callback already exists, add the for loop.
It should work fine then.
Reply
#7

filterscript isint exiting when gamemode changes
Reply
#8

Wait man, you made me confused. What do you want to do?
Reply
#9

when chaning the mode call OnPlayerDisconnect before OnGameModeExit
Reply
#10

And about "not saving"? You just told me you're using a system which saves and it's filterscript. OnPlayerDisconnect won't be called if the OnFilterScriptExit won't be called either.

Anyway, what I can suggest you is a timer. Let's say you have the code that it changes the gamemode, instead of that, call OnPlayerDisconnect with the way I showed you above and start a timer with few milliseconds (Not repeated (false). When the timer's callback will be called then change the gamemode.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)