[XGN]Razor Posted February 6, 2016 Share Posted February 6, 2016 Anyone knows how i can to do a progress bar with an dxDrawImage and dxDrawImageSection? Link to comment
Tomas Posted February 6, 2016 Share Posted February 6, 2016 Here you go an example, it's using dx rectangles but the algorithm is the same https://github.com/ChicoRDL/-GTi-RPG-V3 ... t.lua#L135 Link to comment
[XGN]Razor Posted February 7, 2016 Author Share Posted February 7, 2016 Im doing right now a bar and i have this problem: when the health is 100% works perfectly, but when the health is < 100, like 50 or 25, goes to the left side, this is the code: addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), function() sx,sy = guiGetScreenSize () healthx = sx/800*5 healthy = sy/600*500 healthxoverlay = sx/800*6.55 healthyoverlay = sy/600*502 showPlayerHudComponent ("health",false) counter = 0 normalhealthbar = false end) function render() if (counter == 50) then counter = 0 end local healthRelative = getElementHealth(getLocalPlayer())/100 dxDrawImage (healthx, healthy, 150, 20, "hpempty.png",90) dxDrawImageSection (healthxoverlay, healthyoverlay, 145*healthRelative, 13,0,0,healthxoverlay,healthyoverlay,"hpfull.png",90) if (isPedInVehicle (getLocalPlayer())) then local healthRelative = getElementHealth(getPedOccupiedVehicle(getLocalPlayer()))/1000 dxDrawImage (vehiclehealthx, vehiclehealthy, 76, 12, "hpempty.png") end end addEventHandler ("onClientRender",getRootElement(),render) where is the problem? 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