Revision Difference
SANDBOX:PlayerSpawnSWEP#552987
<function name="PlayerSpawnSWEP" parent="SANDBOX" type="hook">
<ishook>yes</ishook>⤶
<description>Called when a player attempts to spawn a weapon from the Q menu. ( Mouse wheel clicks on an icon )</description>
<realm>Server</realm>
<predicted>No</predicted>⤶
<args>
<arg name="ply" type="Player">The player who attempted to spawn a weapon.</arg>
<arg name="weapon" type="string">Class name of the weapon the player tried to spawn.</arg>
<arg name="swep" type="table">Information about the weapon the player is trying to spawn, see <page>Structures/SWEP</page></arg>
</args>
<rets>
<ret name="" type="boolean">Can the SWEP be spawned</ret>
</rets>
</function>
<example>
<description>Stops non-admins from spawning weapons.</description>
<code>
hook.Add( "PlayerSpawnSWEP", "SpawnBlockSWEP", function( ply, class, info )
if ( not ply:IsAdmin() ) then
return false
end
end )
</code>
</example>