Files
Elite-Gaming-FiveM/resources/Engine-Toggle/cl_vengine.lua
T
Jacob acb95757ee Updated the guide F7 document.
+ Added new keybinds that were missing and commands for cops to the guidehud.
2022-04-21 23:32:32 +01:00

35 lines
1.1 KiB
Lua

-- Configuration
local button = 56 -- 167 (F6 by default) Set to F9
local commandEnabled = true -- (false by default) If you set this to true, typing "/engine" in chat will also toggle your engine.
-- You're all set now!
-- Code, no need to modify this, unless you know what you're doing or you want to fuck shit up.
-- No support will be provided if you modify this part below.
Citizen.CreateThread(function()
if commandEnabled then
RegisterCommand('engine', function()
toggleEngine()
end, false)
end
while true do
Citizen.Wait(0)
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if (IsControlJustReleased(0, button) or IsDisabledControlJustReleased(0, button)) and vehicle ~= nil and vehicle ~= 0 and GetPedInVehicleSeat(vehicle, 0) then
toggleEngine()
end
end
end)
function toggleEngine()
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= nil and vehicle ~= 0 and GetPedInVehicleSeat(vehicle, 0) then
SetVehicleEngineOn(vehicle, (not GetIsVehicleEngineRunning(vehicle)), false, true)
end
end