Links

qb-phone support

Navigate to qb-phone/fxmanifest.lua and replace:
shared_scripts {
'config.lua',
'@qb-apartments/config.lua',
'@qb-garages/config.lua',
}
With:
shared_scripts {
'config.lua',
'@qb-apartments/config.lua',
}
Then, on qb-phone/server/main.lua, around the line 230, replace:
if garageresult[1] ~= nil then
for _, v in pairs(garageresult) do
local vehicleModel = v.vehicle
if (QBCore.Shared.Vehicles[vehicleModel] ~= nil) and (Config.Garages[v.garage] ~= nil) then
v.garage = Config.Garages[v.garage].label
v.vehicle = QBCore.Shared.Vehicles[vehicleModel].name
v.brand = QBCore.Shared.Vehicles[vehicleModel].brand
end
end
PhoneData.Garage = garageresult
end
With:
if garageresult[1] ~= nil then
for _, v in pairs(garageresult) do
local vehicleModel = v.vehicle
if (QBCore.Shared.Vehicles[vehicleModel] ~= nil) then
v.garage = v.garage
v.vehicle = QBCore.Shared.Vehicles[vehicleModel].name
v.brand = QBCore.Shared.Vehicles[vehicleModel].brand
end
end
PhoneData.Garage = garageresult
end
Now, go to qb-phone/client/main.lua and replace the code around the line 302:
QBCore.Functions.TriggerCallback('qb-garage:server:GetPlayerVehicles', function(vehicles)
With:
QBCore.Functions.TriggerCallback('okokGarage:GetPlayerVehicles', function(vehicles)
Then, on okokGarage/sv_utils.lua, around the line 348, before the function tablelength(T) add:
QBCore.Functions.CreateCallback('okokGarage:GetPlayerVehicles', function(source, cb)
local Player = QBCore.Functions.GetPlayer(source)
local Vehicles = {}
MySQL.query('SELECT * FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid}, function(result)
if result[1] then
for _, v in pairs(result) do
local VehicleData = QBCore.Shared.Vehicles[v.vehicle]
local VehicleGarage = "No garage"
local garageConfig = nil
for _, garage in pairs(Config.Garages) do
if garage.id == v.garage then
garageConfig = garage
break
end
end
if garageConfig ~= nil then
VehicleGarage = garageConfig.name
else
VehicleGarage = "Unknown"
end
if v.state == 0 then
v.state = "Outside"
elseif v.state == 1 then
v.state = "Garaged"
elseif v.state == 2 then
v.state = "Impounded"
end
local fullname
if VehicleData["brand"] ~= nil then
fullname = VehicleData["brand"] .. " " .. VehicleData["name"]
else
fullname = VehicleData["name"]
end
Vehicles[#Vehicles+1] = {
fullname = fullname,
brand = VehicleData["brand"],
model = VehicleData["name"],
plate = v.plate,
garage = VehicleGarage,
state = v.state,
fuel = v.fuel,
engine = v.engine,
body = v.body
}
end
cb(Vehicles)
else
cb(nil)
end
end)
end)