Jump to content

[HELP] Health + Extra Health


Lalalu

Recommended Posts

Hello, I want to know how can I put on the same bar normal health and extra health, normal health is 100 but extra health increase constantly by levels, how can i adapt a bar for both health? that looks full and adapts to the extra health

Edited by Lalalu
Link to comment
hii, try this:
 
Quote

 

local health = tonumber(math.floor(getElementHealth(player))) -- #get player Health
local maxH = 100 -- #max health bar value

 

-- #limits health to maxH
health = math.min(health, maxH)

 

-- #sets the width of the health bar
local barWidth = (screenW * 0.070) * (health / maxH)

 

dxDrawRectangle(screenW*0.0370, screenH*0.300, screenW*0.070, screenH*0.032, tocolor(0, 0, 0, 50)) -- #health bar bg
dxDrawRectangle(screenW*0.0370, screenH*0.300, barWidth, screenH*0.032, tocolor(200, 0, 0, 200)) -- #health bar

 

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...