General > Developers Corner

Hud?

(1/2) > >>

Mindless:
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4ac3.html

I was following this example, but it doesn't work in DarkRP. I want the armour to show aswell but I dont know how?

nathan736:
what i googled "garrys mod get armor"
what i got
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexe5e4.html

--- Code: ---function DrawPlayerArmor()
          if (LocalPlayer():Armor() > 0) then
             draw.RoundedBox( 8, 32, 16, ScrW() - 64, 16, Color(200, 200, 200, 200))
             draw.RoundedBox( 8, 34, 18, (ScrW() - 68)*(LocalPlayer():Armor() / 1000), 12, Color(0, 0, 200, 200))
          end
end
hook.Add("HUDPaint","drawplayerarmor",DrawPlayerArmor)
--- End code ---
this should work might not (at school can not test) hope i helped !
ps: THIS MIGHT ERROR IF RAN SERVER SIDE

Bite That Apple:

--- Quote from: nathan736 on February 11, 2013, 09:51:12 AM ---what i googled "garrys mod get armor"
what i got
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexe5e4.html

--- Code: ---function DrawPlayerArmor()
          if (LocalPlayer():Armor() > 0) then
             draw.RoundedBox( 8, 32, 16, ScrW() - 64, 16, Color(200, 200, 200, 200))
             draw.RoundedBox( 8, 34, 18, (ScrW() - 68)*(LocalPlayer():Armor() / 1000), 12, Color(0, 0, 200, 200))
          end
end
hook.Add("HUDPaint","drawplayerarmor",DrawPlayerArmor)
--- End code ---
this should work might not (at school can not test) hope i helped !
ps: THIS MIGHT ERROR IF RAN SERVER SIDE

--- End quote ---

I believe that can be used serverside, seeing as on that website it say's Blue/Orange, which I would assume it means Client/Server or shared.

Mindless:
The armour doesn't appear on the hud, neither does the name.

nathan736:
but does it error You need armor for it to show.
the name SHOULD NOT SHOW UP because its not coded xD

Navigation

[0] Message Index

[#] Next page

Go to full version