Jump to content

Progress bar in circle


Emilio_M

Recommended Posts

  • Replies 68
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

100hp:

NLt8u.jpg

50hp:

IhGod.jpg

1hp:

KZYPR.jpg

Here is the code

local screenX, screenY = guiGetScreenSize ( ); 
local maxAngle = 180; 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local hp = getElementHealth ( localPlayer ) * ( maxAngle / 100 ); 
        dxDrawCircle ( ( screenX - 50 ) / 2, ( screenY - 50 ) / 2, 50, 5, 1, 0, hp, tocolor ( 255, 0, 0, 255 ), false ); 
    end 
); 

Link to comment
100hp:

NLt8u.jpg

50hp:

IhGod.jpg

1hp:

KZYPR.jpg

Here is the code

local screenX, screenY = guiGetScreenSize ( ); 
local maxAngle = 180; 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local hp = getElementHealth ( localPlayer ) * ( maxAngle / 100 ); 
        dxDrawCircle ( ( screenX - 50 ) / 2, ( screenY - 50 ) / 2, 50, 5, 1, 0, hp, tocolor ( 255, 0, 0, 255 ), false ); 
    end 
); 

Thanks but I doesnt want a half-circle. Test with 0-41° for 100 HP ans see the result.

Link to comment
local screenX, screenY = guiGetScreenSize ( ); 
local maxAngle = 180; 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local hp = getElementHealth ( localPlayer ) * ( maxAngle / 100 ); 
        dxDrawCircle ( ( screenX - 50 ) / 2, ( screenY - 50 ) / 2, 50, 5, 1, 0, hp, tocolor ( 255, 0, 0, 255 ), false ); 
    end 
); 

where is the getPedStat, 24; to health in 200% ???? :?

Link to comment

added, all resolutions, and added getPedStat to health in 200%

  
local screenW,screenH = guiGetScreenSize() 
local resW, resH = 1280, 720 
local x, y =  (screenW/resW), (screenH/resH) 
local maxAngle = 180 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local stat = getPedStat ( getLocalPlayer(), 24 ) 
        local hp = getElementHealth ( localPlayer ) * ( maxAngle / 100 ) 
if stat < 1000 then 
        dxDrawCircle ( ( x - 50 ) / 2, ( y - 50 ) / 2, 50, 5, 1, 0, hp, tocolor ( 255, 0, 0, 255 ), false ) 
else 
        dxDrawCircle ( ( x - 50 ) / 2, ( y - 50 ) / 2, 50, 5, 1, 0, hp, tocolor ( 255, 0, 0, 255 ), false ) 
end 
    end) 

Link to comment

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