My primary clip is showing, but my secondary ammo is frozen for some reason at 59.
I've tried all sorts but to no avail, could someone please offer their assistance?
Ammo display function:
local function Ammo()
local client = LocalPlayer()
if not client:Alive() then return end
if (client:GetActiveWeapon() == NULL or client:GetActiveWeapon() == "Camera" or client:GetActiveWeapon() == "Keys" or client:GetActiveWeapon() == "Pocket") then return end
if !client:GetActiveWeapon():IsValid() then return end
if client:GetActiveWeapon():IsValid() then
if client:GetActiveWeapon():Clip1() ~= -1 then
local mag_current = client:GetActiveWeapon():Clip1() -- How much ammunition you have inside the current magazine
local mag_extra = client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType())
draw.SimpleText(client:GetActiveWeapon():Clip1() .. "","AmmoNum", ScrW() - 195,ScrH() - 155, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText("/","AmmoNum", ScrW() - 110,ScrH() - 170, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(client:GetActiveWeapon():GetPrimaryAmmoType() .. "","SecondaryAmmoNum", ScrW() - 75,ScrH() - 165, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
end
end
end
I think you mean client:GetActiveWeapon():Clip2() instead of client:GetActiveWeapon():GetPrimaryAmmoType()
I changed it to Clip2, and now it's merely stuck at -1
Then your weapon has no secondary ammo, unless it does not use a clip, in which you can use client:GetAmmoCount( client:GetActiveWeapon():GetSecondaryAmmoType() )
I'm using both the default half life 2 weapons and CW2.0 weapons, and all of them just have a frozen value. Now i've changed it to the secondary ammo type again it's gone to being frozen at 0, but it's still frozen. I'm absolutely stumped.. Hmm
Are you sure there's secondary ammo? The SMG and AR2's secondary ammo should be accurately reflected by the code I posted.
ah i'm an idiot. So that displays that sort've stuff, but how do I display how many clips I have left in total? I.E, I have a 30 round magazine, I want to also display after a slash how much I have left in reserves.
Yup, nevermind. I fixed it... Or, well. Fixed myself after a good night's sleep, I was being an idiot. Cheers anyway
Sorry, you need to Log In to post a reply to this thread.