SWEP.TakePrimaryAmmo
From GMod Wiki
Revision as of 18:20, 7 June 2010 by Crazy Quebecer (Talk | contribs)
Event Hook | |
Hook Name | TakePrimaryAmmo |
Syntax | SWEP:TakePrimaryAmmo( Integer num ) |
Description | Takes desired ammo from player's primary ammo. |
Returns | Nil |
Lua State | |
BBCode | [b][url=wiki.garrysmod.com/?title=SWEP.TakePrimaryAmmo]SWEP.TakePrimaryAmmo [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:TakePrimaryAmmo( num ) // Doesn't use clips if ( self:Clip1() <= 0 ) then if ( self:Ammo1() <= 0 ) then return end self.Owner:RemoveAmmo( num, self:GetPrimaryAmmoType() ) return end self:SetClip1( self:Clip1() - 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:TakePrimaryAmmo()