Garry's Mod Wiki

SANDBOX

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:

-- Replace GAMEMODE with GM if you are in gamemode files. if ( GAMEMODE.IsSandboxDerived ) then -- Do stuff end

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.
boolean SANDBOX:CanArmDupe( Player ply )
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.
boolean SANDBOX:CanDrive( Player ply, Entity ent )
Called when a player attempts to drive a prop via Prop Drive
boolean SANDBOX:CanProperty( Player ply, string property, Entity ent )
Controls if a property can be used or not.
boolean SANDBOX:CanTool( Player ply, table tr, string toolname, table tool, number button )
Called when a player attempts to fire their tool gun. Return true to specifically allow the attempt, false to block it.
SANDBOX:ContentSidebarSelection( Panel parent, Panel node )
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.
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.
boolean SANDBOX:PlayerGiveSWEP( Player ply, string weapon, table swep )
Called when a player attempts to give themselves a weapon from the Q menu. ( Left mouse clicks on an icon )
SANDBOX:PlayerSpawnedEffect( Player ply, string model, Entity ent )
Called after the player spawned an effect.
SANDBOX:PlayerSpawnedNPC( Player ply, Entity ent )
Called after the player spawned an NPC.
SANDBOX:PlayerSpawnedProp( Player ply, string model, Entity entity )
Called when a player has successfully spawned a prop from the Q menu.
SANDBOX:PlayerSpawnedRagdoll( Player ply, string model, Entity ent )
Called after the player spawned a ragdoll.
SANDBOX:PlayerSpawnedSENT( Player ply, Entity ent )
Called after the player has spawned a scripted entity.
SANDBOX:PlayerSpawnedSWEP( Player ply, Entity ent )
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.
SANDBOX:PlayerSpawnedVehicle( Player ply, Entity ent )
Called after the player spawned a vehicle.
boolean SANDBOX:PlayerSpawnEffect( Player ply, string model )
Called to ask if player allowed to spawn a particular effect or not.
boolean SANDBOX:PlayerSpawnNPC( Player ply, string npc_type, string weapon )
Called to ask if player allowed to spawn a particular NPC or not.
boolean SANDBOX:PlayerSpawnObject( Player ply, string model, number skin )
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.
boolean SANDBOX:PlayerSpawnProp( Player ply, string model )
Called when a player attempts to spawn a prop from the Q menu.
boolean SANDBOX:PlayerSpawnRagdoll( Player ply, string model )
Called when a player attempts to spawn a ragdoll from the Q menu.
boolean SANDBOX:PlayerSpawnSENT( Player ply, string class )
Called when a player attempts to spawn an Entity from the Q menu.
boolean SANDBOX:PlayerSpawnSWEP( Player ply, string weapon, table swep )
Called when a player attempts to spawn a weapon from the Q menu. ( Mouse wheel clicks on an icon )
boolean SANDBOX:PlayerSpawnVehicle( Player ply, string model, string name, table table )
Called to ask if player allowed to spawn a particular vehicle or not.
SANDBOX:PopulatePropMenu()
This hook makes the engine load the spawnlist text files. It calls spawnmenu.PopulateFromEngineTextFiles by default.
SANDBOX:PopulateSTOOLMenu()
Called to populate the Scripted Tool menu. We advise against using this. It may be changed or removed in a future update. This hook is never called. Use SANDBOX:PopulateToolMenu instead.
SANDBOX:PopulateToolMenu()
Add the STOOLS to the tool menu. You want to call spawnmenu.AddToolMenuOption in this hook.
SANDBOX:PostReloadToolsMenu()
Called right after the Lua Loaded tool menus are reloaded. This is a good place to set up any ControlPanels.
SANDBOX:PreReloadToolsMenu()
Called right before the Lua Loaded tool menus are reloaded.
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.

Special Pages


Wikis

?

Render Time: 21ms

DB GetPage 3
Generate Html 3
SaveChanges (1) 5
Render Body 0
Render Sidebar 6