Jump to content

Need Help!!


UnG//Macaus

Recommended Posts

Posted

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) 

:|

Macaus ~ / Ravel Pires / Macaus

Posted

Just change the X and Y position ( first two arguments at dxDrawRectangle ).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

ezimba18742022575604.png

I need you to stay that way

ezimba18742073001304.png

Macaus ~ / Ravel Pires / Macaus

Posted

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 

Please do not PM me with scripting related question nor support, use the forums instead.

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