Author Topic: Function for Server Shutdown?  (Read 1149 times)

For some reason I can't find the correct function for ending a server. OnMissionLoaded seems to work for starting, but the following isn't producing results. I'm probably just overlooking something dumb, any help is appreciated.
Code: [Select]
function onMissionEnded()
{
saveServerStats();
}
What is the correct way to handle a server shutdown?

Yes, review Script_Player_Persistence's package in the server.cs. Obviously there's nothing to be done when exiting in some ways, such as clicking the x on a dedicated server window, or just plain crashing, but you can cover a couple ways.

Obviously there's nothing to be done when exiting in some ways, such as clicking the x on a dedicated server window, or just plain crashing, but you can cover a couple ways.
Or Mac users doing Cmd + Q.

I've found its usually better to do stuff upon the server shutting down and saving things periodically (but in an efficient way)


this is how player_persistence does it:
Code: [Select]
function doQuitGame()
{
      //Save function here
      Parent::doQuitGame();
}

I've found its usually better to do stuff upon the server shutting down and saving things periodically (but in an efficient way)

this is how player_persistence does it:
Code: [Select]
function doQuitGame()
{
      //Save function here
      Parent::doQuitGame();
}
That worked great, thanks! I'll be saving on a schedule as well, I just wanted to have something for handling server shutdown.