Armor Problem

So I have this weird problem with armor on a hud I made.

If a player has 500 armor, on the hud it will show something random like 114 or something. Then when the player loses that 114 armor, it shows the rest of the player’s armor.

I’m not sure what’s wrong, but I’m pretty sure it’s a bug in Gmod because I’ve asked other people and they found this happening also. Does anyone know how to fix this?

[editline]14th December 2011[/editline]

This happens when the player has more than 255 armor I believe

AFAIK, that function works as its supposed too and returns the correct value, thus something is wrong in your HUD. If I am wrong though you should post it in the Niggle Mega-Thread.

It’s a HUD problem entirely, yeah. You get as much armor as you should for real, but even the default HUD displays it wrong.

Odd, it works for me…

[editline]15th December 2011[/editline]

It seems to be the maximum is in base 8 (?) depending on how much memory is allocated to the program, for example, my maximum is at 32768 … er but I guess if your maximum is 225 then my assumption is void.

On the default HUD, it displays correctly. I don’t see why it doesn’t work for me.

I use pl:SetArmor(500) to set the players armor. They get the correct armor amount, but the hud won’t show more than 255.

I use LocalPlayer():Armor() to show armor on my hud.

I am fairly sure Player.Armor returns an unsigned char but because the HUD can show it more then 225 so it isn’t actually stored as an unsigned char, that’s just how its returned, thus it should be accessible via a binary module/player key value. You should post this in niggles.

Yeah I did already.