Skip to content

OnGameModeExit

The server shuts down or the mode is about to be reloaded.

The last callback of a mode’s life; the objects the mode made are torn down by the server right after this. A write to the mode’s database from here (Execute) lands: at a server stop the server waits for the mode’s writes still in the line (15 seconds at most) before it closes. At a stop - not at a reload - ExecuteSync and QuerySync are allowed here too, for a save the mode wants to see finished. Still keep the writes that matter at the moment of the change and on the disconnect: a crash or a killed process has no goodbye.

function OnGameModeExit()
-- ...
end

nothing

function OnGameModeExit()
if db then db:Execute("UPDATE server_stats SET rounds = @r WHERE id = 1", { r = roundsPlayed }) end
end

OnGameModeInit · ReloadGameMode · the Server and timers group of the index