Skip to main content

Vehicle & Engine

Fuel system, vehicle lock system, engine controls, allowed vehicle classes, addon vehicle hash overrides.

This section

Vehicle & Engine

Fuel system integration, lock system integration, engine command + keybind, allowed vehicle classes, and addon vehicle hash overrides.

Fuel System

lua
Config.FuelSystem = "LegacyFuel"

Available values:

ValueNotes
"cdn-fuel"Calls exports['cdn-fuel']:GetFuel(veh)
"ps-fuel"Calls exports['ps-fuel']:GetFuel(veh)
"LegacyFuel"Native GetVehicleFuelLevel(veh)
"lj-fuel"Native GetVehicleFuelLevel(veh)
"ox_fuel"Reads Entity(veh).state.fuel (state bag)

If the chosen system isn't available, the script falls back to native GetVehicleFuelLevel.

Vehicle Lock System

lua
Config.VehicleLockSystem = "default"
ValueLockUnlock
"default"SetVehicleDoorsLocked(veh, 2) + SetVehicleDoorsLockedForAllPlayersSetVehicleDoorsLocked(veh, 1) + SetVehicleDoorsLockedForAllPlayers
"cd_garage"TriggerEvent('cd_garage:SetVehicleLocked', veh)TriggerEvent('cd_garage:SetVehicleUnlocked', veh)
"qb-vehiclekeys"TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', plate, 2)TriggerServerEvent(... plate, 1)
"qs-vehiclekeys"TriggerEvent('qs-vehiclekeys:client:LockVehicle', plate)TriggerEvent('qs-vehiclekeys:client:UnlockVehicle', plate)

Engine Command + Keybind

A separate command for engine toggle (independent of Carplay's main opening method).

lua
Config.EngineCommand = "engine" -- chat command (set false to disable)
Config.EngineKey = false -- enable keybind
Config.EngineDefaultKey = "U"
Config.EngineBindingDescription = "Toggle Engine"
Config.EngineKeepRunning = true -- keep engine on when player exits
  • The command works only when the player is in the driver seat of a vehicle
  • EngineKeepRunning = true calls SetVehicleKeepEngineOnWhenAbandoned so the engine stays on when the driver exits

Allowed Vehicle Classes

Carplay can be blocked on specific vehicle classes via Config.AllowedTypes. Each entry maps to GTA's class index from GetVehicleClass(vehicle):

lua
Config.AllowedTypes = {
[0] = true, -- Compacts
[1] = true, -- Sedans
[2] = true, -- SUVs
[3] = true, -- Coupes
[4] = true, -- Muscle
[5] = true, -- Sports Classics
[6] = true, -- Sports
[7] = true, -- Super
[8] = true, -- Motorcycles
[9] = true, -- Off-road
[10] = true, -- Industrial
[11] = false, -- Utility
[12] = true, -- Vans
[13] = false, -- Cycles
[14] = true, -- Boats
[15] = true, -- Helicopters
[16] = false, -- Planes
[17] = true, -- Service
[18] = true, -- Emergency
[19] = true, -- Military
[20] = true, -- Commercial
[21] = false, -- Trains
[22] = false, -- Open Wheel
}

The full class index reference is in the FiveM docs: GetVehicleClass.

Addon Vehicle Hash Overrides

Some addon vehicles have broken bone names that prevent attached props (like the in-vehicle screen) from positioning correctly. Override per model:

lua
Config.VehicleHashes = {
-- [GetHashKey("duel")] = "duel",
-- [GetHashKey("mymodel")] = "mymodel",
}

Most stock vehicles work fine — only add an entry if you find a model where the screen prop attaches in the wrong place.