SANDBOX
This function or feature is only available in the Sandbox gamemode and its derivatives.
This is a list of hooks that are only available in Sandbox or Sandbox derived gamemodes.
Easiest way to tell if a gamemode is Sandbox derived is to check if this variable exists:
Inherits methods from GM.
Events
SANDBOX:AddGamemodeToolMenuCategories()
This is used internally - although you're able to use it you probably shouldn't.
This hook is used to add default categories to spawnmenu tool tabs.
Do not override or hook this function, use SANDBOX:AddToolMenuCategories!
SANDBOX:AddGamemodeToolMenuTabs()
This is used internally - although you're able to use it you probably shouldn't.
This hook is used to add default tool tabs to spawnmenu.
Do not override or hook this function, use SANDBOX:AddToolMenuTabs!
SANDBOX:AddToolMenuCategories()
This hook is used to add new categories to spawnmenu tool tabs.
SANDBOX:AddToolMenuTabs()
This hook is used to add new tool tabs to spawnmenu.
Called when a player attempts to "arm" a duplication with the Duplicator tool. Return false to prevent the player from sending data to server, and to ignore data if it was somehow sent anyway.
Called when a player attempts to drive a prop via Prop Drive
Called when a player attempts to fire their tool gun. Return true to specifically allow the attempt, false to block it.
Called when player selects an item on the spawnmenu sidebar at the left.
SANDBOX:ContextMenuClosed()
Called when the context menu is supposedly closed.
This is simply an alias of GM:OnContextMenuClose.
This hook will be called even if the Sandbox's context menu doesn't actually exist, i. e. SANDBOX:ContextMenuEnabled blocked its creation.
SANDBOX:ContextMenuCreated( Panel g_ContextMenu )
Called when the context menu is created.
boolean SANDBOX:ContextMenuEnabled()
Allows to prevent the creation of the context menu. If the context menu is already created, this will have no effect.
boolean SANDBOX:ContextMenuOpen()
Called when the context menu is trying to be opened.
SANDBOX:ContextMenuOpened()
Called when the context menu is supposedly opened.
This is simply an alias of GM:OnContextMenuOpen but will not be called if SANDBOX:ContextMenuOpen prevents the context menu from opening.
This hook will be called even if the context menu doesn't actually exist, i. e. SANDBOX:ContextMenuEnabled blocked its creation.
boolean SANDBOX:ContextMenuShowTool()
Called to poll if active tool settings should appear in the context menu. Please note that this is only called on initial opening of the context menu, not every frame the context menu is in use.
SANDBOX:OnRevertSpawnlist()
Called when the Client reverts spawnlist changes
SANDBOX:OnSaveSpawnlist()
Called when a player saves his changes made to the spawnmenu
SANDBOX:OpenToolbox()
This is used internally - although you're able to use it you probably shouldn't.
This hook is called when the player edits a category in the Spawnmenu
SANDBOX:PaintNotes()
Called from GM:HUDPaint; does nothing by default.
This cannot be used with hook. Add
SANDBOX:PaintWorldTips()
Called from GM:HUDPaint to draw world tips. By default, enabling cl_drawworldtooltips will stop world tips from being drawn here.
See AddWorldTip for more information.
This cannot be used with hook. Add
SANDBOX:PersistenceLoad( string name )
Called when persistent props are loaded.
SANDBOX:PersistenceSave( string name )
Called when persistent props are saved.
Called when a player attempts to give themselves a weapon from the Q menu. (Left mouse clicks on an icon)
Not to be confused with SANDBOX:PlayerSpawnSWEP, which is called when the weapon is spawned as entity on the ground.
Called after the player spawned an effect.
Called after the player spawned an NPC.
Called when a player has successfully spawned a prop from the Q menu.
Called after the player spawned a ragdoll.
Called after the player has spawned a scripted entity.
Called after the player has spawned a scripted weapon from the spawnmenu with a middle mouse click.
For left mouse click spawns, see SANDBOX:PlayerGiveSWEP.
Called after the player spawned a vehicle.
Called to ask if player allowed to spawn a particular effect or not.
Called to ask if player allowed to spawn a particular NPC or not.
Called to ask whether player is allowed to spawn a given model. This includes props, effects, and ragdolls and is called before the respective PlayerSpawn* hook.
Called when a player attempts to spawn a prop from the Q menu.
Called when a player attempts to spawn a ragdoll from the Q menu.
Called when a player attempts to spawn an Entity from the Q menu.
Called when a player attempts to spawn a weapon from the Q menu as an entity on the ground. (Mouse wheel clicks on an icon)
Not to be confused with SANDBOX:PlayerGiveSWEP, which is called only when the weapon is given to the player directly, if they don't already have it.
Called to ask if player allowed to spawn a particular vehicle or not.
Called by the spawnmenu when the content tab is generated
Creating an error in this Hook will result in a completely broken Content Tab
Called by the spawnmenu when the Entities tab is generated
Creating an error in this Hook will result in a completely broken Entites Tab
Called by the spawnmenu when the NPCs tab is generated
Creating an error in this Hook will result in a completely broken NPCs Tab
SANDBOX:PopulatePropMenu()
This hook makes the engine load the spawnlist text files.
It calls spawnmenu. PopulateFromEngineTextFiles by default.
SANDBOX:PopulateToolMenu()
Add the Scripted TOOLs to the tool menu. You want to call spawnmenu. AddToolMenuOption in this hook.
Called by the spawnmenu when the Vehicles tab is generated
Creating an error in this Hook will result in a completely broken vehicles Tab
Called by the spawnmenu when the Weapons tab is generated
Creating an error in this Hook will result in a completely broken Weapons Tab
SANDBOX:PostReloadToolsMenu()
Called right after the Lua Loaded tool menus are reloaded. This is a good place to set up any ControlPanels.
Called just before registering a Sandbox scripted tool.
SANDBOX:PreReloadToolsMenu()
Called right before the Lua Loaded tool menus are reloaded.
SANDBOX:SpawnlistContentChanged()
Called when changes were made to the spawnmenu like creating a new category.
SANDBOX:SpawnlistOpenGenericMenu( Panel canvas )
This is used internally - although you're able to use it you probably shouldn't.
Called when there's one or more items selected in the spawnmenu by the player, to open the multi selection right click menu (DMenu)
boolean SANDBOX:SpawnMenuEnabled()
If false is returned then the spawn menu is never created. This saves load times if your mod doesn't actually use the spawn menu for any reason.
boolean SANDBOX:SpawnMenuOpen()
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.
SANDBOX:SpawnMenuOpened()
Called when the spawnmenu is opened.
This is an alias of GM:OnSpawnMenuOpen but will not be called if SANDBOX:SpawnMenuOpen prevents the spawnmenu from opening.
This hook will be called even if the spawnmenu doesn't actually exist, i. e. SANDBOX:SpawnMenuEnabled blocked its creation.