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

Posted

There is an awesome way to do circular progress bars without any frame drops.

Try shaders.

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast
Posted

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 
); 

Posted

Try WhoAmI's code, It works clearly fine

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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

Posted

If you want it to be a full circle, then it has to be max angle 360, not 180 ( half circle ).

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
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% ???? :?

 DUyJ810.gif

Posted

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) 

 DUyJ810.gif

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