Jump to content

Healthlul's


qaisjp

Recommended Posts

mta-screen_2011-07-22_13-53-39.png

In this screenshot and I know I have 3 different nametags, but I was just testing. As you see in the normal nametag, the health bar changes color according to the amount of health, i would like the other one to be the same way too.

I know i have to edit a few lines just to get the color, but how can I make it "faded" not alpha fade, color faded. Do you get what I mean :S

I have to do some mathematical shit to achieve this, right?

Link to comment

first plan the colors u want for different health ranges

hp = rgb

100 = 0 255 0 (green)

50 = 255 255 0 (yellow)

0 = 255 0 0 (red)

then u can try something like

function getHealthColour(Health) 
    if Health >= 50 then 
        return math.ceil((((Health / 50) - 1) * 255)), 255, 0 
    else 
        return 255, math.ceil((Health / 50) * 255), 0 
    end 
end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...