fixing le stashes
This commit is contained in:
1 parent
2f1134f268
commit
fcf0bec75a
2 files changed
+38
-22
No files matched your search
@@ -145,8 +145,10 @@ end
|
|||||||
---@param groups table
|
---@param groups table
|
||||||
---@param coords table
|
---@param coords table
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
TriggerEvent("inventory:server:OpenInventory", "stash", id, { maxweight = weight, slots = slots })
|
_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)
|
TriggerClientEvent("inventory:client:SetCurrentStash",src, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -160,6 +162,16 @@ end
|
|||||||
---@param coords table
|
---@param coords table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
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.
|
--exports['qs-inventory']:RegisterStash(src, id, stashSlots, stashWeight) -- this needs to pass source to register, need to plan around this.
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -105,27 +105,22 @@ end
|
|||||||
|
|
||||||
---This will open the specified stash for the src passed.
|
---This will open the specified stash for the src passed.
|
||||||
---@param src number
|
---@param src number
|
||||||
|
---@param _type string == "trunk" || "glovebox" || "stash"
|
||||||
---@param id number||string
|
---@param id number||string
|
||||||
---@param label string
|
|
||||||
---@param slots number
|
|
||||||
---@param weight number
|
|
||||||
---@param owner string
|
|
||||||
---@param groups table
|
|
||||||
---@param coords table
|
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
local _type = nil
|
-- if id:sub(1, 5) == "trunk" then
|
||||||
if id:sub(1, 5) == "trunk" then
|
-- _type = "trunk"
|
||||||
_type = "trunk"
|
-- id = id:sub(5)
|
||||||
id = id:sub(5)
|
-- elseif id:sub(1, 6) == "glovebox" then
|
||||||
elseif id:sub(1, 6) == "glovebox" then
|
-- _type = "glovebox"
|
||||||
_type = "glovebox"
|
-- id = id:sub(6)
|
||||||
id = id:sub(6)
|
-- elseif id:sub(1, 5) == "stash" then
|
||||||
elseif id:sub(1, 5) == "stash" then
|
-- _type = "stash"
|
||||||
_type = "stash"
|
-- id = id:sub(5)
|
||||||
id = id:sub(5)
|
-- end
|
||||||
end
|
local tbl = Inventory.Stashes[id]
|
||||||
return tgiann:ForceOpenInventory(src, _type, id)
|
return tgiann:ForceOpenInventory(src, _type, id, tbl and { maxWeight = tbl.weight , slots = tbl.slot, label = tbl.label})
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will register a stash
|
---This will register a stash
|
||||||
@@ -138,7 +133,16 @@ end
|
|||||||
---@param coords table
|
---@param coords table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
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
|
end
|
||||||
|
|
||||||
---This will return a boolean if the player has the item.
|
---This will return a boolean if the player has the item.
|
||||||
|
|||||||
Reference in new issue
Block a user