Vehicle drain system

Hello everyone,
I set out to create a vehicle drain system, but I would like to add consequences when we exceed the drain limit.

When I use this piece of code, it tells me directly that the vehicle is below its values, out of values and much higher.

In the snippet below you will see Show3500KM <= 1
While my In-Game counter is at 750 and it declares my vehicle below 1

Citizen.CreateThread(function()
	while true do
	Citizen.Wait(250)
		if IsPedInAnyVehicle(PlayerPedId(), false) then
			local veh = GetVehiclePedIsIn(PlayerPedId(),false)
				local driver = GetPedInVehicleSeat(veh, -1)
					if driver == PlayerPedId() then
						if show3500KM >= 1 then
						 print("VIDANGE -1")
						-- SetVehicleDirtLevel(veh, 15.0)
						--SetVehicleEngineHealth(veh, 1000000000)
						end
				end
			else
				Citizen.Wait(15000)
			end
		Citizen.Wait(1)
	end
end)

How can I get it to take the right value?

You talk about using <= (less or equal), but your code uses >= (greater or equal).

Also, you don’t show us where show3500KM is defined or changed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.