Skip to content

Exports (client)#

OpenInventory#

Opens the key inventory for the player. If the menu is open, it will be closed instead.

exports["VehicleKeyChain"]:OpenInventory()

GetPlayerKeys#

Returns a list containing all player keys.

Returns:
table<table<plate: string, count: int, model: int>> - List of keys with their plate, count and associated model.

local keys = exports["VehicleKeyChain"]:GetPlayerKeys()
for i = 1, #keys do
    print("Plate:", keys[i].plate)
    print("Count:", keys[i].count)
    print("ModelHash:", keys[i].model)
    print("")
end

GetPlayerVehicles#

Returns a list of all vehicles a player owns.

Returns:
table<table<string, int>> - List of vehicles with their plate and model hash.

local vehicleList = exports["VehicleKeyChain"]:GetPlayerVehicles()
for i = 1, #vehicleList do
    print("Plate:", vehicleList[i][1])
    print("ModelHash:", vehicleList[i][2])
    print("")
end

GetPlayerVehiclesAndKeys#

Returns a list of all vehicles a player owns.

Returns:
table<table<string, int>> - List of vehicles with their plate and model hash.
table<table<string, int, int>> - List of keys with their plate, count and associated model.

local vehicleList, keys = exports["VehicleKeyChain"]:GetPlayerVehicles()
for i = 1, #vehicleList do
    print("Plate:", vehicleList[i][1])
    print("ModelHash:", vehicleList[i][2])
    print("")
end
for i = 1, #keys do
    print("Plate:", keys[i][1])
    print("ModelHash:", keys[i][2])
    print("Count:", keys[i][3])
    print("")
end

GetPlayerVehiclesAndKeyCount#

Returns a list of all vehicles a player owns including the amount of keys.

Returns:
table<table<string, int, int>> - List of vehicles with their plate, model hash and key count.

local vehicleList = exports["VehicleKeyChain"]:GetPlayerVehiclesAndKeyCount()
for i = 1, #vehicleList do
    print("Plate:", vehicleList[i][1])
    print("ModelHash:", vehicleList[i][2])
    print("Key count:", vehicleList[i][3])
    print("")
end

GetPlayerTempKeys#

Returns a list of all temporary keys a player owns.

Returns:
dictionary<string, int> - Plates associated with a model (or -1 if no model).

local tempKeys = exports["VehicleKeyChain"]:GetPlayerTempKeys()
for plate, model in pairs(tempKeys) do
    print("Plate:", plate)
    print("Model:", model)
    print("")
end

IsVehicleOwner#

Check if a player is the owner of a vehicle.

Parameters:
vehicle - int - A vehicle handle.

Returns:
bool - True if player is owner.

local isVehicleOwner = exports["VehicleKeyChain"]:IsVehicleOwner(vehicle)

IsKeyOwner#

Check if a player is the owner of a key for a vehicle.

Parameters:
vehicle - int - A vehicle handle.

Returns:
bool - True if player is key owner.

local isKeyOwner = exports["VehicleKeyChain"]:IsKeyOwner(vehicle)

IsVehicleOrKeyOwner#

Check if a player is the owner of a vehicle or a key for the vehicle.

Parameters:
vehicle - int - A vehicle handle.

Returns:
bool - True if player is owner.

local isOwner = exports["VehicleKeyChain"]:IsVehicleOrKeyOwner(vehicle)

ToggleLock#

Toggles the lock of the closest and owned vehicle.

exports["VehicleKeyChain"]:ToggleLock()