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) still goes out, but on a shutdown the server may be gone before it lands: keep the writes that matter at the moment of the change and on the disconnect, not here.

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