Garry's Mod Wiki

Player:HasWeapon

  boolean Player:HasWeapon( string className )

Description

Returns if the player has the specified weapon

Arguments

1 string className
Class name of the weapon

Returns

1 boolean
True if the player has the weapon

Example

prints if the player has the physgun

print( Entity( 1 ):HasWeapon( "weapon_physgun" ) )
Output: "true" in console, if player 1 has Physics Gun.