QBCORE
Quasar Vehiclekeys for ESX Installation Guide, please don't forget to read this installation step by step.
In the case of QBCore, it only works with qs-inventory and qb-inventory at the moment, soon we may expand the metadata to other inventories.

The first step is to download the resource that we just bought in our https://keymaster.fivem.net/asset-grants, it is important that you log in to the account with which you bought said resource, otherwise it will never appear.

When downloading the resource, we will see a .zip file with the complete package of the resource inside.It is important not to rename resources as doing so will stop them from working completely, or even cause critical errors.
  • In the [img] folder you will have all the default images of the items.
  • The rest are the script folders, remember not to edit or delete the .fxa files.
Example of resources within [vehiclekeys].

Quasar Vehiclekeys, two basic dependencies that we need for the resource to work as it should.
  • ​qs-inventory or qb-inventory are the only inventories currently supported, try to use one of them.
  • ​lockpick is the most important dependency for thefts, since without it, we will not be able to steal motorhomes.

In order for the resource to work, we must add the items to our inventory, in this case qb-inventory.
['vehiclekeys'] = {['name'] = 'vehiclekeys', ['label'] = 'Vehicle Keys', ['weight'] = 50, ['type'] = 'item', ['image'] = 'vehiclekeys.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A small and sweet casting.'},
['plate'] = {['name'] = 'plate', ['label'] = 'Plate and Keys', ['weight'] = 200, ['type'] = 'item', ['image'] = 'plate.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A small and sweet casting.'},

In order for the item information to appear in our inventory, we must add the following line in our app.js in case of qb-inventory (inside the function FormatItemInfo).
} else if (itemData.name == "vehiclekeys") {
$(".item-info-title").html("<p>" + itemData.label + "</p>");
$(".item-info-description").html(
"<p><strong>Plate: </strong><span>" +
itemData.info.plate +
"</span></p><p><strong>Model: </strong><span>" +
itemData.info.description +
"</span></p>"
);
​

For the resource to work, we need to add the event that gives you the keys in our scripts that call the vehicle, although it would work just the same if you just add it in your vehicleshop.
Please make sure you have basic knowledge to add this event, as supporters are not your personal developers.
The event below consists of two parts, as we can see it requires adding a plate and a model so that the keys take the metadata.
We will need to modify the plate and model part to make it work with our resources.
TriggerServerEvent('vehiclekeys:server:givekey', plate, model)
We can follow the esx_vehicleshop example like this:
ESX.Game.SpawnVehicle(vehicleData.model, Config.Zones.ShopOutside.Pos, Config.Zones.ShopOutside.Heading, function (vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
​
local newPlate = GeneratePlate()
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
vehicleProps.plate = newPlate
SetVehicleNumberPlateText(vehicle, newPlate)
TriggerServerEvent('vehiclekeys:server:givekey', newPlate, vehicleData.model)
if Config.EnableOwnedVehicles then
TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps)
end
​
ESX.ShowNotification(_U('vehicle_purchased'))
end)
​
Last modified 28d ago
Copy link
On this page
1. DOWNLOAD
2. ASSET POSITION
3. DEPENDENCIES
4. ADD ITEMS
5. ADD INFORMATION
6. BASIC INSTALLATION