#Paper Posted April 2, 2011 Share Posted April 2, 2011 How i can set the progress of a progressbar proportional the vehicle's healt? Link to comment
proracer Posted April 2, 2011 Share Posted April 2, 2011 There is already default resource: "race" and in there file called: "fancyprogress.lua" - there you can find it. Also the nametags.lua has it too. Link to comment
#Paper Posted April 2, 2011 Author Share Posted April 2, 2011 In the nametags.lua i saw the code for the healt, is it the same thing? But i didn't see the fancyprogress.lua Link to comment
Castillo Posted April 2, 2011 Share Posted April 2, 2011 (edited) addEventHandler("onClientRender",getRootElement(), function () if ( somebar ) then local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then health = getElementHealth(veh)/100*10 guiProgressBarSetProgress(somebar, health) end end end) It should work. Edited April 3, 2011 by Guest Link to comment
#Paper Posted April 3, 2011 Author Share Posted April 3, 2011 addEventHandler("onClientRender",getRootElement(), function () if ( somebar ) then local veh = getPedOccupiedVehicle(getLocalPlayer() if veh then health = math.floor(getElementHealth(veh)) guiProgressBarSetProgress(somebar, health) end end end) It should work. No, it doesn't work, and doesn't show any error... P.S: You forgot a ')' to close getPedOccupiedVehicle, i added it Link to comment
Castillo Posted April 3, 2011 Share Posted April 3, 2011 Do you have the progress bar someBar? And btw, i know i had a missing ')' but i wanted you to fix it, i was a bit hurry. Link to comment
#Paper Posted April 3, 2011 Author Share Posted April 3, 2011 Yes, i modified somebar whit my bar, but nothing... T_T Link to comment
Castillo Posted April 3, 2011 Share Posted April 3, 2011 I will try it later, right now i'am busy. Link to comment
Castillo Posted April 3, 2011 Share Posted April 3, 2011 Ok, i have changed the code, try it now. 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