WEAPON:TakeSecondaryAmmo

From Garry's Mod
Jump to: navigation, search
 WEAPON:TakeSecondaryAmmo( )

Contents

Description

A convenience function to remove secondary ammo from clip.

Arguments

number amount

How much of secondary ammo to remove

Examples

Example

As defined in weapon_base

function SWEP:TakeSecondaryAmmo( num )
	
	-- Doesn't use clips
	if ( self.Weapon:Clip2() <= 0 ) then 
	
		if ( self:Ammo2() <= 0 ) then return end
		
		self.Owner:RemoveAmmo( num, self.Weapon:GetSecondaryAmmoType() )
	
	return end
	
	self.Weapon:SetClip2( self.Weapon:Clip2() - num )	
	
end


Personal tools
Navigation