qb-garages
qb-garages copied to clipboard
[BUG] - After adding the /addgarage to house and owned the house when I park the car it works until restart , after restart when I pull car out then try to park it again it says "This vehicle cant be stored".
Describe the bug After adding the /addgarage to house and owned the house when I park the car it works until restart , after restart when I pull car out then try to park it again it says "This vehicle cant be stored".
To Reproduce
- Try add garage in house
- Park some cars
- Restart server
- Pull car out
- Park it back it will say an error mentioned above.
Expected behavior Car should be parked at the garage all the time when I park car any time at the added garage.
Screenshots
Please find the video link here: https://tinyurl.com/yrfbdgmy
Questions (please complete the following information):
- When you last updated -- [Last week]
- Are you using custom resource? which ones? [no default]
- Have you renamed
qb-
to something custom? [no]
+1
if type == 'house' and not exports['qb-houses']:hasKey(Player.PlayerData.license, Player.PlayerData.citizenid, Config.Garages[garage].houseName) then
cb(true)
else
cb(false)
end
I changed the code in the server/main.lua to this and it seems to be working
if type == 'house' and not exports['qb-houses']:hasKey(Player.PlayerData.license, Player.PlayerData.citizenid, Config.Garages[garage].houseName) then cb(true) else cb(false) end
I changed the code in the server/main.lua to this and it seems to be working
Code seems will work for the house garage but it still won't be working with other garages, please confirm if this should be working with other garages as well?
Cancels out all other garages when using that code. Only house garages will work.
Cancels out all other garages when using that code. Only house garages will work.
if type == 'house' and exports['qb-houses']:hasKey(Player.PlayerData.license, Player.PlayerData.citizenid, Config.Garages[garage].houseName) then
cb(false)
return
end
Replace with this you can use all public garages and houses garage
This issue has had 60 days of inactivity & will close within 7 days
Cancels out all other garages when using that code. Only house garages will work.
if type == 'house' and exports['qb-houses']:hasKey(Player.PlayerData.license, Player.PlayerData.citizenid, Config.Garages[garage].houseName) then cb(false) return end
Replace with this you can use all public garages and houses garage
just by looking at this code it will only make it work when its not supposed to.. the problem lies in the export inside the callback not working correctly..
edit: after some more digging I found the Config.Garages[garage].houseName variable is nil so qb-houses is fine.. I did not yet find the problem but so far I found that: qb-garages server side does not have the garage properly synced from client-side (Config.Garages) .. the garage is there and has a .label but not a .houseName ...
after 3 days of debugging I found an actual fix: go to qb-garages/client/main.lua and find this line
RegisterNetEvent('qb-garages:client:houseGarageConfig', function(houseGarages)
comment everything in it with --[[ ]]
the function is redundant since there is also a function qb-garages:client:setHouseGarage that does the same thing every 5 seconds or so but does it better (it includes the houseName variable)
after 3 days of debugging I found an actual fix: go to qb-garages/client/main.lua and find this line
RegisterNetEvent('qb-garages:client:houseGarageConfig', function(houseGarages)
comment everything in it with --[[ ]]
the function is redundant since there is also a function qb-garages:client:setHouseGarage that does the same thing every 5 seconds or so but does it better (it includes the houseName variable)
Verified this as a fix, thank you!