forked from Simnation/Main
ed
This commit is contained in:
parent
07f27b0557
commit
60edd2237a
2 changed files with 16 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
-- modules/pfandsystem/client.lua
|
-- modules/pfandsystem/client.lua (korrigiert)
|
||||||
|
|
||||||
-- Erstelle Targets für alle Pfandautomaten
|
-- Erstelle Targets für alle Pfandautomaten
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
|
@ -21,14 +21,15 @@ end)
|
||||||
|
|
||||||
-- Öffne Pfand Menu
|
-- Öffne Pfand Menu
|
||||||
RegisterNetEvent('pickle_consumables:client:openPfandMenu', function()
|
RegisterNetEvent('pickle_consumables:client:openPfandMenu', function()
|
||||||
TriggerCallback('pickle_consumables:server:getPfandItems', function(pfandItems)
|
-- Verwende lib.callback.await statt TriggerCallback
|
||||||
if next(pfandItems) == nil then
|
local pfandItems = lib.callback.await('pickle_consumables:server:getPfandItems', false)
|
||||||
ShowNotification(_L('no_pfand_items'))
|
|
||||||
return
|
if not pfandItems or next(pfandItems) == nil then
|
||||||
end
|
ShowNotification(_L('no_pfand_items'))
|
||||||
|
return
|
||||||
showPfandMenu(pfandItems)
|
end
|
||||||
end)
|
|
||||||
|
showPfandMenu(pfandItems)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Zeige Pfand Menu
|
-- Zeige Pfand Menu
|
||||||
|
@ -50,8 +51,8 @@ function showPfandMenu(pfandItems)
|
||||||
|
|
||||||
-- Option für alle Items
|
-- Option für alle Items
|
||||||
table.insert(options, {
|
table.insert(options, {
|
||||||
title = _L("Alle Pfandartikel einlösen"),
|
title = "Alle Pfandartikel einlösen",
|
||||||
description = _L("Löse alle verfügbaren Pfandartikel auf einmal ein"),
|
description = "Löse alle verfügbaren Pfandartikel auf einmal ein",
|
||||||
icon = 'coins',
|
icon = 'coins',
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
redeemAllItems(pfandItems)
|
redeemAllItems(pfandItems)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- modules/pfandsystem/server.lua
|
-- modules/pfandsystem/server.lua (korrigiert)
|
||||||
|
|
||||||
-- Pfand einlösen
|
-- Pfand einlösen
|
||||||
RegisterNetEvent('pickle_consumables:server:redeemPfand', function(selectedItems)
|
RegisterNetEvent('pickle_consumables:server:redeemPfand', function(selectedItems)
|
||||||
|
@ -53,7 +53,8 @@ RegisterNetEvent('pickle_consumables:server:redeemPfand', function(selectedItems
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Hole verfügbare Pfand Items des Spielers
|
-- 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 src = source
|
||||||
local pfandItems = {}
|
local pfandItems = {}
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ RegisterCallback('pickle_consumables:server:getPfandItems', function(source, cb)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cb(pfandItems)
|
return pfandItems
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Hook für Item-Nutzung
|
-- Hook für Item-Nutzung
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue