Doesnt show vehicles in the garage app
Bornke opened this issue · 6 comments
Bornke commented
amsali22 commented
how many vehicles you have ?
noswear922 commented
same i have 5-6 cars
urdemize304 commented
i replaced it with old part of the code and it works now for me. lines 45-104 of @qb-phone/server/garage
also now shows my registration for them
HypnoticGD commented
Maby this can help you
`QBCore.Functions.CreateCallback('qb-phone:server:GetGarageVehicles', function(source, cb)
local Player = QBCore.Functions.GetPlayer(source)
local Vehicles = {}
local vehdata
local result = exports.oxmysql:executeSync('SELECT * FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid})
if result[1] then
for _, v in pairs(result) do
local VehicleData = QBCore.Shared.Vehicles[v.vehicle]
local VehicleGarage = "None"
local enginePercent = round(v.engine / 10, 0)
local bodyPercent = round(v.body / 10, 0)
if v.garage then
if Config and Config.Garages and Config.Garages[v.garage] then
VehicleGarage = Config.Garages[v.garage]["label"]
else
VehicleGarage = v.garage
end
end -- Hier war die Änderung: Ende des if-Blocks für v.garage
local VehicleState = "In"
if v.state == 0 then
VehicleState = "Out"
elseif v.state == 2 then
VehicleState = "Impounded"
end
if VehicleData["brand"] then
vehdata = {
fullname = VehicleData["brand"] .. " " .. VehicleData["name"],
brand = VehicleData["brand"],
model = VehicleData["name"],
plate = v.plate,
garage = VehicleGarage,
state = VehicleState,
fuel = v.fuel,
engine = enginePercent,
body = bodyPercent,
paymentsleft = v.paymentsleft
}
else
vehdata = {
fullname = VehicleData["name"],
brand = VehicleData["name"],
model = VehicleData["name"],
plate = v.plate,
garage = VehicleGarage,
state = VehicleState,
fuel = v.fuel,
engine = enginePercent,
body = bodyPercent,
paymentsleft = v.paymentsleft
}
end
Vehicles[#Vehicles+1] = vehdata
end
cb(Vehicles)
else
cb(nil)
end
end)`
that end) needs to be copied aswell for it to work
Fohes commented
Unfortunately, this still hasn't solved the no vehicles in my phone issues.