LabiVila Posted August 9, 2014 Share Posted August 9, 2014 local x,y = guiGetScreenSize () addEventHandler ("onClientRender", root, function (source) local pVehicle = getPedOccupiedVehicle (localPlayer) if pVehicle then local vHealth = (getElementHealth (pVehicle)-250)/10 dxDrawLine (x/1.05, y/2.1, x/1.05, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.125, y/2.1, x/1.125, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.05, y/2.1, x/1.125, y/2.1, tocolor (255, 255, 255)) -- VER dxDrawLine (x/1.05, y/3.5, x/1.125, y/3.5, tocolor (255, 255, 255)) -- VER dxDrawRectangle (x/1.124, y/2.1,x/15.795, y/-3.97*vHealth/100, tocolor (0, 255, 0, 200)) -- GREEN ARENA end end ) Here is my full script, it actually works cool but after it reaches 0, which means the Green Arena dissapears, if the car still gets damage, the green arena starts going down and down. I want to make like a border, here are some screens for better explanation: cool = http://www.upload.ee/image/4200435/gta_ ... -34-19.png not cool = http://www.upload.ee/image/4200436/gta_ ... -48-21.png Link to comment
Stranger Posted August 10, 2014 Share Posted August 10, 2014 try this: local x,y = guiGetScreenSize () addEventHandler ("onClientRender", root, function (source) local pVehicle = getPedOccupiedVehicle (localPlayer) if pVehicle then local vHealth = (getElementHealth (pVehicle)-250)/10 if vHealth >= 0 then dxDrawLine (x/1.05, y/2.1, x/1.05, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.125, y/2.1, x/1.125, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.05, y/2.1, x/1.125, y/2.1, tocolor (255, 255, 255)) -- VER dxDrawLine (x/1.05, y/3.5, x/1.125, y/3.5, tocolor (255, 255, 255)) -- VER dxDrawRectangle (x/1.124, y/2.1,x/15.795, y/-3.97*vHealth/100, tocolor (0, 255, 0, 200)) -- GREEN ARENA end end end ) Link to comment
Et-win Posted August 10, 2014 Share Posted August 10, 2014 That will stop the drawing. Try this: local x,y = guiGetScreenSize () addEventHandler ("onClientRender", root, function (source) local pVehicle = getPedOccupiedVehicle (localPlayer) if pVehicle then local vHealth = (getElementHealth (pVehicle)-250)/10 if vHealth < 0 then vHealth = 0 end dxDrawLine (x/1.05, y/2.1, x/1.05, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.125, y/2.1, x/1.125, y/4, tocolor (255, 255, 255)) -- HOR dxDrawLine (x/1.05, y/2.1, x/1.125, y/2.1, tocolor (255, 255, 255)) -- VER dxDrawLine (x/1.05, y/3.5, x/1.125, y/3.5, tocolor (255, 255, 255)) -- VER dxDrawRectangle (x/1.124, y/2.1,x/15.795, y/-3.97*vHealth/100, tocolor (0, 255, 0, 200)) -- GREEN ARENA end end ) Link to comment
LabiVila Posted August 10, 2014 Author Share Posted August 10, 2014 Both work great but Stranger, the code you helped me with disappears the health bar once I have my HP 0. And as for you Et-Win, it works amazingly great. Thank you so much both 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