Driveable is true


#1

Hello,
I have a small problem with the function “IsVehicleDriveable”, it makes me real even if I set “SetVehicleUndriveable” to false.

Code:

...
	if engine then
		Citizen.Trace("-------- Engine on --------- \n")
	else
		Citizen.Trace("-------- Engine off --------- \n")
	end


		if IsVehicleDriveable(self.id) then
			Citizen.Trace("-------- Driveable on --------- \n")
		else
			Citizen.Trace("-------- Driveable onf --------- \n")
		end

  if IsVehicleEngineOn(self.id) and fuelLevel > 0 then
		...
  elseif engine and fuelLevel <= 0 then
		engine = false
    SetVehicleUndriveable(self.id, true)
    SetVehicleEngineOn(self.id, false, false, true)
  elseif not engine and fuelLevel > 0 then
    engine = true
    SetVehicleUndriveable(self.id, false)
		SetVehicleEngineOn(self.id, true, false, true)
  end


#2

Put traces all through the code and see which one prints. Looks like engine is being set to false so one of those engine = false is setting.


#3

If I understand correctly, if you want the vehicle to be undrivable, you should set SetVehicleUndriveable to true.


#4

I want both to be false. The car can not be driven.


#5

SetVehicleUNdriveable would have to be true.


#6
	if not engine and IsVehicleDriveable(self.id) then
		Citizen.Trace("-------- Set To undriveable --------- \n")
		SetVehicleUndriveable(self.id, true)
	end


#7

IsVehicleDriveable remains true even when SetVehicleUndriveable is set to true. What to do ?