RegisterNetEvent("jg-dealerships:client:purchase-vehicle:config", function(vehicle, plate, purchaseType, amount, paymentMethod, financed)
TriggerServerEvent("jg-dealerships:server:AddVehicleRegistration", plate)
end)
RegisterNetEvent("jg-dealerships:server:AddVehicleRegistration", function(plate)
local src = source
local matches = MySQL.query.await("SELECT * FROM `dealership_sales` WHERE `plate` = :plate LIMIT 1", {
plate = plate,
})
local data = matches[1]
dealer = data['dealership']
exports.pickle_documents:GiveDocument(src, "VehicleRegistration", {
plate = plate,
dealer = dealer,
}, { takePhoto = true })
end)