Garry's Mod Wiki


  table WEAPON:CustomAmmoDisplay()


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.


1 table
The new ammo display settings. A table with 4 possible keys:
  • boolean Draw - Whether to draw the ammo display or not
  • number PrimaryClip - Amount of primary ammo in the clip
  • number PrimaryAmmo - Amount of primary ammo in the reserves
  • number SecondaryAmmo - Amount of secondary ammo. It is shown like alt-fire for SMG1 and AR2 are shown.

There is no SecondaryClip!


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.SecondaryAmmo = self:Ammo2() // amount of secondary ammo end return self.AmmoDisplay //return the table end