Dealerships
okokContract
Integrate a finance check into okokContract
Change the table name depending on your framework: owned_vehicles for ESX, or player_vehicles for QBCore.
The function below can be found in the okokContract resource.
function canVehicleBeSold(source, plate)
local canBeSold = true
local financed = MySQL.scalar.await('SELECT `financed` FROM `owned_vehicles` WHERE `plate` = ? LIMIT 1', { plate })
if financed then
TriggerClientEvent('okokNotify:Alert', source, "NO TRANSFER", "You cannot transfer a vehicle that is financed", 5000, 'error')
elseif not financed then
return canBeSold
end
end