Garry's Mod Wiki

Player:GetWeapon

  Weapon Player:GetWeapon( string className )

Description

Returns the weapon for the specified class

Arguments

1 string className
Class name of weapon

Returns

1 Weapon
The weapon for the specified class, or NULL ENTITY if the player does not have this weapon.

Example

Prints the weapon if the player has the toolgun

print( Entity( 1 ):GetWeapon( "gmod_tool" ) )
Output: Something like "Weapon [77]" in console.