SWEP.TakeSecondaryAmmo
From GMod Wiki
Event Hook | |
Hook Name | TakeSecondaryAmmo |
Syntax | SWEP:TakeSecondaryAmmo( Integer num ) |
Description | Takes desired ammo from player's secondary ammo. |
Returns | Nil |
Lua State | |
BBCode | [b][url=wiki.garrysmod.com/?title=SWEP.TakeSecondaryAmmo]SWEP.TakeSecondaryAmmo [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.
function SWEP:TakeSecondaryAmmo( num ) // Doesn't use clips if ( self:Clip2() <= 0 ) then if ( self:Ammo2() <= 0 ) then return end self.Owner:RemoveAmmo( num, self:GetSecondaryAmmoType() ) return end self:SetClip2( self:Clip2() - num ) 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:TakeSecondaryAmmo()