#RooTs Posted March 31, 2015 Share Posted March 31, 2015 It reduce the width of the circle. sorry, I tried to help Link to comment
Emilio_M Posted March 31, 2015 Author Share Posted March 31, 2015 So, i thinks dxDrawCircle is not a good solution. I look some script like this : viewtopic.php?f=108&t=33342 It draw a progress bar with but i dont understand that... Link to comment
-.Paradox.- Posted March 31, 2015 Share Posted March 31, 2015 https://community.multitheftauto.com/in ... ls&id=8550 Take a look on how the author did it by checking functions he used and parameters etc Link to comment
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 https://community.multitheftauto.com/index.php?p=resources&s=details&id=8550Take a look on how the author did it by checking functions he used and parameters etc Thanks but it's always DxDrawCircle. Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 There is no other good way to do that. Link to comment
GTX Posted April 1, 2015 Share Posted April 1, 2015 There is an awesome way to do circular progress bars without any frame drops. Try shaders. Link to comment
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 Do you have some exemples ? I never used shaders. Link to comment
JR10 Posted April 1, 2015 Share Posted April 1, 2015 The community has a lot of examples of shaders. https://wiki.multitheftauto.com/wiki/Shader_examples Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 100hp: 50hp: 1hp: 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
JR10 Posted April 1, 2015 Share Posted April 1, 2015 Or you could use dxDrawImageSection. Link to comment
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 Or you could use dxDrawImageSection. Yeah i thinks it's the solution but i dont have idee how to do that... Link to comment
-.Paradox.- Posted April 1, 2015 Share Posted April 1, 2015 Try WhoAmI's code, It works clearly fine Link to comment
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 100hp: 50hp: 1hp: 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
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 It should work normally. 100 * 41 / 100 = 41° Just change maxAngle to your value. Link to comment
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 No it not work. The proportionality for 1 to 10 HP isnt correct. Change your HP step to step 1-10 an see the bar. Link to comment
Castillo Posted April 1, 2015 Share Posted April 1, 2015 If you want it to be a full circle, then it has to be max angle 360, not 180 ( half circle ). Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 1hp - 0,41° - so it's correct imo. Link to comment
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 Calculations are good but not the draw. Link to comment
#RooTs Posted April 1, 2015 Share Posted April 1, 2015 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
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 It's correct but it's just too small. Link to comment
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 It's correct but it's just too small. Not too small, on the contrary, it's to big. Under 10HP the progress bar doesnt move. Link to comment
WhoAmI Posted April 1, 2015 Share Posted April 1, 2015 It's changing. It's different on 1hp and 10hp. But those changes are small, that's why you can't see them that much. Link to comment
#RooTs Posted April 1, 2015 Share Posted April 1, 2015 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
Emilio_M Posted April 1, 2015 Author Share Posted April 1, 2015 Beacause we see that difference. Link to comment
#RooTs Posted April 1, 2015 Share Posted April 1, 2015 Beacause we see that difference. what? 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