SANDBOX/SpawnMenuOpen

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Moved the example from OnSpawnMenuOpen to here.)
 
Line 9: Line 9:
 
|type=boolean
 
|type=boolean
 
|desc=Return false to dissallow opening the spawnmenu
 
|desc=Return false to dissallow opening the spawnmenu
 +
}}
 +
{{Example
 +
|Description=Only allow the people you want to open the spawn menu.
 +
|Code=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 )
 
}}
 
}}

Latest revision as of 19:32, 9 December 2018

 SANDBOX:SpawnMenuOpen( )

Contents

Description

Called when spawnmenu is trying to be opened.

NOTE

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

boolean

Return false to dissallow opening the spawnmenu

Examples

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 )


Personal tools
Navigation