diff --git a/modules/inventory/qs-inventory/server.lua b/modules/inventory/qs-inventory/server.lua index 90bd913..eb1236d 100644 --- a/modules/inventory/qs-inventory/server.lua +++ b/modules/inventory/qs-inventory/server.lua @@ -145,8 +145,10 @@ end ---@param groups table ---@param coords table ---@return nil -Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) - TriggerEvent("inventory:server:OpenInventory", "stash", id, { maxweight = weight, slots = slots }) +Inventory.OpenStash = function(src, _type, id) + _type = _type or "stash" + local data = Inventory.Stashes[id] + TriggerEvent("inventory:server:OpenInventory", _type, id, data and { maxweight = data.weight, slots = data.slots }) TriggerClientEvent("inventory:client:SetCurrentStash",src, id) end @@ -160,6 +162,16 @@ end ---@param coords table ---@return boolean Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) + if Inventory.Stashes[id] then return true end + Inventory.Stashes[id] = { + id = id, + label = label, + slots = slots, + weight = weight, + owner = owner, + groups = groups, + coords = coords + } --exports['qs-inventory']:RegisterStash(src, id, stashSlots, stashWeight) -- this needs to pass source to register, need to plan around this. return true end diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index 21be555..aad62f6 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -105,27 +105,22 @@ end ---This will open the specified stash for the src passed. ---@param src number +---@param _type string == "trunk" || "glovebox" || "stash" ---@param id number||string ----@param label string ----@param slots number ----@param weight number ----@param owner string ----@param groups table ----@param coords table ---@return nil -Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) - local _type = nil - if id:sub(1, 5) == "trunk" then - _type = "trunk" - id = id:sub(5) - elseif id:sub(1, 6) == "glovebox" then - _type = "glovebox" - id = id:sub(6) - elseif id:sub(1, 5) == "stash" then - _type = "stash" - id = id:sub(5) - end - return tgiann:ForceOpenInventory(src, _type, id) +Inventory.OpenStash = function(src, _type, id) + -- if id:sub(1, 5) == "trunk" then + -- _type = "trunk" + -- id = id:sub(5) + -- elseif id:sub(1, 6) == "glovebox" then + -- _type = "glovebox" + -- id = id:sub(6) + -- elseif id:sub(1, 5) == "stash" then + -- _type = "stash" + -- id = id:sub(5) + -- end + local tbl = Inventory.Stashes[id] + return tgiann:ForceOpenInventory(src, _type, id, tbl and { maxWeight = tbl.weight , slots = tbl.slot, label = tbl.label}) end ---This will register a stash @@ -138,7 +133,16 @@ end ---@param coords table ---@return boolean Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) - return true + Inventory.Stashes[id] = { + id = id, + label = label, + slots = slots, + weight = weight, + owner = owner, + groups = groups, + coords = coords + } + return id end ---This will return a boolean if the player has the item.