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)ifownerthen --DO SOMETHING IF PLAYER OWNS CARendend, 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)
localplate="ABC123"ESX.TriggerServerCallback('usw_carlock:isPlateAvailable', function(available)ifavailablethen --DO SOMETHING IF PLATE IS AVAILABLEendend, 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:
local plate = "ABC123"
ESX.TriggerServerCallback('usw_carlock:getname', function(name)
print(name) -- NAME IS THE FIRST AND LASTNAME OF THE OWNER OF THE CAR
end, plate)
local ped = PlayerPedId()
local plate = GetVehicleNumberPlateText(GetVehiclePedIsIn(ped, false)):match( "^%s*(.-)%s*$" )
local coords = GetEntityCoords(GetPlayerPed(-1))
local nearestVehicle = GetClosestVehicle(coords['x'], coords['y'], coords['z'], 5.0, 0, 71)
local plate = GetVehicleNumberPlateText(nearestVehicle)