From 31f747508962fc16b105a28e04fd9b146d992c3c Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 9 Mar 2025 01:50:10 -0500 Subject: [PATCH] Update server.lua --- modules/inventory/qb-inventory/server.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/inventory/qb-inventory/server.lua b/modules/inventory/qb-inventory/server.lua index cdb20c8..3e83d72 100644 --- a/modules/inventory/qb-inventory/server.lua +++ b/modules/inventory/qb-inventory/server.lua @@ -121,24 +121,30 @@ Inventory.RemoveItem = function(src, item, amount, slot, metadata) end local registeredShops = {} +local v1ShopData = {} Inventory.OpenShop = function(src, shopTitle) - return exports['qb-inventory']:OpenShop(src, shopTitle) + local newVersion = getInventoryNewVersion() + if newVersion then + return exports['qb-inventory']:OpenShop(src, shopTitle) + else + local shopData = v1ShopData[shopTitle] + if not shopData then return false end + TriggerClientEvent("inventory:client:OpenInventory", src, "shop", shopTitle, shopData) + end end Inventory.CreateShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups) if not shopTitle or not shopInventory or not shopCoords then return end + if registeredShops[shopTitle] then return true end + registeredShops[shopTitle] = true local newVersion = getInventoryNewVersion() if newVersion then - if registeredShops[shopTitle] then return true end - registeredShops[shopTitle] = true local repackedShopItems = {} for _, v in pairs(shopInventory) do table.insert(repackedShopItems, {name = v.name, price = v.price, amount = v.count or 1000}) end exports['qb-inventory']:CreateShop({ name = shopTitle, label = shopTitle, coords = shopCoords, items = repackedShopItems, }) - --exports['qb-inventory']:OpenShop(src, shopTitle) - --return Inventory.OpenShop(src, shopTitle) return true else local shopData = { label = shopTitle, items = {}, slots = 0 } @@ -149,6 +155,7 @@ Inventory.CreateShop = function(src, shopTitle, shopInventory, shopCoords, shopG shopData.slots = #shopData.items TriggerClientEvent("inventory:client:OpenInventory", src, "shop", shopTitle, shopData) + v1ShopData[shopTitle] = shopData print("QB-INVENTORY: You are using an outdated version of qb-inventory, please update to the latest version. Stuff will still work but you are using litterally the most exploitable inventory in fivem.") end end \ No newline at end of file