1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-28 23:43:51 +02:00
parent a0b81a2e66
commit 059bf96ba4
2 changed files with 24 additions and 0 deletions

View file

@ -25,6 +25,7 @@ shared_scripts {
server_scripts { server_scripts {
'bridge/**/server.lua', 'bridge/**/server.lua',
'modules/pfandsystem/init.lua', -- Diese Zeile hinzufügen
'modules/**/server.lua', 'modules/**/server.lua',
} }

View file

@ -0,0 +1,23 @@
-- 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)