SWEP.CanSecondaryAttack
From GMod Wiki
Revision as of 18:22, 7 June 2010 by Crazy Quebecer (Talk | contribs)
Event Hook | |
Hook Name | CanSecondaryAttack |
Syntax | SWEP:CanSecondaryAttack( ) |
Description | Checks whether the clip is empty(or the owner's ammo if it is a clipless weapon) and ticks if not |
Returns | Boolean |
Lua State | |
BBCode | [b][url=wiki.garrysmod.com/?title=SWEP.CanSecondaryAttack]SWEP.CanSecondaryAttack [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Definition of the function
Because it is a convenience function, it is defined by the game. (Source Code)
function SWEP:CanSecondaryAttack() if ( self:Clip2() <= 0 ) then self:EmitSound( "Weapon_Pistol.Empty" ) self:SetNextSecondaryFire( CurTime() + 0.2 ) return false end return true end
Examples
Description | N/A | ||
---|---|---|---|
Used on | |||
Code |
| ||
Output | N/A |
Additiona Notes
- You can override it to specify your own conditions.
- To use it as such simply call self:CanSecondaryAttack()