Garry's Mod Wiki

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 is currently has equipped.

Example

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

print(Entity( 1 ):GetActiveWeapon():GetClass())
Output: The active weapon's class. For example, if you are holding the tool gun then this will be "gmod_tool".

Page Links


Special Pages


Wikis

?

Render Time: 30ms

DB GetPage 4
Generate Html 3
SaveChanges (1) 8
Render Body 0
Render Sidebar 12