NPC.GetActiveWeapon

From GMod Wiki

Jump to: navigation, search
Function
Syntax NPC:GetActiveWeapon( )
Description:
Returns the NPC's active weapon.
Returns: Weapon
In Object: Npc
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=NPC.GetActiveWeapon]NPC.GetActiveWeapon [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionRemoves the NPC's active weapon.
Used onNewerServer.png
Code
local weapon = npc:GetActiveWeapon()
 
if ValidEntity( weapon ) then
	weapon:Remove()
 
	print( "Active weapon removed." )
end
Output"Active weapon removed." if a valid weapon was returned.


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox