Exports

nc-carcontrol provides client-side exports for external resource integration.

GetVehicleStates

Get the current vehicle control states.

local states = exports['nc-carcontrol']:GetVehicleStates()

Returns:

Field Type Description
engine boolean Engine on/off
locked boolean Doors locked/unlocked
driveMode string Current drive mode ('ECO', 'STANDARD', 'SPORTS')
isInVehicle boolean Whether player is currently in a vehicle

Example:

local states = exports['nc-carcontrol']:GetVehicleStates()
if states.isInVehicle and states.engine then
    print('Engine is running in ' .. states.driveMode .. ' mode')
end

SetDriveMode

Set the drive mode programmatically.

exports['nc-carcontrol']:SetDriveMode(mode)

Parameters:

Param Type Values
mode string 'ECO', 'STANDARD', 'SPORTS'

Example:

-- Force ECO mode when entering a zone
exports['nc-carcontrol']:SetDriveMode('ECO')

ToggleEngine

Toggle the vehicle engine on/off.

local engineState = exports['nc-carcontrol']:ToggleEngine()

Returns:

Value Description
true Engine is now ON
false Engine is now OFF
nil Failed (not in vehicle / not driver / fuel not needed)

Example:

local result = exports['nc-carcontrol']:ToggleEngine()
if result == true then
    print('Engine started')
elseif result == false then
    print('Engine stopped')
end

ToggleLock

Toggle the vehicle door lock.

local lockState = exports['nc-carcontrol']:ToggleLock()

Returns:

Value Description
true Doors are now LOCKED
false Doors are now UNLOCKED
nil Failed (no vehicle nearby / vehicle has no lock)

Works both inside and outside the vehicle (closest vehicle within 10m).

Example:

local result = exports['nc-carcontrol']:ToggleLock()
if result == true then
    print('Vehicle locked')
elseif result == false then
    print('Vehicle unlocked')
end

NUI Callbacks

These are internal NUI → Lua callbacks used by the Vue components. Not intended for external use, but documented for reference.

Callback Description
engineToggle Toggle engine (push-button ignition)
lockToggle Toggle door lock
setDriveMode Set drive mode { mode: string }
seatbeltToggle Set seatbelt { seatbelt: boolean }
ignitionNext Key cylinder next state { hold: boolean }
ignitionSetState Key cylinder direct state { state: string }
cruiseToggle Toggle cruise { active, speed, unit, useCurrentSpeed }
cruiseSetSpeed Set cruise speed { speed, unit }
cruiseLimiter Toggle limiter { limiter: boolean }
closeNUI Close the NUI panel
Last updated 1 month ago