From 981104d94c6a68b0f0d85a3ccdbfc72fb106733f Mon Sep 17 00:00:00 2001 From: Lation Date: Fri, 16 Aug 2024 09:37:23 -0400 Subject: [PATCH] Add ClearStash export --- server/functions.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/functions.lua b/server/functions.lua index 7c5b9743..1b2244f3 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -460,6 +460,18 @@ end exports('OpenInventoryById', OpenInventoryById) +-- Clears a given stash of all items inside +--- @param identifier string +function ClearStash(identifier) + if not identifier then return end + local inventory = Inventories[identifier] + if not inventory then return end + inventory.items = {} + MySQL.prepare('UPDATE inventories SET items = ? WHERE identifier = ?', { json.encode(inventory.items), identifier }) +end + +exports('ClearStash', ClearStash) + --- @param shopData table The data of the shop to create. function CreateShop(shopData) if shopData.name then