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

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) 

Do you even check what you post? don't you see that both dxDrawCircle have the same arguments? and that "stat" is not being used anywhere but in that useless "if" statement?

Link to comment
Do you even check what you post? don't you see that both dxDrawCircle have the same arguments? and that "stat" is not being used anywhere but in that useless "if" statement?

he just use his calculations, I forever using this. and always I had success

local stat = getPedStat (  getLocalPlayer(), 24 ) 
if stat < 1000 then 
dx.... 
else 
dx.... 
end 
  

Link to comment
Do you even check what you post? don't you see that both dxDrawCircle have the same arguments? and that "stat" is not being used anywhere but in that useless "if" statement?

he just use his calculations, I forever using this. and always I had success

local stat = getPedStat (  getLocalPlayer(), 24 ) 
if stat < 1000 then 
dx.... 
else 
dx.... 
end 
  

So, your solution is to make a useless check, to draw the same thing no matter what "stat" is returning?

You really should avoid posting if you don't know how to help, since you're only confusing the person who asked for help.

Link to comment
local hpMin = 176 
local hpMax = 135 
local hpRate = hpMin-hpMax 
local hp = hpMin-((getElementHealth(getLocalPlayer())*hpRate)/100) 
dxDrawCircle( 220,796,113, 16,1,134,226,tocolor(0,0,0,255)) -- black bar background 
dxDrawCircle( 220,796,110, 15,1,hp,hpMin,tocolor(255,0,0,255)) -- red bar ( HP ) 

Link to comment

Have you tried to use WhoAmI's 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 
); 

If you want it to be a full circle, change this variable:

local maxAngle = 180; 

to 360 instead of 180.

Link to comment
local hpMin = 225 
local hpMax = 135 
local hpRate = ( ( hpMin - hpMax ) / 100 ) 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local hp = ( hpMin - ( getElementHealth ( localPlayer ) * hpRate ) ) 
        dxDrawCircle ( 220, 796, 113, 16, 1, 134, 226, tocolor ( 0, 0, 0, 255 ) ) -- black bar background 
        dxDrawCircle ( 220, 796, 112, 12, 1, hp, hpMin, tocolor ( 255, 0, 0, 255 ) ) -- red bar ( HP ) 
    end 
) 

Is that what you want?

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