1
0
Fork 0
forked from Simnation/Main
Main/resources/[inventory]/pickle_consumables/modules/pfandsystem/init.lua

24 lines
967 B
Lua
Raw Normal View History

2025-07-28 23:43:51 +02:00
-- modules/pfandsystem/init.lua
local QBCore = exports['qb-core']:GetCoreObject()
-- Überwache den Moment, wenn ein Item verbraucht wird
AddEventHandler('pickle_consumables:itemConsumed', function(source, itemName, itemData)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
-- Prüfe ob das Item ein Pfand-Item generiert
if itemData and itemData.pfandItem and Config.PfandItems[itemData.pfandItem] then
-- Gebe Pfand-Item
Player.Functions.AddItem(itemData.pfandItem, 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[itemData.pfandItem], "add", 1)
if Config.PfandSystem and Config.PfandSystem.showNotification then
local pfandLabel = Config.PfandItems[itemData.pfandItem].label
TriggerClientEvent('QBCore:Notify', src, 'Du hast ' .. pfandLabel .. ' erhalten!', "success")
end
end
end)