Garry's Mod Wiki

Revision Difference

WEAPON:CanSecondaryAttack#512130

<function name="CanSecondaryAttack" parent="WEAPON" type="hook">⤶ <ishook>yes</ishook>⤶ <description>Helper function for checking for no ammo.</description>⤶ <realm>Shared</realm>⤶ <rets>⤶ <ret name="" type="boolean">Can use secondary attack</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>As defined in weapon_base</description>⤶ <code>⤶ function SWEP:CanSecondaryAttack()⤶ ⤶ if ( self.Weapon:Clip2() &amp;lt;= 0 ) then⤶ ⤶ self.Weapon:EmitSound( "Weapon_Pistol.Empty" )⤶ self.Weapon:SetNextSecondaryFire( CurTime() + 0.2 )⤶ return false⤶ ⤶ end⤶ ⤶ return true⤶ ⤶ end⤶ </code>⤶ ⤶ </example>