Garry's Mod Wiki

SANDBOX:PlayerGiveSWEP

SANDBOX:PlayerGiveSWEP

  boolean SANDBOX:PlayerGiveSWEP( Player ply, string weapon, table swep )

Description

Called when a player attempts to give themselves a weapon from the Q menu. ( Left mouse clicks on an icon )

Arguments

1 Player ply
The player who attempted to give themselves a weapon.
2 string weapon
Class name of the weapon the player tried to give themselves.
3 table swep
The swep table of this weapon, see Structures/SWEP

Returns

1 boolean
Can the SWEP be given to the player

Example

Stops non-admins from giving themselves weapons.

hook.Add( "PlayerGiveSWEP", "BlockPlayerSWEPs", function( ply, class, swep ) if ( not ply:IsAdmin() ) then return false end end )

Special Pages


Wikis

?

Render Time: 54ms

DB GetPage 33
Generate Html 6
SaveChanges (1) 7
Render Body 0
Render Sidebar 6