2025-08-12 15:22:10 +02:00
|
|
|
Config.Functions = {
|
|
|
|
--#region Server
|
|
|
|
StartFramework = function()
|
|
|
|
if GetResourceState("es_extended") ~= "missing" then
|
|
|
|
ESX = exports["es_extended"]:getSharedObject()
|
|
|
|
elseif GetResourceState("qb-core") ~= "missing" then
|
|
|
|
QBCore = exports["qb-core"]:GetCoreObject()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
GiveItem = function(source, itemName, count)
|
2025-08-12 17:58:38 +02:00
|
|
|
-- TGIANN Inventory Version anstelle von Utility Library
|
|
|
|
exports["tgiann-inventory"]:AddItem(source, itemName, count)
|
2025-08-12 15:22:10 +02:00
|
|
|
end,
|
2025-08-12 17:58:38 +02:00
|
|
|
|
2025-08-12 15:22:10 +02:00
|
|
|
HaveMoney = function(source, type, amount)
|
|
|
|
if amount == 0 then return true end
|
2025-08-12 17:58:38 +02:00
|
|
|
|
|
|
|
-- 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
|
2025-08-12 15:22:10 +02:00
|
|
|
end,
|
2025-08-12 17:58:38 +02:00
|
|
|
|
2025-08-12 15:22:10 +02:00
|
|
|
RemoveMoney = function(source, type, amount)
|
|
|
|
if amount <= 0 then return end
|
2025-08-12 17:58:38 +02:00
|
|
|
|
|
|
|
-- 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
|
2025-08-12 15:22:10 +02:00
|
|
|
end,
|
|
|
|
--#endregion
|
|
|
|
|
|
|
|
--#region Client
|
|
|
|
TryToBuy = function(self, selection, dbId, success)
|
|
|
|
if Server.CanBuySnackFromVending(self.name, selection) then
|
|
|
|
Server.SetVendingUsed(dbId, true)
|
|
|
|
success()
|
|
|
|
Server.SetVendingUsed(dbId, false)
|
|
|
|
|
|
|
|
if not Config.NoFramework then
|
|
|
|
Server.BuySnackFromVending(self.name, selection)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
ButtonFor(Config.Translations["not_enough_money"], 2000)
|
|
|
|
Server.SetVendingUsed(dbId, false)
|
|
|
|
end
|
|
|
|
end,
|
2025-08-12 17:58:38 +02:00
|
|
|
}
|