JG Docs
Dealerships

qb-vehiclesales

Make qb-vehiclesales compatible with our Dealerships

Go to file qb-vehiclesales/server/main.lua

Add this snippet at the bottom of the script.

QBCore.Functions.CreateCallback("jg-advancedgarages:server:checkVehicleOwner", function(source, cb, plate)
    local src = source
    local pData = QBCore.Functions.GetPlayer(src)
    local financed = MySQL.scalar.await('SELECT `financed` FROM `player_vehicles` WHERE `plate` = ? LIMIT 1', { plate })
    if not financed then
        MySQL.query('SELECT * FROM player_vehicles WHERE plate = ? AND citizenid = ?',{plate, pData.PlayerData.citizenid}, function(result)
            if result[1] then
                cb(true, result[1].balance)
            else
                cb(false)
            end
        end)
    elseif financed then
        TriggerClientEvent('QBCore:Notify', src, "you cannot sell a vehicle that is under finance", 'error')
    end
end)

Go to file qb-vehiclesales/client/main.lua

Replace qb-garage:server:checkVehicleOwner with jg-advancedgarages:server:checkVehicleOwner (there are 2 occurrences to change - use find and replace in your text editor), like in the screenshot below:

On this page