VehicleKeysExports
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(...).
| Export | Params | Returns |
|---|---|---|
HasVehicleKeys / HasKeys / HaveKeys | vehicle | boolean. Includes shared job access and temp keys |
HasKeysByPlate | plate | boolean |
GiveKeys / RemoveKeys | vehicle | boolean. Local player only |
GiveKeysByPlate / RemoveKeysByPlate | plate | boolean |
GiveKeysCustom | vehicle, plate, keyType, keyoptions, autoStart, spawnLocked, addToKeyring | boolean |
GetPlayerKeyList | none | table |
GetVehicleState | none | boolean. Keys for the vehicle you are in, or the nearest one |
CanDriveVehicle / CheckVehicleAccess | vehicle | boolean |
DoesVehicleRequireKey | vehicle | boolean |
IsSharedJobVehicle / CheckForJobVehicle | vehicle | boolean |
ToggleLock | vehicle, targetLockStatus?, useKeyfobEffects? | boolean. 1 unlock, 2 lock, nil toggles. Pass true as the third argument for the fob animation, lights and lock sound |
ToggleEngine | vehicle, forceState? | boolean. true on, false off, nil toggles |
IsVehicleHotwired / CheckIfHotwired / GetHotWiredStatus | vehicle | boolean |
IsKeyInIgnition | vehicle | boolean |
InsertKeyIntoIgnition / RemoveKeyFromIgnition | vehicle? | boolean. Defaults to the current vehicle |
SetGlobalKeyBypass / GetGlobalKeyBypass | value / none | none / boolean. Same switch as /devmode |
SetTempKeyByPlate | plate, durationMs? | boolean |
HasTempKey / RemoveTempKeyByPlate | plate | boolean |
SetVehicleLockpickImmuneEntity | vehicle, immune | boolean |
SetVehicleLockpickImmunePlate | plate, immune | boolean |
SetVehicleHotwireImmune | vehicle, immune | boolean. 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 |
OpenKeyFob | plate, buttons | boolean |
StartVehicleAlarm, ToggleTrunk, ToggleRemoteStart (starts or stops from the real engine state), DanceMode, SummonVehicle, ToggleAutoPilot | vehicle | boolean |
SelfParkVehicle | vehicle | The parked coordinates, or false when it failed |
ToggleHood | vehicle | boolean |
ToggleVehiclePanel | vehicle, panel | { ok, reason }. panel is 'trunk' or 'hood'. When ok is false, reason is locked, no_keys, busy, vehicle_not_found or invalid |
HasVehiclePanel / IsVehiclePanelOpen | vehicle, panel | boolean. Whether the car has that trunk or hood, and whether it is open right now |
IsNpcLocksmithAvailable | none | boolean. true when the walk-up locksmith is out, false while staff of the locksmith job are online and hiding it |
GetApiVersion | none | number, currently 3. The level of this export surface, for companion resources to check |
ResolveKeyAnimationProp | brand, image | The prop model the key animation uses for that maker and key picture |
ResolveThrownKeyModel | brand, image, keyType? | The model a thrown key uses for that maker, key picture and key type |
IsItemBasedMode / IsInsertModeEnabled | none | boolean |
GetKeySystem (also GetkeySystem) | none | The live key system object. For deep integrations only |
ThrowKeys / DestroyKey | slot | ox_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 effectsServer exports: Server exports.
