ULX

Author Topic: Hud?  (Read 2608 times)

0 Members and 1 Guest are viewing this topic.

Offline Mindless

  • Newbie
  • *
  • Posts: 31
  • Karma: 1
Hud?
« on: February 11, 2013, 03:01:48 AM »
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?

Offline nathan736

  • Full Member
  • ***
  • Posts: 143
  • Karma: 4
Re: Hud?
« Reply #1 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: [Select]
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)
this should work might not (at school can not test) hope i helped !
ps: THIS MIGHT ERROR IF RAN SERVER SIDE
a person asked me how to code lua and i said this " its like building a rocket up side down then  realizing you did it all wrong."

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Hud?
« Reply #2 on: February 12, 2013, 01:13:39 AM »
what i googled "garrys mod get armor"
what i got
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexe5e4.html
Code: [Select]
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)
this should work might not (at school can not test) hope i helped !
ps: THIS MIGHT ERROR IF RAN SERVER SIDE

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.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Mindless

  • Newbie
  • *
  • Posts: 31
  • Karma: 1
Re: Hud?
« Reply #3 on: February 12, 2013, 03:34:48 PM »
The armour doesn't appear on the hud, neither does the name.

Offline nathan736

  • Full Member
  • ***
  • Posts: 143
  • Karma: 4
Re: Hud?
« Reply #4 on: February 15, 2013, 07:53:04 AM »
but does it error You need armor for it to show.
the name SHOULD NOT SHOW UP because its not coded xD
a person asked me how to code lua and i said this " its like building a rocket up side down then  realizing you did it all wrong."

Offline Mindless

  • Newbie
  • *
  • Posts: 31
  • Karma: 1
Re: Hud?
« Reply #5 on: February 15, 2013, 10:59:44 AM »
Nevermind, got one done.