HumanTree92/esx_advancedvehicleshop

Issue with the VIP shop

Xorbite opened this issue · 2 comments

Describe the Bug | A Clear & Concise Description of Bug

I know, you won't help with any VIP questions, but maybe you could help with this issue I'm having which got me scratching my head multiple times. What I want is to set up the VIP shop as a normal working shop as the cars one and then afterwards adding the ace permission function that checks if a player has that permission given or not. Well the second part I know how to figure out, but the first part is what I'm struggling with currently. It keeps saying that I don't have vehicles in the db while I clearly do and then when I press twice on it afterwards, it will display this following error every time I enter and interact with the shop:

SCRIPT ERROR: @esx_advancedvehicleshop/client/main.lua:1547: attempt to index a nil value (local 'firstVehicleData')
handler (@es_extended/client/functions.lua:1012)`

at line 1547 it's calling the WaitForVehicleToLoad function:

1546 > DeleteDisplayVehicleInsideShop()
1547 > WaitForVehicleToLoad(firstVehicleData.model)

1549 > ESX.Game.SpawnLocalVehicle(firstVehicleData.model, Config.Zones.ShopInsideVIP.Pos,
    1550 > Config.Zones.ShopInsideVIP.Heading, function(vehicle)
    1551 > currentDisplayVehicle = vehicle
    1552 >TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
1553 > FreezeEntityPosition(vehicle, true)
1554 > SetModelAsNoLongerNeeded(firstVehicleData.model)
1555 > end)
    1556 > end

and then when I switch between vehicles inside the shop it will display this while showing the vehicles:

SCRIPT ERROR: @esx_advancedvehicleshop/client/main.lua:1536: attempt to index a nil value (local 'vehicleData')
ref (@es_advancedvehicleshop/client/client.lua:1536)
callback (@esx_menu_default/client/main.lua:81)
error during NUI callback menu_change: citizen/scripting/lua/scheduler.lua:853: bad argument #1 to 'unpack' (table >expected, got nil)`

Again, at line 1536 it's calling the load function

 1535 > DeleteDisplayVehicleInsideShop()
 1536 > WaitForVehicleToLoad(vehicleData.model)

 1538 > ESX.Game.SpawnLocalVehicle(vehicleData.model, Config.Zones.ShopInsideVIP.Pos,
 1539 > Config.Zones.ShopInsideVIP.Heading, function(vehicle)
 1540 > currentDisplayVehicle = vehicle
 1541 > TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
 1542 > FreezeEntityPosition(vehicle, true)
 1543 > SetModelAsNoLongerNeeded(vehicleData.model)
 1544 > end)
 1545 > end)

Database structure: (http://prntscr.com/13bbgdi) (http://prntscr.com/13bbisd) (http://prntscr.com/13bbkwu)

I've tried looking into the difference between the normal car shop code and the VIP one for comparison, but it seems to be identical with the exceptions of the changed names for collision, so I started to think that it might've been a server.lua issue, and so I went there to check on that and no it's just the same, and it's supposed to work properly, except it is not. Is it maybe because of the db VIP table not being read correctly or something? I would really appreciate it if you could help me out with this. Cheers man!

Questions
Have you made changes to anything in client/main.lua or server/main.lua?: Not yet
Have you looked through the Closed Topics?: Yes I have
Have you looked through the Wiki?: Yes I have
Are you using a Pre-Installed ESX? If Yes who?: No
Are you using es_extended? If Yes what Version? (Example: 1.2): Yes
Are you using Essentialmode?: Yes
Are you using ExtendedMode?: No
Are you using OneSync?: Yes
Linux or Windows?: Windows Server 2019

Nvm I found the issue, it was the database which was kind of messed up

Fixed it now