Garages

When using the VIN scratch feature, the script saves essential vehicle data (model, modifications, plate, and status) to the default framework database tables:

  • QBCore / Qbox: player_vehicles

  • ESX: owned_vehicles

Custom Garage Scripts: Many paid or custom garage scripts use different database columns than the default frameworks. It is your responsibility to modify the SQL queries to ensure they are compatible with your specific garage system. You can edit the database queries in av_boosting/server/editable/_database.lua

av_boosting/server/editable/_database.lua
lib.callback.register("av_boosting:saveVin", function(source, vehProperties, missionId)
    local src = source
    local newPlate = generatePlates()
    local Player = exports['av_laptop']:getPlayer(src)
    vehProperties['plate'] = newPlate
    dbug("Saving VIN scratch for player, new plate:", newPlate, "Framework:", Framework)
    local missionData = allMissions[missionId]
    if not missionData then
        dbug("Mission data not found for missionId:", missionId)
        return nil
    end
    deleteMission(missionId, true)
    if Framework == "qb" or Framework == "qbox" then
        MySQL.insert.await('INSERT INTO '..Database['vehicleTable']..' (`license`, `'..Database['ownerColumn']..'`, `vehicle`, `hash`, `mods`, `plate`, `vinscratch`) VALUES (?, ?, ?, ?, ?, ?, ?)', {
            Player.PlayerData.license,
            Player.PlayerData.citizenid,
            missionData and missionData.model or vehProperties['model'],
            GetHashKey(missionData and missionData.model or vehProperties['model']),
            json.encode(vehProperties),
            vehProperties['plate'],
            1
        })
    elseif Framework == "esx" then
        local identifier = Player.getIdentifier()
        MySQL.insert.await('INSERT INTO '..Database['vehicleTable']..' (`'..Database['ownerColumn']..'`, `plate`, `vehicle`, `vinscratch`) VALUES (?, ?, ?, ?)', {
            identifier,
            vehProperties['plate'],
            json.encode(vehProperties),
            1
        })
    end
    addVehicleKeys(src, newPlate)
    return newPlate
end)
circle-exclamation

Last updated