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.

Example

Prints the weapon if the player has the toolgun

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