diff --git a/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua b/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua index caea33591..dcafd2c3e 100644 --- a/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua +++ b/resources/[inventory]/cfx-mxc-vendingmachines/config_functions.lua @@ -9,24 +9,38 @@ 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 anstelle von Utility Library + 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 + if type == "cash" then + local money = exports["tgiann-inventory"]:GetItemByName(source, "money") + return money and money.amount >= amount + elseif type == "bank" then + -- Hier musst du die entsprechende Funktion für Bankgeld in deinem System verwenden + -- Dies ist ein Beispiel und muss an dein System angepasst werden + return true -- Temporär immer true zurückgeben + 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 + if type == "cash" then + exports["tgiann-inventory"]:RemoveItem(source, "money", amount) + elseif type == "bank" then + -- Hier musst du die entsprechende Funktion für Bankgeld in deinem System verwenden + -- Dies ist ein Beispiel und muss an dein System angepasst werden + end end, --#endregion - --#region Client TryToBuy = function(self, selection, dbId, success) if Server.CanBuySnackFromVending(self.name, selection) then @@ -42,17 +56,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 +}