# Fuel condition and the condition of the vehicle.

## Recommended Posts

Hi! I have a problem with my script stations and vehicle condition.

Vehicle starts to burn when the condition of the vehicle is 32%, and the bar is not yet finished. How do I fix this?

I think you've got some wrong calculations

```carHealth = getElementHealth(vehicle)/10;
```

must be

```carHealth = getElementHealth(vehicle)/10 - 10
```

Will return when burning 0.7867876..blabla

but the bar isn't synced then.

Just lol arround with it.

Ehh, now if i create new car, vehicle condition is 90%. Now it burning <14-13%.

I would like to at the entrance to the newly created vehicle, vehicle status was equal to 100%, and that the vehicle was on fire when the state was equal to 0%.

I'm quite perplexing problem. Now, once subtracted from HealthHeight 1.36, and I would like to subtract all the time.

http://pastebin.com/Y8teD8dL

Car health ranges from a little above 1000 to 250, between 250 and 0 the car is burning. To ignore the under 250 part you can use math.max(). So to get it in a percentage:

```carHealth = ( math.max(getElementHealth(vehicle) - 250, 0) ) / 7.5
```

Slap some rounding function on that and you should be good to go.

It is also not good. The initial value is 100%, but I want to 160% and the vehicle began to burn at 0%.

It is also not good. The initial value is 100%, but I want to 160% and the vehicle began to burn at 0%.
```carHealth = ( math.max(getElementHealth(vehicle) - 250, 0) ) / 7.5 * 1.6
```

It's almost a good, but not totality. When the condition of the vehicle is 13%, the bar is no longer visible.

```
dxDrawRectangle(x-30,(y/2)+44,16,21,colour);
local HealthHeight = ((136/100)*carHealth);
local stan = ( math.max(getElementHealth(vehicle) - 360, 1) ) / 7.5 * 1.6
local yOffset = stan-136
dxDrawRectangle(x-50,(y/2)-71-yOffset,16,stan,0x99990000);

dxDrawText(tostring(HealthHeight-36)..'%',x-105,y-65);
dxDrawText(tostring(fuel)..'%',x-105,y-50);

```

what does 136 mean? what is carHealth?

I can not explain this too you because i do not know the fine with English, and even then I use google translator. In addition, it is not my code.

Just when the state of the vehicle is equal to 13%, you can not see the belt.

## Create an account

Register a new account