Gamemode.PlayerGiveSWEP

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NamePlayerGiveSWEP
SyntaxGM:PlayerGiveSWEP( Player player, String class, Table weapon )
DescriptionCalled when a player tries to give themselves a SWEP.
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerGiveSWEP]Gamemode.PlayerGiveSWEP [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionStops players giving themselves SWEPs.
Used onNewerServer.png
Code
function GM:PlayerGiveSWEP( ply, class, wep )
	return false
end
OutputN/A

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


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox