Garry's Mod Wiki

Garry's Mod Wiki

  Weapon Player:GetActiveWeapon()

Description

Returns the player's active weapon.

If used on a LocalPlayer() and the player is spectating another player with OBS_MODE_IN_EYE, the weapon returned will be of the spectated player.

Returns

1 Weapon
The weapon the player currently has equipped or NULL if the player doesn't have an active weapon eg. when they're dead.

Example

Prints the player's active weapon's class name.

Output: The active weapon's class. For example, if you are holding the tool gun then this will be "gmod_tool".

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...