Revision Difference
SANDBOX:PlayerGiveSWEP#547839
<function name="PlayerGiveSWEP" parent="SANDBOX" type="hook">
<ishook>yes</ishook>
<description>Called when a player attempts to give themselves a weapon from the Q menu. ( Left mouse clicks on an icon )</description>
<realm>Server</realm>
<predicted>No</predicted>
<args>
<arg name="ply" type="Player">The player who attempted to give themselves a weapon.</arg>
<arg name="weapon" type="string">Class name of the weapon the player tried to give themselves.</arg>
<arg name="swep" type="table">The swep table of this weapon, see <page>Structures/SWEP</page></arg>
</args>
<rets>
<ret name="" type="boolean">Can the SWEP be given to the player</ret>
</rets>
</function>
⤶
<example>⤶
<description>Stops non-admins from giving themselves weapons.</description>⤶
<code>⤶
hook.Add( "PlayerGiveSWEP", "BlockPlayerSWEPs", function( ply, class, swep )⤶
if ( not ply:IsAdmin() ) then⤶
return false⤶
end⤶
end )⤶
</code>⤶
⤶
</example>