forked from Simnation/Main
ed
This commit is contained in:
parent
a0b81a2e66
commit
059bf96ba4
2 changed files with 24 additions and 0 deletions
|
@ -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',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue