Gamemode.Initialize
From GMod Wiki
Event Hook | |
Hook Name | Initialize |
Syntax | GM:Initialize( ) |
Description | Called when the gamemode loads and starts. |
Returns | Nil |
Lua State | |
BBCode | [b][url=wiki.garrysmod.com/?title=Gamemode.Initialize]Gamemode.Initialize [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | Prints stuff when the gamemode loads and starts. |
---|---|
Used on | |
Code | function Init_Gamemode() Msg( "stuff\n" ) end hook.Add( "Initialize", "initializing", Init_Gamemode ); |
Output | stuff |
Additional Notes
- For the server, this is called when you start it up. For the client, this is called when the gamemode is initialized on your computer. Basically right after the map/entities initialize functions are called.
- If you need to do anything with entities, you should be using Gamemode.InitPostEntity, since all entities have been initialized when that hook gets called. This one gets called right when the server (re)starts.
- Important! If you are concerned about a certain function starting after the gamemode has registered, then this is for you.