Garry's Mod Wiki

Revision Difference

Lua_Hooks_Order#561088

<cat>Dev.Lua</cat>⤶ <cat>Dev.Ref</cat>⤶ <title>Lua Hooks Order</title> This page shows the order of hooks calls. <note>The list is generated on base gamemode with `-noaddons`. The list starts from the first called hook till the last without any user/server activity. Only first hook call is recorded.</note> # Client - <page>GM:CreateTeams</page> - <page>GM:PreGamemodeLoaded</page> - <page>GM:OnGamemodeLoaded</page> - Good hook to create custom <page text="vgui elements">VGUI Element List</page>. - <page>GM:PopulateMenuBar</page> - <page>GM:CloseDermaMenus</page> - <page>GM:ForceDermaSkin</page> - <page>GM:PostGamemodeLoaded</page> - <page>GM:Initialize</page> - <page>GM:HUDShouldDraw</page> - <page>GM:DrawOverlay</page> - <page>GM:Tick</page> - <page>GM:PlayerClassChanged</page> - <page>GM:OnEntityCreated</page> - <page>GM:NotifyShouldTransmit</page> - <page>GM:InitPostEntity</page> - Starting from this hook <page>Global.LocalPlayer</page> returns valid player. - <page>GM:StartCommand</page> - <page>GM:CreateMove</page> - <page>GM:CalcView</page> - <page>GM:AdjustMouseSensitivity</page> - <page>GM:CalcMainActivity</page> - <page>GM:TranslateActivity</page> - <page>GM:UpdateAnimation</page> - <page>GM:NetworkEntityCreated</page> - **Render Hooks** (<page>Render Order</page>) - <page>GM:Think</page> - <page>GM:InputMouseApply</page> - <page>GM:SetupMove</page> - <page>GM:PlayerTick</page> - <page>GM:Move</page> - <page>GM:FinishMove</page> - <page>GM:PlayerPostThink</page> - <page>GM:DoAnimationEvent</page> - **HUD Hooks** (<page text="HUD Render Order">Render Order#drawactivehud</page>) # Server - <page>GM:CreateTeams</page> - <page>GM:PreGamemodeLoaded</page> - <page>GM:OnGamemodeLoaded</page> - <page>GM:PostGamemodeLoaded</page> - <page>GM:Initialize</page> - <page>GM:OnEntityCreated</page> - <page>GM:EntityKeyValue</page> - <page>GM:EntityRemoved</page> - <page>GM:InitPostEntity</page> - Good hook to create new entities. (You're still able to spawn them, but `worldspawn` won't be valid) - <page>GM:GetGameDescription</page> - Starting from this hook clients are able to connect the server. - <page>GM:Think</page> - <page>GM:Tick</page> - <page>GM:AcceptInput</page> - <page>GM:EntityEmitSound</page> # Menu - <page>GM:MenuStart</page> - <page>GM:GameContentChanged</page> - <page>GM:Think</page> - <page>GM:DrawOverlay</page> - <page>GM:CaptureVideo</page>