How to change the color of the text when there is low health?
2 replies, posted
Hello everyone, I'm doing my HUD for my server. I do not know lua very well and when writing, I had a problem. I would like to make that the color of health changed when I was getting a little health, for example, now it is green, and that by 15% it was red. Who knows how to do this?
Here's the code:
draw.DrawText (lp: Health (), "DermaLarge", 140, 273, Color (0, 255, 0, 255))
if statements and color change?
Heres something to help you out (some untested):
Color((255 * (1 - health / maxhealth)), (255 * (health / maxhealth)), 0)
When you have high health, it should be a bright green, but as you lose health the color should turn red.
Sorry, you need to Log In to post a reply to this thread.