• HUD Ammo Counter
    2 replies, posted
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... [code] 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()) [/code] 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 [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/Structures/SWEP"]SWEP Structure[/URL] and do: [code] local wep = client:GetActiveWeapon() local ammo_in_clip = wep:Clip1() local clip_size = wep.Primary.ClipSize local ammo_left = client:GetAmmoCount(wep:GetPrimaryAmmoType()) [/code]
And if it's not[QUOTE=AK to Spray;47668905]scripted (i.e. not a default HL2 weapon)[/QUOTE] just hardcode the HL2 weapon values.
Sorry, you need to Log In to post a reply to this thread.