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)

IsVehicleWhitelisted

Parameters plate - string - Vehicle Plate model - int - Vehicle Model

Returns isWhitelisted - boolean - whether the vehicle is whitelisted or not

IsVehicleBlacklisted

Parameters plate - string - Vehicle Plate model - int - Vehicle Model

Returns isBlacklisted - boolean - whether the vehicle is blacklisted or not

IsAdminVehicle

Parameters plate - string - Vehicle Plate model - int - Vehicle Model

Returns isAdminVehicle - boolean - whether the vehicle is a admin vehicle or not

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

GetAllVehicleKeys

Gets all vehicle keys saved in vehiclekeys.json

Returns vehicleKeys - table - All Vehicle Keys

RefreshPlayerKeys

It will add not existing permanent keys from owned vehicles to the player

Parameters playerId - number - The ServerId of the player

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

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

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

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

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}

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}

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}

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}

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

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

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}

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

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}

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}

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}

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}

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}

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}

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}

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}

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}

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}

Last updated