From 0864c1408e0dc842f8c4374d8227fab679027f95 Mon Sep 17 00:00:00 2001 From: Nordi98 Date: Tue, 12 Aug 2025 17:34:22 +0200 Subject: [PATCH] Update config_functions.lua --- .../config_functions.lua | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua b/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua index caea33591..3a08662e9 100644 --- a/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua +++ b/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua @@ -1,6 +1,7 @@ Config.Functions = { --#region Server StartFramework = function() + -- Keine Änderung nötig, da TGIANN mit ESX und QBCore funktioniert if GetResourceState("es_extended") ~= "missing" then ESX = exports["es_extended"]:getSharedObject() elseif GetResourceState("qb-core") ~= "missing" then @@ -9,24 +10,29 @@ Config.Functions = { end, GiveItem = function(source, itemName, count) - -- https://utility-library.github.io/documentation/server/esx_integration/xplayer/AddItem/ - AddItem(source, itemName, count) + -- TGIANN Inventory Version + exports["tgiann-inventory"]:AddItem(source, itemName, count) end, + HaveMoney = function(source, type, amount) if amount == 0 then return true end - - -- https://utility-library.github.io/documentation/server/esx_integration/xplayer/HaveMoney/ - return HaveMoney(source, type, amount) + + -- TGIANN Inventory Version für Geldprüfung + local money = exports["tgiann-inventory"]:GetItemByName(source, "money") + if money and money.amount >= amount then + return true + end + return false end, + RemoveMoney = function(source, type, amount) if amount <= 0 then return end - - -- https://utility-library.github.io/documentation/server/esx_integration/xplayer/RemoveMoney/ - RemoveMoney(source, type, amount) + + -- TGIANN Inventory Version für Geldentfernung + exports["tgiann-inventory"]:RemoveItem(source, "money", amount) end, --#endregion - --#region Client TryToBuy = function(self, selection, dbId, success) if Server.CanBuySnackFromVending(self.name, selection) then @@ -42,17 +48,4 @@ Config.Functions = { Server.SetVendingUsed(dbId, false) end end, - - --[[ - TargetAddModel = function(models, options) - - end, - TargetAddLocalEntity = function(entity, options) - - end, - TargetRemoveLocalEntity = function(entity) - - end, - ]] - --#endregion -} \ No newline at end of file +}