OnGameModeExit
#1

pawn Код:
public OnGameModeExit()
{
    foreach(Player, i)
    {
        SaveAccount(i);
    }
    mysql_close(g_Handle);
    return 1;
}
It saves accounts OnPlayerDisconnect and other functions but when I close the gamemode whilst ingame to see if it will save, it doesn't.
Reply
#2

How do you 'close' the gamemode? By typing exit as a Rcon command or in the console, or by simply clicking the red [X] of the console?
If I remember correctly, OnGameModeExit is only called when typing exit in the console or as Rcon command.
Reply
#3

As above.

What method do you enforce to "exit"
Reply
#4

Did you put the code to save the stats on OnPlayerDisconnect? If you put the code only in OnGameModeExit it doesn't not make really sense, you can't save the accounts info only when you close the GameMode.
Reply
#5

Bump
Reply
#6

Quote:
Originally Posted by Lloyde
Посмотреть сообщение
Bump
Err, wtf, isn't the OP supposed to bump
Reply
#7

Sorry been very busy. I close the game mode by clicking the red X.
The character saving is also under OnPlayerDisconnect. I need it so any way the player gets disconnected their account will save? Whether it's using the rcon command to exit the console or force closing it.
Reply
#8

You can't save people's account on OnGameModeExit, If you were to make a new cmd called /restart or something and then saved account before restarting, that would work. But by pressing the x on the console windows. Will not call the OnGameModeExit function.
Reply
#9

Quote:
Originally Posted by AphexCCFC
Посмотреть сообщение
Sorry been very busy. I close the game mode by clicking the red X.
The character saving is also under OnPlayerDisconnect. I need it so any way the player gets disconnected their account will save? Whether it's using the rcon command to exit the console or force closing it.
When clicking the red X OnPlayerDisconnect is NOT callled. If you issue the Rcon 'exit' command instead, it should call OnGameModeExit as far as I know.
I don't know why you'd place saving code for players there to be honest, OnPlayerDisconnect should do the job just fine (as long as you don't use the red X).
Reply
#10

This used to work for pressing the X button too on my other server, there's gotta be a way somehow.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)