Examples how to use

Add keys to Player (In this Example the Player will get the Keys to a Car with the plate "ABC123")

local plate = "ABC123"	
exports['usw_carlock']:giveKeys(plate)

Remove Keys from Player (In this Example the keys of the car with the plate "ABC123" will be removed from the Player)

local plate = "ABC123"
exports['usw_carlock']:takeKeys(plate)

Check if the Player owns the Car (In this example we look if the Player owns the Car with the plate "ABC123")

ESX.TriggerServerCallback('usw_carlock:isVehicleOwner', function(owner)
    if owner then
        --DO SOMETHING IF PLAYER OWNS CAR
    end
end, plate)

Check if a number plate is availabe or if its already in use (In this example we check if the plate "ABC123" is already in use or not)

local plate = "ABC123"
ESX.TriggerServerCallback('usw_carlock:isPlateAvailable', function(available)
 if available then
   --DO SOMETHING IF PLATE IS AVAILABLE
 end
end, plate)

Get the Name of the Player who owns a specific Vehicle (In this example we look if the what the name of the owner of the vehicle with the plate "ABC123" is)

Now that you had an example of all functions, lets give you some examples how to get the plate of a Vehicle:

This is how you can get the Plate of the Vehicle in that the player is sitting right now. I use the match function in the end, because on my tests, was this the best option to also go good with plates that contains spaces.

Get the plate of the closest Vehicle in a 5.0 radius:

Last updated