I made some changes and it works for me, adding the table that Menteri_Keriau mentioned.
client/main.lua:25
local function OpenGarageMenu(data)
QBCore.Functions.TriggerCallback('qb-garages:server:GetGarageVehicles', function(result)
if result == nil then return QBCore.Functions.Notify(Lang:t('error.no_vehicles'), 'error', 5000) end
local formattedVehicles = {}
for _, v in pairs(result) do
local enginePercent = round(v.engine, 0)
local bodyPercent = round(v.body, 0)
local vname = nil
pcall(function()
vname = QBCore.Shared.Vehicles[v.vehicle].name
end)
local logs = json.decode(v.logs)
if type(logs) ~= "table" then
logs = {}
end
table.sort(logs, function(a, b) return a.time > b.time end)
formattedVehicles[#formattedVehicles + 1] = {
vehicle = v.vehicle,
vehicleLabel = vname or v.vehicle,
plate = v.plate,
state = v.state,
fuel = v.fuel,
engine = enginePercent,
body = bodyPercent,
distance = v.drivingdistance or 0,
garage = Config.Garages[data.indexgarage],
type = data.type,
index = data.indexgarage,
depotPrice = v.depotprice or 0,
balance = v.balance or 0,
logs = logs
}
end
SetNuiFocus(true, true)
SendNUIMessage({
action = 'VehicleList',
garageLabel = Config.Garages[data.indexgarage].label,
vehicles = formattedVehicles,
vehNum = #formattedVehicles,
resourceName = GetCurrentResourceName(),
garageType = data.type,
useCarImg = true
})
end, data.indexgarage, data.type, data.category)
end
server/main.lua:304
RegisterNetEvent('qb-garages:addGarageLog:server', function(data)
local src = source
local plate = data.plate
local garage = data.garage
local logType = data.type
local result = MySQL.Sync.fetchAll('SELECT logs FROM player_vehicles WHERE plate = @plate', {
['@plate'] = plate
})
if result[1] then
local logs = json.decode(result[1].logs)
if type(logs) ~= "table" then
logs = {}
end
table.insert(logs, {
time = os.date('%Y-%m-%d-%H:%M'),
type = logType,
garage = garage
})
MySQL.Sync.execute('UPDATE player_vehicles SET logs = @logs WHERE plate = @plate', {
['@logs'] = json.encode(logs),
['@plate'] = plate
})
else
TriggerClientEvent('qb-garages:notify', src, 'Vehicle not found.')
end
end)
I also recommend not using it as it has many errors. I would wait for someone who knows how to fix it completely