πVehicle Shop Integration
Learn how to seamlessly integrate our system with your vehicle shop.
Incorporating our system with your vehicle shop requires specific modifications to your server's vehicle shop code. You should remove vehicle spawning and database entry for vehicle entry in your shop's code, as our resource REQUIRES to handle these functions. It is REQUIRED to perform these adjustments exclusively within our resource.
local Player = QBCore.Functions.GetPlayer(src)
local data = {
source = src, --Who is the source. Send the Player ID. Also make sure it is number!
hash = GetHashKey(vehName), --The hash number of the vehicle
coords = vehicle.location, --This is a vector 4 location. Inlcludes x,y,z,heading.
identifier = owner, --Requires the owner of the vehicle. (Player.PlayerData.citizenid - QBCORE)
license = Player.PlayerData.license, --This is license id, you can leave it blank
vehicleName = vehName, --The name of the vehicle in a string format - ("adder")
balance = 0, --Only for QBCORE
vehPaymentsLeft = 0, --Only for QBCORE
paymentAmount = tonumber(vehiclePrice), --Only for QBCORE
financeTime = 0, --Only for QBCORE
}
TriggerEvent("realisticVehicleSystem:server:addVehicle", data)If you wish to include specific settings for the vehicle, like locking it or applying custom colors, you can add additional options to the data table. Please check all possible options through the addVehicle event in server/database.lua.
In the example below, we are sending additional variables. Colours (colour1, colour2), Lockstate to false, and Tracker Data.
local Player = QBCore.Functions.GetPlayer(src)
local data = {
source = src, --Who is the source. Send the Player ID. Also make sure it is number!
hash = GetHashKey(vehName), --The hash number of the vehicle
coords = vehicle.location, --This is a vector 4 location. Inlcludes x,y,z,heading.
identifier = owner, --Requires the owner of the vehicle. (Player.PlayerData.citizenid - QBCORE)
license = Player.PlayerData.license, --This is license id, you can leave it blank
vehicleName = vehName, --The name of the vehicle in a string format - ("adder")
colour1 = 0, --Change me with the colour you want. Supports RGB as well.
colour2 = 0, --Change me with the colour you want. Supports RGB as well.
locked = false, --Sets the vehicle to unlocked.
trackerData = {
type = 0, --0 means not intalled, 1 means basic, 2 means advanced.
name = plate, --Default name of tracker is the plate. Advanced trackers support name changing.
status = 0, --0 means normal tracker mode, 1 means emergency mode, 2 means stolen mode.
}
}
TriggerEvent("realisticVehicleSystem:server:addVehicle", data)In case you encounter a server-sided error indicating that database.lua - line x is nil, you should resolve this by adding an additional parameter. The TriggerEvent in your vehicle shop should look like this:
Last updated
Was this helpful?