Jump to content

Health bar


-.Paradox.-

Recommended Posts

Posted (edited)

Hello, i want to create a dxRectangle and show in it the player health here is my code i got a error in debugscript 3

WARNING: Hud/hud.lua:65: Bad argument @ 'dxDrawRectangle' [Expected bool at argument 6, got number '-16745728']

        dxDrawRectangle(1107, 54, 211, 13, tocolor(0, 0, 0, 255), true) 
        dxDrawRectangle(" "..phealth.." ",1108, 55, 209, 11, tocolor(255, 0, 0, 255), true) 
  

Edited by Guest
Posted

I think there no need to use math for getting health just use getElementHealth (localPlayer) then it start work fine if tell me ill make u that

Posted

I'm pretty sure this is all your wanted?

local pHealth = getElementHealth(localPlayer) 
if pHealth > 100 then 
    pHealth = pHealth / 2 
end 
  
dxDrawRectangle(1107, 54, 211, 13, tocolor(0, 0, 0, 255), true) 
dxDrawRectangle(1108, 55, 209*(pHealth/100), 11, tocolor(255, 0, 0, 255), true) 

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