Third-Party Integrations
Learn how to connect Quasar assets with external scripts such as esx_vehicleshop or other third-party systems. These integrations allow automatic compatibility, like assigning vehicle keys or synchronizing custom functions seamlessly.
Integrating Key Management with Third-Party Assets
This guide explains how to integrate Vehicle Keys with other assets like esx_vehicleshop, so that keys are automatically given when a player buys or receives a vehicle.
1️⃣ Export Overview
Use this export to give keys to a vehicle:
exports['qs-vehiclekeys']:GiveKeys(plate, model, true)plate: Vehicle license plate.
model: Vehicle model name.
bypassKeyCheck: (optional) Set to
trueto skip key validation.
2️⃣ Example Integration (esx_vehicleshop)
Place this code where the vehicle purchase is confirmed:
ESX.TriggerServerCallback('esx_vehicleshop:buyVehicle', function(success)
if success then
IsInShopMenu = false
menu2.close()
menu.close()
DeleteDisplayVehicleInsideShop()
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
-- Retrieve vehicle data
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicleData))
local plate = GetVehicleNumberPlateText(vehicleData)
-- Grant keys to the buyer
exports['qs-vehiclekeys']:GiveKeys(plate, model, true)
else
ESX.ShowNotification(TranslateCap('not_enough_money'))
end
end, vehicleData.model, generatedPlate)When the vehicle is purchased, the player automatically receives the keys.
3️⃣ Key Points
Use GetDisplayNameFromVehicleModel and GetVehicleNumberPlateText to get model and plate dynamically.
Call GiveKeys with both values and set
trueif you want to bypass validation.This method can be adapted to any third-party asset that needs vehicle key assignment.
By integrating this export, you ensure players automatically receive their keys upon purchase or vehicle spawn, improving gameplay and usability.
Debugging and Helper Tips
Debugging means checking your code to see what’s wrong and fixing it — the easiest way is by using print() to see what’s happening while your script runs.
Use print() To Check Values
print() shows what your variables contain in the console:
print(vehicleData.model, vehicleData.name)
print('Model:', vehicleData.model, 'Name:', vehicleData.name)➡️ Helps you confirm if the data is correct.
Example While Buying A Vehicle
Add a print() inside your callback to check info when buying a car:
print('Model:', vehicleData.model, 'Plate:', generatedPlate)This shows the model and plate to see if the code is working right.
Get Vehicle Info Quickly
local model = GetDisplayNameFromVehicleModel(GetEntityModel(veh))
local plate = GetVehicleNumberPlateText(veh)Gets the vehicle model and plate easily.
Simple Tips
Add
print()before/after big actions.Label your prints →
print('Plate:', plate)Test small parts one by one.
In short: use print() to watch what your script is doing it’s the fastest way to find and fix problems.