1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-28 23:22:32 +02:00
parent 07f27b0557
commit 60edd2237a
2 changed files with 16 additions and 14 deletions

View file

@ -1,4 +1,4 @@
-- modules/pfandsystem/client.lua
-- modules/pfandsystem/client.lua (korrigiert)
-- Erstelle Targets für alle Pfandautomaten
CreateThread(function()
@ -21,14 +21,15 @@ end)
-- Öffne Pfand Menu
RegisterNetEvent('pickle_consumables:client:openPfandMenu', function()
TriggerCallback('pickle_consumables:server:getPfandItems', function(pfandItems)
if next(pfandItems) == nil then
ShowNotification(_L('no_pfand_items'))
return
end
showPfandMenu(pfandItems)
end)
-- Verwende lib.callback.await statt TriggerCallback
local pfandItems = lib.callback.await('pickle_consumables:server:getPfandItems', false)
if not pfandItems or next(pfandItems) == nil then
ShowNotification(_L('no_pfand_items'))
return
end
showPfandMenu(pfandItems)
end)
-- Zeige Pfand Menu
@ -50,8 +51,8 @@ function showPfandMenu(pfandItems)
-- Option für alle Items
table.insert(options, {
title = _L("Alle Pfandartikel einlösen"),
description = _L("Löse alle verfügbaren Pfandartikel auf einmal ein"),
title = "Alle Pfandartikel einlösen",
description = "Löse alle verfügbaren Pfandartikel auf einmal ein",
icon = 'coins',
onSelect = function()
redeemAllItems(pfandItems)

View file

@ -1,4 +1,4 @@
-- modules/pfandsystem/server.lua
-- modules/pfandsystem/server.lua (korrigiert)
-- Pfand einlösen
RegisterNetEvent('pickle_consumables:server:redeemPfand', function(selectedItems)
@ -53,7 +53,8 @@ RegisterNetEvent('pickle_consumables:server:redeemPfand', function(selectedItems
end)
-- Hole verfügbare Pfand Items des Spielers
RegisterCallback('pickle_consumables:server:getPfandItems', function(source, cb)
-- Verwende lib.callback.register statt RegisterCallback
lib.callback.register('pickle_consumables:server:getPfandItems', function(source)
local src = source
local pfandItems = {}
@ -70,7 +71,7 @@ RegisterCallback('pickle_consumables:server:getPfandItems', function(source, cb)
end
end
cb(pfandItems)
return pfandItems
end)
-- Hook für Item-Nutzung