LabiVila Posted July 15, 2015 Share Posted July 15, 2015 local x,y = guiGetScreenSize () local px = y * 1.02 local py = y * 0.725 local h = y * 0.225 addEventHandler ("onClientRender", root, function (source) local pVehicle = getPedOccupiedVehicle (localPlayer) if pVehicle then local vHealth = (getElementHealth (pVehicle)-250)/10 if vHealth < 5 then dxDrawImage(px, py, h, h, "img_radar.png", 0, 0, 0, tocolor (255, 0, 0, 255)) elseif vHealth < 0 then vHealth = 0 end dxDrawText (vHealth, x/3, y/3, x, y, tocolor (255, 255, 255)) local exVHealth = 255 - vHealth*3+25 if exVHealth < 0 then exVHealth = 0 end dxDrawImage(px, py, h, h, "img_radar.png", 0, 0, 0, tocolor (0+exVHealth, 1*vHealth*3+25, 0, 255)) end end ) Hey, it works fine but after the color is full red (car's HP is 0), if I keep hitting objects, the color will start getting green... how can I prevent this? Link to comment
Gr0x Posted July 15, 2015 Share Posted July 15, 2015 dxDrawImage(px, py, h, h, "img_radar.png", 0, 0, 0, tocolor (math.min(exVHealth,255), math.min(vHealth*3+25,255), 0, 255)) 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