Gamemode.PlayerSpawnSWEP

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NamePlayerSpawnSWEP
SyntaxGM:PlayerSpawnSWEP( Player ply, String classname, Table weapon table )
DescriptionCalled when a player wants to spawn a SWEP
ReturnsBoolean
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerSpawnSWEP]Gamemode.PlayerSpawnSWEP [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionStops players spawning SWEPs.
Used onNewerServer.png
Code
function GM:PlayerSpawnSWEP( ply, class, wep )
	return false;
end
OutputN/A

DescriptionOnly allows admins to spawn SWEPs.
Used onNewerServer.png
Code
hook.Add("PlayerSpawnSWEP", "AdminOnlySWEPs", function( ply, class, wep )
	return ply:IsAdmin()
end)
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox