Garry's Mod Wiki

WEAPON:TakePrimaryAmmo

  WEAPON:TakePrimaryAmmo( number amount )

Description

A convenience function to remove primary ammo from clip.

Arguments

1 number amount
Amount of primary ammo to remove

Example

As defined in weapon_base

function SWEP:TakePrimaryAmmo( num ) -- Doesn't use clips if ( self.Weapon:Clip1() <= 0 ) then if ( self:Ammo1() <= 0 ) then return end self:GetOwner():RemoveAmmo( num, self.Weapon:GetPrimaryAmmoType() ) return end self.Weapon:SetClip1( self.Weapon:Clip1() - num ) end