Garry's Mod Wiki

Revision Difference

SANDBOX:PreReloadToolsMenu#552945

<function name="PreReloadToolsMenu" parent="SANDBOX" type="hook"> <ishook>yes</ishook>⤶ <description>Called right before the Lua Loaded tool menus are reloaded.</description> <realm>Client</realm> <predicted>No</predicted>⤶ </function> <example> <description>Removes some tools from the spawnmenu tab. **Note**: the player can still take them (e.g. via console command).</description> <code> -- The tools that we are going to hide from the menu. local toolsToHide = { weld = true, rope = true, } hook.Add( "PreReloadToolsMenu", "HideTools", function() -- Tool contains information about all registered tools. for name, data in pairs( weapons.GetStored( "gmod_tool" ).Tool ) do if toolsToHide[ name ] then data.AddToMenu = false end end end ) </code> </example>