fixing le stashes

This commit is contained in:
gononono64 committed 2025-06-07 20:33:11 -05:00
1 parent 2f1134f268
commit fcf0bec75a
2 files changed
+38 -22

No files matched your search

+14 -2
View File
@@ -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
+24 -20
View File
@@ -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.