UnG//Macaus Posted September 27, 2014 Share Posted September 27, 2014 I use this on my HUD, but is from the top down. I wanted it to be from the bottom up, does anyone know how to do this? local screenW,screenH = guiGetScreenSize() local resW,resH = 1280,720 local sW,sH = (screenW/resW), (screenH/resH) local Health = getElementHealth (localPlayer) dxDrawRectangle(40*sW, 559.2*sH, 11*sW, 138*sH, tocolor(0, 0, 0, 80), false, false) dxDrawRectangle(40*sW, 559.2*sH, 11*sW, 138*sH/100*Health, tocolor(0, 255, 0, 240), false, false) Link to comment
Castillo Posted September 27, 2014 Share Posted September 27, 2014 Just change the X and Y position ( first two arguments at dxDrawRectangle ). Link to comment
UnG//Macaus Posted September 27, 2014 Author Share Posted September 27, 2014 I do not quite understand What do I have to do, what do the first X have to do with it? The normal is thus appear I need you to stay that way Link to comment
DNL291 Posted September 28, 2014 Share Posted September 28, 2014 Try this: local screenW,screenH = guiGetScreenSize() local resW,resH = 1280,720 local sW,sH = (screenW/resW), (screenH/resH) local maxHealth = getPedMaxHealth(localPlayer) local Health = getElementHealth (localPlayer) local maxH = 138 local barY = 559.2 * sH local barHeight = ((maxH * sH) /maxHealth) * Health dxDrawRectangle(40*sW, barY, 11*sW, maxH*sH, tocolor(0, 0, 0, 80)) dxDrawRectangle(40*sW, barY + (maxH-barHeight), 11*sW, barHeight, tocolor(0, 255, 0, 240)) -- function getPedMaxHealth(ped) -- Output an error and stop executing the function if the argument is not valid assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ 'getPedMaxHealth' [Expected ped/player at argument 1, got " .. tostring(ped) .. "]") -- Grab his player health stat. local stat = getPedStat(ped, 24) -- Do a linear interpolation to get how many health a ped can have. -- Assumes: 100 health = 569 stat, 200 health = 1000 stat. local maxhealth = 100 + (stat - 569) / 4.31 -- Return the max health. Make sure it can't be below 1 return math.max(1, maxhealth) end Link to comment
UnG//Macaus Posted September 28, 2014 Author Share Posted September 28, 2014 Works perfectly, thank you very much 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