Garry's Mod Wiki

GM:ShutDown

  GM:ShutDown()

Description

Called whenever the Lua environment is about to be shut down, for example on map change, or when the server is going to shut down.

Player:SteamID, Player:SteamID64, and the like will return nil for the listen host here but work fine for other players.

Example

Prints into the players chat: Server Is Restarting..

hook.Add( "ShutDown", "ServerShuttingDown", function() Entity( 1 ):PrintMessage( HUD_PRINTTALK, "Server Is Restarting." ) end )
Output: Server Is Restarting. When then the server is Shutting down, etc.