HUD Ammo Counter

Hey, I’m trying to get the Ammo max for that shot, like example: Bullets in mag(60)/Bullets can hold(60) i shoot one it goes to 59/60. And stays there, and i’m looking at 59/(60)<-- That…
I tried…

mag_in_clip = client:GetActiveWeapon():Clip1()
special_clip = client:GetActiveWeapon():Clip2()
clip_size = client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType())
ammo_left = client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType())

They all just freeze up at 0 or -1 or goto how many bullets i have picked up… which is really annoying…
Whats the fix for this?

Assuming that your weapon is scripted (i.e. not a default HL2 weapon) you can consult the

SWEP Structure and do:

local wep = client:GetActiveWeapon()
local ammo_in_clip = wep:Clip1()
local clip_size = wep.Primary.ClipSize
local ammo_left = client:GetAmmoCount(wep:GetPrimaryAmmoType())

And if it’s not

just hardcode the HL2 weapon values.