Hey, someone maybe have idea why the engine here isnt starting again in the helicopters? Of course in cars its working perfectly, but not in helicopters.
local MotorOn = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = cache.ped
local vehicle = GetVehiclePedIsIn(ped, false)
local inCar = IsPedInAnyVehicle(ped, false)
if inCar and vehicle ~= nil and vehicle ~= 0 then
if IsControlJustReleased(0, 75) then
if not MotorOn and GetVehicleEngineState(vehicle) then
MotorOn = true
end
if MotorOn then
SetVehicleEngineOn(vehicle, true, true, false)
end
else
if GetVehicleEngineState(vehicle) then
MotorOn = true
else
MotorOn = false
end
end
end
end
end)
I even add something like this, but it doesnt help
if MotorOn then
while MotorOn do
print(GetIsVehicleEngineRunning(vehicle))
if not GetIsVehicleEngineRunning(vehicle) then
SetVehicleEngineOn(vehicle, true, false, false)
end
Citizen.Wait(0)
end
end