diff --git a/resources/[inventory]/inventory_images/images/pizza.png b/resources/[inventory]/inventory_images/images/pizza.png new file mode 100644 index 000000000..ecc5e9c86 Binary files /dev/null and b/resources/[inventory]/inventory_images/images/pizza.png differ diff --git a/resources/[inventory]/tgiann-inventory/items/items.lua b/resources/[inventory]/tgiann-inventory/items/items.lua index 86dd44bae..647ceda90 100644 --- a/resources/[inventory]/tgiann-inventory/items/items.lua +++ b/resources/[inventory]/tgiann-inventory/items/items.lua @@ -934,7 +934,7 @@ itemsData = { type = 'item', unique = true, description = 'Knusprig goldene Pommes, serviert im kleinen Metallkorb – dazu ein cremiger Dip im stilechten Mini-Metalleimer.', - image = 'ChatGPT_Image_27._Apr._2025__12_41_35-removebg-preview.png', + image = 'fries_with_dip.png', shouldClose = true, label = 'Pommes mit Dip ', name = 'fries_with_dip', @@ -1671,6 +1671,7 @@ itemsData = { type = 'item', unique = false, description = 'Ein Stück Glück auf deinem Teller – Genieße unser köstliches Stück Pizza!', + image = 'pizza.png', name = 'pizza_piece', label = 'Stück Pizza', shouldClose = true, @@ -1703,7 +1704,7 @@ itemsData = { type = 'item', unique = false, description = '', - image = 'screenshot_691-removebg-preview.png', + image = 'hotdog.png', shouldClose = true, label = 'Hot Dog', name = 'hotdog', @@ -1998,7 +1999,7 @@ itemsData = { type = 'item', unique = true, description = 'Bunte, kleine Köstlichkeiten mit knackiger Hülle und fruchtig-süßem Kern – ein Farbtupfer voller Geschmack.', - image = 'file_00000000007861f7963805e1f6fecfc5-removebg-preview.png', + image = 'jelly_beans.png', shouldClose = true, label = 'Jelly Beans', name = 'jelly_beans', @@ -2349,7 +2350,7 @@ itemsData = { type = 'item', unique = true, description = 'Der König unter den Hotdogs', - image = 'hotdogdeluxe-removebg-preview.png', + image = 'hotdog_deluxe.png', shouldClose = true, label = 'Deluxe Hotdog', name = 'hotdog_deluxe', @@ -2402,7 +2403,7 @@ itemsData = { useable = true, weight = 50, type = 'item', - unique = false, + unique = true, description = 'Dose Zitronen Limo', image = 'sprunk_dose.png', shouldClose = true, @@ -2775,7 +2776,7 @@ itemsData = { useable = true, weight = 50, type = 'item', - unique = false, + unique = true, description = 'Dose Orangen Limo', image = 'orange_o_tang_zero_dose.png', shouldClose = true, @@ -5516,7 +5517,7 @@ itemsData = { useable = true, weight = 50, type = 'item', - unique = false, + unique = true, description = 'Dose Zitronen Limo', image = 'sprunk_zero_dose.png', shouldClose = true, @@ -5790,7 +5791,7 @@ itemsData = { useable = true, weight = 50, type = 'item', - unique = false, + unique = true, description = 'Dose Orangen Limo', image = 'orange_o_tang_dose.png', shouldClose = true, @@ -6359,7 +6360,7 @@ itemsData = { useable = true, weight = 50, type = 'item', - unique = false, + unique = true, description = 'Dose Cola', image = 'ecolazerocan.png', shouldClose = true, @@ -6723,7 +6724,7 @@ itemsData = { type = 'item', unique = false, description = '"Jetzt mit 0 % Kartoffel, 100 % Patriotismus!"', - image = 'screenshot_686-removebg-preview.png', + image = 'ffries.png', shouldClose = true, label = 'Freedom Fries', name = 'ffries', @@ -7579,7 +7580,7 @@ itemsData = { type = 'item', unique = false, description = '', - image = 'screenshot_692-removebg-preview.png', + image = 'frenchfries.png', shouldClose = true, label = 'French Fries', name = 'frenchfries', @@ -7654,7 +7655,7 @@ itemsData = { useable = true, weight = 100, type = 'item', - unique = false, + unique = true, description = 'Dose mit Engery', image = 'junk_energy.png', shouldClose = true, @@ -8299,7 +8300,7 @@ itemsData = { useable = true, weight = 50, type = 'item', - unique = false, + unique = true, description = 'Dose Cola', image = 'ecola_dose.png', shouldClose = true, @@ -8339,7 +8340,7 @@ itemsData = { label = 'Medium Scope', name = 'medscope_attachment', }, - cash = { + money_item = { useable = false, weight = 0, type = 'item', @@ -8348,7 +8349,7 @@ itemsData = { image = 'cash.png', shouldClose = false, label = 'Bargeld', - name = 'cash', + name = 'money_item', }, weapon_mg = { useable = false, @@ -10206,7 +10207,7 @@ itemsData = { shouldClose = true, type = 'item', description = 'Transportiert dein Essen und deinen Alc, egal in welcher Form ^^', - weight = 1000, + weight = 2, label = 'Papiertüte', unique = true, useable = true, diff --git a/resources/[qb]/qb-core/server/player.lua b/resources/[qb]/qb-core/server/player.lua index 145430aed..f54447470 100644 --- a/resources/[qb]/qb-core/server/player.lua +++ b/resources/[qb]/qb-core/server/player.lua @@ -310,82 +310,97 @@ function QBCore.Player.CreatePlayer(PlayerData, Offline) return self.PlayerData.metadata['rep'][rep] or 0 end - function self.Functions.AddMoney(moneytype, amount, reason) - reason = reason or 'unknown' - moneytype = moneytype:lower() - amount = tonumber(amount) - if amount < 0 then return end - if not self.PlayerData.money[moneytype] then return false end - self.PlayerData.money[moneytype] = self.PlayerData.money[moneytype] + amount +function self.Functions.AddMoney(moneytype, amount, reason) + reason = reason or 'unknown' + moneytype = moneytype:lower() + amount = tonumber(amount) + if amount < 0 then return end + if not self.PlayerData.money[moneytype] then return false end + self.PlayerData.money[moneytype] = self.PlayerData.money[moneytype] + amount - if not self.Offline then - self.Functions.UpdatePlayerData() - if amount > 100000 then - TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'AddMoney', 'lightgreen', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') added, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason, true) - else - TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'AddMoney', 'lightgreen', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') added, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason) - end - TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, amount, false) - TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'add', reason) - TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'add', reason) - end - - return true + local isMoneyItem, moneyItemName = exports["tgiann-inventory"]:IsMoneyItem(moneytype) + if isMoneyItem then + exports["tgiann-inventory"]:SetItem(self.PlayerData.source, moneyItemName, self.PlayerData.money[moneytype]) end - function self.Functions.RemoveMoney(moneytype, amount, reason) - reason = reason or 'unknown' - moneytype = moneytype:lower() - amount = tonumber(amount) - if amount < 0 then return end - if not self.PlayerData.money[moneytype] then return false end - for _, mtype in pairs(QBCore.Config.Money.DontAllowMinus) do - if mtype == moneytype then - if (self.PlayerData.money[moneytype] - amount) < 0 then - return false - end - end + if not self.Offline then + self.Functions.UpdatePlayerData() + if amount > 100000 then + TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'AddMoney', 'lightgreen', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') added, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason, true) + else + TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'AddMoney', 'lightgreen', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') added, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason) end - if self.PlayerData.money[moneytype] - amount < QBCore.Config.Money.MinusLimit then return false end - self.PlayerData.money[moneytype] = self.PlayerData.money[moneytype] - amount - - if not self.Offline then - self.Functions.UpdatePlayerData() - if amount > 100000 then - TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'RemoveMoney', 'red', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') removed, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason, true) - else - TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'RemoveMoney', 'red', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') removed, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason) - end - TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, amount, true) - if moneytype == 'bank' then - TriggerClientEvent('qb-phone:client:RemoveBankMoney', self.PlayerData.source, amount) - end - TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'remove', reason) - TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'remove', reason) - end - - return true + TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, amount, false) + TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'add', reason) + TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'add', reason) end - function self.Functions.SetMoney(moneytype, amount, reason) - reason = reason or 'unknown' - moneytype = moneytype:lower() - amount = tonumber(amount) - if amount < 0 then return false end - if not self.PlayerData.money[moneytype] then return false end - local difference = amount - self.PlayerData.money[moneytype] - self.PlayerData.money[moneytype] = amount + return true +end - if not self.Offline then - self.Functions.UpdatePlayerData() - TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'SetMoney', 'green', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') set, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason) - TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, math.abs(difference), difference < 0) - TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'set', reason) - TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'set', reason) +function self.Functions.RemoveMoney(moneytype, amount, reason) + reason = reason or 'unknown' + moneytype = moneytype:lower() + amount = tonumber(amount) + if amount < 0 then return end + if not self.PlayerData.money[moneytype] then return false end + for _, mtype in pairs(QBCore.Config.Money.DontAllowMinus) do + if mtype == moneytype then + if (self.PlayerData.money[moneytype] - amount) < 0 then + return false + end end - - return true end + self.PlayerData.money[moneytype] = self.PlayerData.money[moneytype] - amount + local isMoneyItem, moneyItemName = exports["tgiann-inventory"]:IsMoneyItem(moneytype) + if isMoneyItem then + exports["tgiann-inventory"]:SetItem(self.PlayerData.source, moneyItemName, self.PlayerData.money[moneytype]) + end + + if not self.Offline then + self.Functions.UpdatePlayerData() + if amount > 100000 then + TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'RemoveMoney', 'red', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') removed, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason, true) + else + TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'RemoveMoney', 'red', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') removed, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason) + end + TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, amount, true) + if moneytype == 'bank' then + TriggerClientEvent('qb-phone:client:RemoveBankMoney', self.PlayerData.source, amount) + end + TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'remove', reason) + TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'remove', reason) + end + + return true +end + +function self.Functions.SetMoney(moneytype, amount, reason, forInventory) + reason = reason or 'unknown' + moneytype = moneytype:lower() + amount = tonumber(amount) + if amount < 0 then return false end + if not self.PlayerData.money[moneytype] then return false end + local difference = amount - self.PlayerData.money[moneytype] + self.PlayerData.money[moneytype] = amount + + if not forInventory then + local isMoneyItem, moneyItemName = exports["tgiann-inventory"]:IsMoneyItem(moneytype) + if isMoneyItem then + exports["tgiann-inventory"]:SetItem(self.PlayerData.source, moneyItemName, amount) + end + end + + if not self.Offline then + self.Functions.UpdatePlayerData() + TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'SetMoney', 'green', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') set, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason) + TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, math.abs(difference), difference < 0) + TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'set', reason) + TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'set', reason) + end + + return true +end function self.Functions.GetMoney(moneytype) if not moneytype then return false end