Hi All,
I have an issue with a bit of code I have wrote:
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = GetPlayerPed(-1)
if DoesEntityExist(ped) and IsPedInAnyVehicle(ped, false) and IsControlPressed(2, 75) and not IsEntityDead(ped) and not IsPauseMenuActive() then
local engineWasRunning = GetIsVehicleEngineRunning(GetVehiclePedIsIn(ped, true))
Citizen.Wait(1000)
if DoesEntityExist(ped) and not IsPedInAnyVehicle(ped, false) and not IsEntityDead(ped) and not IsPauseMenuActive() then
local veh = GetVehiclePedIsIn(ped, true)
if (engineWasRunning) then
SetVehicleEngineOn(veh, true, true, true)
end
end
end
end
end)
The engines of sedans & compacts etc get turned back on after the player leaves the vehicle however when a player exits one of the super cars like T20/Vacca/Thrax/Reaper/Itali GTB etc etc the engine is turned off when the player leaves the vehicle and is not being turned back on.
Would you have any advice what I could do to fix this?
Thanks a lot in advance!