Is there a way to turn QB-garages into a city wide system? So say if i put a car in the garage at legion square then make my way over to the airport garage take it out there?
Hey
Iām not using QB very often so I add to check how the garage works. You have multiple options to do so, an easy one would be to change the SQL query for the āGetUserVehiclesā callBack in the server side script, like that :
[/[qb]/qb-garages/server/main/lua] (lines 76 to 87):
QBCore.Functions.CreateCallback("qb-garage:server:GetUserVehicles", function(source, cb, garage)
local src = source
local pData = QBCore.Functions.GetPlayer(src)
local state = 1
exports.oxmysql:execute('SELECT * FROM player_vehicles WHERE citizenid = ? AND state = ?', {pData.PlayerData.citizenid, state}, function(result)
if result[1] then
cb(result)
else
cb(nil)
end
end)
end)
I give it a try after I made the modification, it works on my end.
You can clean a little bit the code by removing the āgarageā argument that is given to the callBack etc⦠if you want.
Legend thanks dude, ill give it a try when j get back from work and let you know
This didnt work for me mate, i use a modified version of qb garages but that just gave me an error instantly
I did it on a vanilla version of qb-garage, if yours is modified it must be why it didnāt work.
Can you show me the error ?
I dont currently have access to the error code as im at work however here is the code for this:
main.lua (5.1 KB)
Iāll wait until you get back, so you can send me the error screenshot and the whole qb-garage ressource.
If you wish for me to send you the entire qb garage resource i can send you this as i have access to it?
Can you show me the lines between 290 and 310 in the client/main.lua file ?
Sure, this is code from 293 to 310
Menu.addButton(Garages[currentGarage].label, āVehicleListā, Garages[currentGarage].label)
for k, v in pairs(result) do
enginePercent = round(v.engine / 10, 0)
bodyPercent = round(v.body / 10, 0)
currentFuel = v.fuel
curGarage = Garages[v.garage].label
if v.state == 0 then
v.state = "Out"
elseif v.state == 1 then
v.state = "Garaged"
elseif v.state == 2 then
v.state = "Impound"
end