qb-garages icon indicating copy to clipboard operation
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".

Open isaadamirr opened this issue 11 months ago • 4 comments

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 image_2024-03-03_044943571

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]

isaadamirr avatar Mar 02 '24 23:03 isaadamirr

+1

c-drive avatar Mar 15 '24 01:03 c-drive

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

JokerDom avatar Mar 30 '24 17:03 JokerDom

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?

isaadamirr avatar Mar 31 '24 00:03 isaadamirr

Cancels out all other garages when using that code. Only house garages will work.

JokerDom avatar Mar 31 '24 01:03 JokerDom

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

HoaNgocTram avatar May 21 '24 11:05 HoaNgocTram

This issue has had 60 days of inactivity & will close within 7 days

github-actions[bot] avatar Jul 20 '24 15:07 github-actions[bot]

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 ...

jaxx0rr avatar Sep 29 '24 13:09 jaxx0rr

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)

jaxx0rr avatar Sep 30 '24 05:09 jaxx0rr

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!

rockstarrepublic1 avatar Oct 09 '24 01:10 rockstarrepublic1