Garry's Mod Wiki

Revision Difference

WEAPON:GetCapabilities#563016

<function name="GetCapabilities" parent="WEAPON" type="hook"> <description>This hook is for NPCs, you return what they should try to do with it.</description>⤶ <description>This hook is for NPCs, you return what they should try to do with it. <warning>Calling <page>NPC:CapabilitiesGet</page> in this hook on the same entity can cause infinite loops since that function adds the result of <page>WEAPON:GetCapabilities</page> on top of the return value. </warning>⤶ </description>⤶ ⤶ <realm>Server</realm> <rets> <ret name="" type="number">A number defining what NPC should do with the weapon. Use the <page>Enums/CAP</page>.</ret> </rets> </function> <example> <description>As defined in weapon_base</description> <code> function SWEP:GetCapabilities() return bit.bor( CAP_WEAPON_RANGE_ATTACK1, CAP_INNATE_RANGE_ATTACK1 ) end </code> </example>