WEAPON:CustomAmmoDisplay

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

Contents

Description

Allows you to use any numbers you want for the ammo display on the HUD.

Can be useful for weapons that don't use standard ammo.

Returns

table

The new ammo display settings.

Examples

Example

How it would look with standard information

function SWEP:CustomAmmoDisplay()
	self.AmmoDisplay = self.AmmoDisplay or {} 
 
	self.AmmoDisplay.Draw = true //draw the display?
 
	if self.Primary.ClipSize > 0 then
		self.AmmoDisplay.PrimaryClip = self:Clip1() //amount in clip
		self.AmmoDisplay.PrimaryAmmo = self:Ammo1() //amount in reserve
	end
	if self.Secondary.ClipSize > 0 then
		self.AmmoDisplay.SecondaryClip = self:Clip2()
		self.AmmoDisplay.SecondaryAmmo = self:Ammo2()
	end
 
	return self.AmmoDisplay //return the table
end


Personal tools
Navigation