Lalalu Posted September 9, 2023 Share Posted September 9, 2023 (edited) 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 September 9, 2023 by Lalalu Link to comment
reddscr Posted September 11, 2023 Share Posted September 11, 2023 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
alex17" Posted September 11, 2023 Share Posted September 11, 2023 local maxHealth = getElementData(localPlayer, "maxhealth") or 100 local health = getElementHealth(localPlayer) local percent = health / maxHealth dxDrawRectangle(x, y, w * percent, h, ...) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now