Jump to content

[QUESTION] Vehicle health


Lachuks

Recommended Posts

Hello, there!

I'm up to make a speedometer but found some kind of problem. When vehicle is on ~25% it starts flaming and blowing up. How to make veh flaming when it's on 0%?

Code

 

local car = getPedOccupiedVehicle ( getLocalPlayer() )
local carhp = math.floor(getElementHealth(car)/10)
dxDrawRectangle(screenW * 0.7760, screenH * 0.8796, screenW * 0.1083/100*carhp, screenH * 0.0278, tocolor(171, 100, 17, 207), false)

Image

 

4hXwMh7.jpg

Edited by Emix
Link to comment

try this

i'm using my phone i didn't test it

 
local car = getPedOccupiedVehicle ( getLocalPlayer() )
local carfullhp = math.floor(getElementHealth(car)/10)
local carhp = carfullhp - 25
dxDrawRectangle(screenW * 0.7760, screenH * 0.8796, screenW * 0.1083/100*carhp, screenH * 0.0278, tocolor(171, 100, 17, 207), false)

 

  • Haha 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...