Garry's Mod Wiki

game_newmap

Description

Called when a map is loaded.

This is only available in the Menu state because this is called before the Client State has even started.

Members

string mapname
The Map name

Examples

Example

This is a basic template with the purpose of including all arguments / table variables to make it easily known which values can be accessed. This Binary Module has been used.

require("gameevent") -- using a Binary Module because the Menu State doesn't has gameevent.Listen gameevent.Listen( "game_newmap" ) hook.Add( "game_newmap", "game_newmap_example", function( data ) local mapname = data.mapname // The Map name. // Called when a map is loaded. end )