Vehicle Keys depends on an export to give or remove keys in third-party assets, in this case we will teach you how to use said export with an example using esx_vehicleshop, the way of use is the same in all cases.
Command explanation
Export to give the keys of a specified vehicle.
-- plate: Vehicle plate-- model: Vehicle model-- bypassKeyCheck: (optional, default is false) If true, bypasses the key validation check before giving the keys.exports['qs-vehiclekeys']:GiveKeys(plate, model, true)
Export example
This code is a simple example, do not take it as a snippet, simply as an explanation of how to use said system and export.
The example below shows how we look for the model and the plate to give said value to the export.
ESX.TriggerServerCallback('esx_vehicleshop:buyVehicle', function(success)if success then IsInShopMenu =false menu2.close() menu.close()DeleteDisplayVehicleInsideShop()FreezeEntityPosition(playerPed, false)SetEntityVisible(playerPed, true)-- Here we will look for the model and plate with nativeslocal model =GetDisplayNameFromVehicleModel(GetEntityModel(vehicleData))local plate =GetVehicleNumberPlateText(vehicleData)-- Here we will use the export using the mentioned values exports['qs-vehiclekeys']:GiveKeys(plate, model, true)else ESX.ShowNotification(TranslateCap('not_enough_money'))endend, vehicleData.model, generatedPlate)