I did like this
ht = 0
r,g,b = 200,200,200
local sx_, sy_ = guiGetScreenSize()
local sx, sy = sx_/1024, sy_/768
addEventHandler("onClientRender", root,
function()
getElementHealth(ped)
DXDrawBorderedRectangle(322*sx, 686*sy, 379*sx/100*ht, 27*sy, tocolor(200, 0, 0, 200), false) --- DAMAGE
dxDrawImage(322*sx, 686*sy, 379*sx/100*75, 27*sy, "files/health.png", 0, 0, 0, tocolor(255, 255, 255, 30), false)
dxDrawRectangle(322*sx, 686*sy, 379*sx/100*getElementHealth(localPlayer), 27*sy, tocolor(r,g,b, 255), false)
if getElementHealth(localPlayer) <= 30 then
r,g,b = 200,0,0
else
r,g,b = 200,200,200
end
end
end
)