Client exports

Client exports for Vehicle Keys. vehicle is an entity handle.

In-development version. These docs cover the testing build of VehicleKeys. The official release is still documented on the GitBook linked in its README.

vehicle is an entity handle. Call them as exports.MrNewbVehicleKeys:Name(...).

ExportParamsReturns
HasVehicleKeys / HasKeys / HaveKeysvehicleboolean. Includes shared job access and temp keys
HasKeysByPlateplateboolean
GiveKeys / RemoveKeysvehicleboolean. Local player only
GiveKeysByPlate / RemoveKeysByPlateplateboolean
GiveKeysCustomvehicle, plate, keyType, keyoptions, autoStart, spawnLocked, addToKeyringboolean
GetPlayerKeyListnonetable
GetVehicleStatenoneboolean. Keys for the vehicle you are in, or the nearest one
CanDriveVehicle / CheckVehicleAccessvehicleboolean
DoesVehicleRequireKeyvehicleboolean
IsSharedJobVehicle / CheckForJobVehiclevehicleboolean
ToggleLockvehicle, targetLockStatus?, useKeyfobEffects?boolean. 1 unlock, 2 lock, nil toggles. Pass true as the third argument for the fob animation, lights and lock sound
ToggleEnginevehicle, forceState?boolean. true on, false off, nil toggles
IsVehicleHotwired / CheckIfHotwired / GetHotWiredStatusvehicleboolean
IsKeyInIgnitionvehicleboolean
InsertKeyIntoIgnition / RemoveKeyFromIgnitionvehicle?boolean. Defaults to the current vehicle
SetGlobalKeyBypass / GetGlobalKeyBypassvalue / nonenone / boolean. Same switch as /devmode
SetTempKeyByPlateplate, durationMs?boolean
HasTempKey / RemoveTempKeyByPlateplateboolean
SetVehicleLockpickImmuneEntityvehicle, immuneboolean
SetVehicleLockpickImmunePlateplate, immuneboolean
SetVehicleHotwireImmunevehicle, immuneboolean. The server applies it, and only for an admin, someone with a real key, or the vehicle's owner. A borrowed temporary key is not enough
OpenKeyFobplate, buttonsboolean
StartVehicleAlarm, ToggleTrunk, ToggleRemoteStart (starts or stops from the real engine state), DanceMode, SummonVehicle, ToggleAutoPilotvehicleboolean
SelfParkVehiclevehicleThe parked coordinates, or false when it failed
ToggleHoodvehicleboolean
ToggleVehiclePanelvehicle, panel{ ok, reason }. panel is 'trunk' or 'hood'. When ok is false, reason is locked, no_keys, busy, vehicle_not_found or invalid
HasVehiclePanel / IsVehiclePanelOpenvehicle, panelboolean. Whether the car has that trunk or hood, and whether it is open right now
IsNpcLocksmithAvailablenoneboolean. true when the walk-up locksmith is out, false while staff of the locksmith job are online and hiding it
GetApiVersionnonenumber, currently 3. The level of this export surface, for companion resources to check
ResolveKeyAnimationPropbrand, imageThe prop model the key animation uses for that maker and key picture
ResolveThrownKeyModelbrand, image, keyType?The model a thrown key uses for that maker, key picture and key type
IsItemBasedMode / IsInsertModeEnablednoneboolean
GetKeySystem (also GetkeySystem)noneThe live key system object. For deep integrations only
ThrowKeys / DestroyKeyslotox_inventory button actions. Not for general scripting

SetTempKey, GetTempKey, and ToggleTempKey are old names for the global bypass. Use SetGlobalKeyBypass.

Fob button ids in resource/open/shared/hooks.lua: REMOTE_START, OPEN_DOORS, ROOF_TOGGLE, SELFPARK_VEHICLE, SUMMON_VEHICLE, AUTO_PILOT, DANCE_MODE, PROXIMITY_TOGGLE, EMERGENCY_LIGHTS.

exports.MrNewbVehicleKeys:GiveKeys(vehicle)
exports.MrNewbVehicleKeys:ToggleLock(vehicle, 2)
exports.MrNewbVehicleKeys:ToggleLock(vehicle, 2, true) -- with fob effects

Server exports: Server exports.