Exports (server)#
AddKey#
Add key(s) to a player using the player id and a plate.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
count - int
- The number of keys to give.
Returns:
bool
- True on success, false on failure.
AddKeyUsingIdentifier#
Add key(s) to a player using the player's identifier and a plate.
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
count - int
- The number of keys to give.
Returns:
bool
- True on success, false on failure.
BuyNewKey#
Add key(s) to a player using the player id and a plate and charge the player for it.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
count - int
- The number of keys to give.
Returns:
bool
- True on success, false on failure.
RemoveKey#
Remove key(s) from the player using the player id and plate.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
count - int
- The number of keys to give.
Returns:
bool
- True on success, false on failure.
RemoveKeyUsingIdentifier#
Remove key(s) from the player using the identifier and plate.
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
count - int
- The number of keys to give.
Returns:
bool
- True on success, false on failure.
AddTempKey#
Add a temporary key to the player using the player id and plate.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
AddTempKeyUsingIdentifier#
Add a temporary key to the player using the identifier and plate.
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
RemoveTempKey#
Remove a temporary key from a player using the player id and plate.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
RemoveTempKeyUsingIdentifier#
Remove a temporary key from a player using the identifier and plate.
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
ChangeKeyOwner#
Give key(s) from one player to another using their player ids.
Parameters:
playerIdSender - string
- The server side id of the player that should give the key.
playerIdReceiver - string
- The server side id of the player that should receive the key.
plate - string
- The license plate text of a vehicle.
count - int
- The number of keys to give.
Returns:
bool
- True on success, false on failure.
local success = exports["VehicleKeyChain"]:ChangeKeyOwner(playerIdSender, playerIdReceiver, plate, count)
ChangeKeyOwnerUsingIdentifier#
Give key(s) from one player to another using their identifiers.
Parameters:
identifierSender - string
- The identifier of the player that should give the key.
identifierReceiver - string
- The identifier of the player that should receive the key.
plate - string
- The license plate text of a vehicle.
count - int
- The number of keys to give.
Returns:
bool
- True on success, false on failure.
local success = exports["VehicleKeyChain"]:ChangeKeyOwnerUsingIdentifier(identifierSender, identifierReceiver, plate, count)
ChangeVehicleOwner#
Change the owner of a vehicle.
Parameters:
playerIdSender - string
- The server side id of the player that should give the key.
playerIdReceiver - string
- The server side id of the player that should receive the key.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
local success = exports["VehicleKeyChain"]:ChangeVehicleOwner(playerIdSender, playerIdReceiver, plate)
ChangeVehicleOwnerUsingIdentifier#
Change the owner of a vehicle using their identifiers.
Parameters:
identifierSender - string
- The identifier of the player that should give the key.
identifierReceiver - string
- The identifier of the player that should receive the key.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
local success = exports["VehicleKeyChain"]:ChangeVehicleOwnerUsingIdentifier(identifierSender, identifierReceiver, plate)
ExchangeLocks#
Removes all created keys with a specified plate and charges the player for it.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
ExchangeLocksUsingIdentifier#
Removes all created keys with a specified plate and charges the player for it.
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True on success, false on failure.
RemoveAllKeysUsingPlate#
Removes all created keys with a specified plate.
Parameters:
plate - string
- The license plate text of a vehicle.
IsVehicleOwner#
Check if a player is the owner of a vehicle.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True if player is owner.
IsVehicleOwnerUsingIdentifier#
Check if a player is the owner of a vehicle.
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True if player is owner.
IsKeyOwner#
Check if a player is the owner of a key for a vehicle (excluding being the owner of the vehicle).
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
model - int
- The model hash of a vehicle.
Returns:
bool
- True if player is owner.
IsKeyOwnerUsingIdentifier#
Check if a player is the owner of a key for a vehicle (excluding being the owner of the vehicle).
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True if player is owner.
IsVehicleOrKeyOwner#
Check if a player is the owner of a vehicle or its key.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
model - int
- The model hash of a vehicle.
Returns:
bool
- True if player is owner.
IsVehicleOrKeyOwnerUsingIdentifier#
Check if a player is the owner of a vehicle or its key.
Parameters:
identifier - string
- The identifier of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True if player is owner.
IsTempKeyOwner#
Check if a player is the owner of a temporary key for a vehicle.
Parameters:
playerId - int
- The server side id of the player.
plate - string
- The license plate text of a vehicle.
Returns:
bool
- True if player is owner.
GetPlayerKeys#
Returns a list of all keys a player owns.
Parameters:
playerId - int
- The server side id of the player.
Returns:
table<table<string, int, int>>
- List of keys with their plate, count and associated model.
local keys = exports["VehicleKeyChain"]:GetPlayerKeys(playerId)
for i = 1, #keys do
print("Plate:", keys[i][1])
print("ModelHash:", keys[i][2])
print("Count:", keys[i][3])
print("")
end
GetPlayerVehicles#
Returns a list of all vehicles a player owns.
Parameters:
playerId - int
- The server side id of the player.
Returns:
table<table<string, int>>
- List of vehicles with their plate and model hash.
local vehicleList = exports["VehicleKeyChain"]:GetPlayerVehicles(playerId)
for i = 1, #vehicleList do
print("Plate:", vehicleList[i][1])
print("ModelHash:", vehicleList[i][2])
print("")
end
GetPlayerVehiclesAndKeyCount#
Returns a list of all vehicles a player owns including the amount of keys.
Parameters:
playerId - int
- The server side id of the player.
Returns:
table<table<string, int, int>>
- List of vehicles with their plate, model hash and key count.
local vehicleList = exports["VehicleKeyChain"]:GetPlayerVehiclesAndKeyCount(playerId)
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.
Parameters:
playerId - int
- The server side id of the player.
Returns:
dictionary<string, int>
- Plates associated with a model (or -1 if no model).
local tempKeys = exports["VehicleKeyChain"]:GetPlayerTempKeys(playerId)
for plate, model in pairs(tempKeys) do
print("Plate:", plate)
print("Model:", model)
print("")
end
GetPlayerVehiclesAndKeys#
Returns both the results from GetPlayerVehicles and GetPlayerKeys.
Parameters:
playerId - int
- The server side id of the player.
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"]:GetPlayerVehiclesAndKeys(playerId)
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