Garry's Mod Wiki

SANDBOX:SpawnMenuOpen

  boolean SANDBOX:SpawnMenuOpen()

Description

Called when spawnmenu is trying to be opened.

Hiding the spawnmenu will not stop people from being able to use the various console commands to spawn in items, etc. See GM:PlayerSpawn* hooks for blocking actual spawning.

Returns

1 boolean
Return false to dissallow opening the spawnmenu

Example

Only allow the people you want to open the spawn menu.

local allowed = { ["STEAM_0:0:00000000"] = true, ["STEAM_0:0:10000000"] = true } hook.Add( "SpawnMenuOpen", "SpawnMenuWhitelist", function() if ( !allowed[ LocalPlayer():SteamID() ] ) then return false end end )

Example

Disables and collapses the default customizable spawnlists node.

hook.Add( "SpawnMenuOpen", "SpawnMenuHide", function() g_SpawnMenu.CustomizableSpawnlistNode:SetExpanded( false ) g_SpawnMenu.CustomizableSpawnlistNode:SetEnabled( false ) g_SpawnMenu.CustomizableSpawnlistNode.SMContentPanel:SwitchPanel() end )