Server
Exports - Serverside
toggleLock
(Un)locks the closest vehicle
Parameters
playerId - number
- The ServerId of the player
plate - string?
- The Plate that should be (un)locked - Optional
exports.msk_vehiclekeys:toggleLock(playerId, plate)
toggleLockAdmin
(Un)locks the closest vehicle without a key needed
Parameters
playerId - number
- The ServerId of the player
plate - string?
- The Plate that should be (un)locked - Optional
exports.msk_vehiclekeys:toggleLockAdmin(playerId, plate)
GetVehicleLockState
Get whether the vehicle is locked or unlocked
Parameters
vehicle - int
- A vehicle handle
Returns
isLocked - boolean
- whether the vehicle is locked or unlocked
local isLocked = exports.msk_vehiclekeys:GetVehicleLockState(vehicle)
-- You can also use this:
local isLocked = Entity(vehicle).state.isLocked
GetVehicleLockStatus
Get the current Lock Status
Parameters
vehicle - int
- A vehicle handle
Returns
lockStatus - number
- Lockstate (1 if unlocked / 2 if locked)
local lockStatus = exports.msk_vehiclekeys:GetVehicleLockStatus(vehicle)
-- You can also use this:
local lockStatus = Entity(vehicle).state.lockState
IsVehicleWhitelisted
Parameters
plate - string
- Vehicle Plate
model - int
- Vehicle Model
Returns
isWhitelisted - boolean
- whether the vehicle is whitelisted or not
local isWhitelisted = exports.msk_vehiclekeys:IsVehicleWhitelisted(plate, model)
IsVehicleBlacklisted
Parameters
plate - string
- Vehicle Plate
model - int
- Vehicle Model
Returns
isBlacklisted - boolean
- whether the vehicle is blacklisted or not
local isBlacklisted = exports.msk_vehiclekeys:IsVehicleBlacklisted(plate, model)
IsAdminVehicle
Parameters
plate - string
- Vehicle Plate
model - int
- Vehicle Model
Returns
isAdminVehicle - boolean
- whether the vehicle is a admin vehicle or not
local isAdminVehicle = exports.msk_vehiclekeys:IsAdminVehicle(plate, model)
IsAdminVehicleAllowed
Checks if the Player with playerId has AcePermission and if the vehicle is a admin vehicle
Parameters
playerId - number
- The ServerId of the player
plate - string
- Vehicle Plate
model - int
- Vehicle Model
Returns
isAdminAllowed - boolean
- whether the Player has Ace Permission and if the vehicle is a admin vehicle
local isAdminAllowed = exports.msk_vehiclekeys:IsAdminVehicle(playerId, plate, model)
GetAllVehicleKeys
Gets all vehicle keys saved in vehiclekeys.json
Returns
vehicleKeys - table
- All Vehicle Keys
local vehicleKeys = exports.msk_vehiclekeys:GetAllVehicleKeys()
for identifier, keys in pairs(vehicleKeys) do
for i = 1, #keys do
print(identifier, keys[i].plate, keys[i].model, keys[i].type)
end
end
RefreshPlayerKeys
It will add not existing permanent keys from owned vehicles to the player
Parameters
playerId - number
- The ServerId of the player
exports.msk_vehiclekeys:RefreshPlayerKeys(playerId)
GetPlayerKeys
Gets the players vehicle keys
Parameters
playerData - table
- PlayerData of the player which you want to get the keys from
Returns
keys - table
- Players Vehicle Keys
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
local keys = exports.msk_vehiclekeys:GetPlayerKeys(playerData)
-- Example:
local keys = exports.msk_vehiclekeys:GetPlayerKeys({source = playerId})
for i = 1, #keys do
print(keys[i].plate, keys[i].model, keys[i].type)
end
GetPlayerPrimaryKeys
Gets the players primary vehicle keys
Parameters
playerData - table
- PlayerData of the player which you want to get the primary keys from
Returns
keys - table
- Players Vehicle Keys
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
local keys = exports.msk_vehiclekeys:GetPlayerPrimaryKeys(playerData)
-- Example:
local keys = exports.msk_vehiclekeys:GetPlayerPrimaryKeys({source = playerId})
for i = 1, #keys do
print(keys[i].plate, keys[i].model, keys[i].type)
end
GetPlayerSecondaryKeys
Gets the players secondary vehicle keys
Parameters
playerData - table
- PlayerData of the player which you want to get the secondary keys from
Returns
keys - table
- Players Vehicle Keys
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
local keys = exports.msk_vehiclekeys:GetPlayerSecondaryKeys(playerData)
-- Example:
local keys = exports.msk_vehiclekeys:GetPlayerSecondaryKeys({source = playerId})
for i = 1, #keys do
print(keys[i].plate, keys[i].model, keys[i].type)
end
GetPlayerTempKeys
Gets the players temporary vehicle keys
Parameters
playerData - table
- PlayerData of the player which you want to get the temporary keys from
Returns
keys - table
- Players Vehicle Keys
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
local keys = exports.msk_vehiclekeys:GetPlayerTempKeys(playerData)
-- Example:
local keys = exports.msk_vehiclekeys:GetPlayerTempKeys({source = playerId})
for i = 1, #keys do
print(keys[i].plate, keys[i].model, keys[i].type)
end
HasPlayerKey
Checks whether the player has a key for the given plate and model or not
Parameters
playerData - table
- PlayerData of the player which you want to check if he has a key
plate - string
- Vehicle Plate
model - number
- Vehicle Model
Returns
hasKey - boolean
- whether the player has a key for the given vehicle or not
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
local hasKey = exports.msk_vehiclekeys:HasPlayerKey(playerData, plate, model)
-- Example
local hasKey = exports.msk_vehiclekeys:HasPlayerKey({source = playerId}, plate, model)
HasPlayerPrimaryKey
Checks whether the player has a primary key for the given plate and model or not
Parameters
playerData - table
- PlayerData of the player which you want to check if he has a primary key
plate - string
- Vehicle Plate
model - number
- Vehicle Model
Returns
hasKey - boolean
- whether the player has a primary key for the given vehicle or not
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
local hasKey = exports.msk_vehiclekeys:HasPlayerPrimaryKey(playerData, plate, model)
-- Example
local hasKey = exports.msk_vehiclekeys:HasPlayerPrimaryKey({source = playerId}, plate, model)
HasPlayerSecondaryKey
Checks whether the player has a secondary key for the given plate and model or not
Parameters
playerData - table
- PlayerData of the player which you want to check if he has a secondary key
plate - string
- Vehicle Plate
model - number
- Vehicle Model
Returns
hasKey - boolean
- whether the player has a secondary key for the given vehicle or not
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
local hasKey = exports.msk_vehiclekeys:HasPlayerSecondaryKey(playerData, plate, model)
-- Example
local hasKey = exports.msk_vehiclekeys:HasPlayerSecondaryKey({source = playerId}, plate, model)
HasPlayerTempKey
Checks whether the player has a temporary key for the given plate and model or not
Parameters
playerData - table
- PlayerData of the player which you want to check if he has a temporary key
plate - string
- Vehicle Plate
model - number
- Vehicle Model
Returns
hasKey - boolean
- whether the player has a temporary key for the given vehicle or not
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
local hasKey = exports.msk_vehiclekeys:HasPlayerTempKey(playerData, plate, model)
-- Example
local hasKey = exports.msk_vehiclekeys:HasPlayerTempKey({source = playerId}, plate, model)
GetPlayerVehicles
Get the players vehicles saved in database: owned_vehicles
Parameters
playerData - table
- PlayerData of the player which you want to get the vehicles from
Returns
vehicles - table
- Players Vehicles
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
local vehicles = exports.msk_vehiclekeys:GetPlayerVehicles(playerData)
-- Example
local vehicles = exports.msk_vehiclekeys:GetPlayerVehicles({source = playerId})
for i = 1, #vehicles do
print(vehicles[i].plate, vehicles[i].model)
end
IsVehicleOwner
Checks whether the player is the owner of the given vehicle
Parameters
playerData - table
- PlayerData of the player which you want to check if he is the vehicle owner
Returns
isOwner - boolean
- whether the player is the owner of the given vehicle
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
local isOwner = exports.msk_vehiclekeys:IsVehicleOwner(playerData)
-- Example
local isOwner = exports.msk_vehiclekeys:IsVehicleOwner({source = playerId})
HasPlayerKeyOrIsVehicleOwner
Checks whether the player has a key or is vehicle owner
Parameters
playerData - table
- PlayerData of the player which you want to check if he has a key
plate - string
- Vehicle Plate
model - number
- Vehicle Model
Returns
hasKeyOrIsOwner - boolean
- whether the player has a key or is vehicle owner
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
local hasKeyOrIsOwner = exports.msk_vehiclekeys:HasPlayerKeyOrIsVehicleOwner(playerData, plate, model)
-- Example
local hasKeyOrIsOwner = exports.msk_vehiclekeys:HasPlayerKeyOrIsVehicleOwner({source = playerId}, plate, model)
GetPlayerKeysAndVehicles
Gets the player keys and owned vehicles
Parameters
playerData - table
- PlayerData of the player which you want to get the keys and vehicles from
Returns
vehicles - table
- Players Vehicles
keys - table
- Players Vehicle Keys
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
local keys, vehicles = exports.msk_vehiclekeys:GetPlayerKeysAndVehicles(playerData)
-- Example
local keys, vehicles = exports.msk_vehiclekeys:GetPlayerKeysAndVehicles({source = playerId})
for i = 1, #keys do
print(keys[i].plate, keys[i].model, keys[i].type)
end
for i = 1, #vehicles do
print(vehicles[i].plate, vehicles[i].model)
end
AddKey
Adds a key to the player
Parameters
playerData - table
- PlayerData of the player to whom you want to add the key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel, type = keyType}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId, type = keyType}
exports.msk_vehiclekeys:AddKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:AddKey({source = playerId}, {plate = 'LS 1234', model = 1093792632, type = 'secondary'})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:AddKey({source = playerId}, {netId = vehicleNetId, type = 'secondary'})
AddPrimaryKey
Adds a primary key to the player
Parameters
playerData - table
- PlayerData of the player to whom you want to add the primary key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:AddPrimaryKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:AddPrimaryKey({source = playerId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:AddPrimaryKey({source = playerId}, {netId = vehicleNetId})
AddSecondaryKey
Adds a secondary key to the player
Parameters
playerData - table
- PlayerData of the player to whom you want to add the secondary key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:AddSecondaryKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:AddSecondaryKey({source = playerId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:AddSecondaryKey({source = playerId}, {netId = vehicleNetId})
AddTempKey
Adds a temporary key to the player
Parameters
playerData - table
- PlayerData of the player to whom you want to add the temporary key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:AddTempKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:AddTempKey({source = playerId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:AddTempKey({source = playerId}, {netId = vehicleNetId})
RemoveKey
Removes the key from the player
Parameters
playerData - table
- PlayerData of the player to whom you want to remove the key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel, type = keyType}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId, type = keyType}
exports.msk_vehiclekeys:RemoveKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:RemoveKey({source = playerId}, {plate = 'LS 1234', model = 1093792632, type = 'secondary'})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:RemoveKey({source = playerId}, {netId = vehicleNetId, type = 'secondary'})
RemovePrimaryKey
Removes the primary key from the player
Parameters
playerData - table
- PlayerData of the player to whom you want to remove the primary key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:RemovePrimaryKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:RemovePrimaryKey({source = playerId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:RemovePrimaryKey({source = playerId}, {netId = vehicleNetId})
RemoveSecondaryKey
Removes the secondary key from the player
Parameters
playerData - table
- PlayerData of the player to whom you want to remove the secondary key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:RemoveSecondaryKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:RemoveSecondaryKey({source = playerId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:RemoveSecondaryKey({source = playerId}, {netId = vehicleNetId})
RemoveTempKey
Removes the temporary key from the player
Parameters
playerData - table
- PlayerData of the player to whom you want to remove the temporary key
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
- Use this if the player is not Online
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:RemoveTempKey(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:RemoveTempKey({source = playerId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:RemoveTempKey({source = playerId}, {netId = vehicleNetId})
ExchangeVehicleLocks
Exchange the vehicle locks of the given vehicle. All Keys that other players might have for this vehicle will be deleted.
Parameters
playerData - table
- PlayerData of the player who is the vehicle owner
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter playerData
you can set:
{source = playerId}
{identifier = playerIdentifier}
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:ExchangeVehicleLocks(playerData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:ExchangeVehicleLocks({source = playerId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:ExchangeVehicleLocks({source = playerId}, {netId = vehicleNetId})
TransferVehicle
The given vehicle will be transfered to the given player
Parameters
ownerData - table
- PlayerData of the player who is the current vehicle owner
targetData - table
- PlayerData of the player who gets the vehicle
vehicleData - table
- Vehicle Data such as plate, model or netId
Description
For the Parameter ownerData
or targetData
you can set:
{source = playerId}
{identifier = playerIdentifier}
For the Parameter vehicleData
you can set:
{plate = vehiclePlate, model = vehicleModel}
-> "model" is not required if you are sure that the plate exists in your database (owned_vehicles/player_vehicles){netId = vehicleNetId}
exports.msk_vehiclekeys:TransferVehicle(ownerData, targetData, vehicleData)
-- Example 1
exports.msk_vehiclekeys:TransferVehicle({source = playerId}, {source = targetId}, {plate = 'LS 1234', model = 1093792632})
-- Example 2
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
exports.msk_vehiclekeys:TransferVehicle({source = playerId}, {source = targetId}, {netId = vehicleNetId})
Last updated