cobalt_vehiclekeys
Vehicle keys, locks and hotwiring.
GiveKey
ServerGives a player a key for a plate and notifies them with the plate when the key is new; false when the plate is not a string or the grant fails. Pass the vehicle so the key is dropped when that vehicle leaves the world and no player owns the plate.
exports.cobalt_vehiclekeys:GiveKey(source, plate, entity)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | server id |
plate | string | No | |
entity | integer | Yes | server vehicle handle carrying the plate |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_vehiclekeys:GiveKey(source, 'COBALT01', vehicle)RemoveKeys
ServerRevokes every key for a plate.
exports.cobalt_vehiclekeys:RemoveKeys(plate)| Parameter | Type | Optional | Description |
|---|---|---|---|
plate | string | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_vehiclekeys:RemoveKeys('COBALT01')TakeKey
ServerTakes one player's key for a plate.
exports.cobalt_vehiclekeys:TakeKey(source, plate)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | server id |
plate | string | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_vehiclekeys:TakeKey(source, 'COBALT01')HasKey
ServerWhether that player holds a key. Given a vehicle, it also counts the job's shared keys for its model and a key given for that vehicle under another plate. Given a plate, it checks that plate only. There is no client export: a client could fake its answer.
exports.cobalt_vehiclekeys:HasKey(source, vehicle)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | server id |
vehicle | integer | string | No | server vehicle handle, or a plate |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_vehiclekeys:HasKey(source, vehicle)UseLockpick
ClientThe lockpick and advancedlockpick items' client export. On usedItem it picks the ignition of the vehicle the player sits in, or the door of the closest locked vehicle.
exports.cobalt_vehiclekeys:UseLockpick(event, item)| Parameter | Type | Optional | Description |
|---|---|---|---|
event | 'usingItem' | 'usedItem' | No | |
item | table | No |
exports.cobalt_vehiclekeys:UseLockpick('usingItem', { name = 'lockpick' })