ed
This commit is contained in:
parent
dfe7a276b1
commit
d21fa8d470
3 changed files with 118 additions and 16 deletions
|
@ -113,7 +113,11 @@ end)
|
|||
|
||||
-- Menü mit Items anzeigen
|
||||
RegisterNetEvent('shredder:client:showMenu', function(items, shredderID)
|
||||
if not items or #items == 0 then
|
||||
-- Make sure items is a table
|
||||
items = items or {}
|
||||
|
||||
-- Check if items is empty
|
||||
if next(items) == nil then
|
||||
lib.notify({
|
||||
title = 'Müllschredder',
|
||||
description = 'Der Schredder ist leer!',
|
||||
|
@ -141,8 +145,10 @@ RegisterNetEvent('shredder:client:showMenu', function(items, shredderID)
|
|||
})
|
||||
|
||||
-- Einzelne Items zum Menü hinzufügen
|
||||
local hasItems = false
|
||||
for slot, item in pairs(items) do
|
||||
if item and item.amount and item.amount > 0 then
|
||||
hasItems = true
|
||||
table.insert(menuOptions, {
|
||||
title = (item.label or item.name),
|
||||
description = 'Anzahl: ' .. item.amount .. ' | Slot: ' .. slot,
|
||||
|
@ -154,6 +160,15 @@ RegisterNetEvent('shredder:client:showMenu', function(items, shredderID)
|
|||
end
|
||||
end
|
||||
|
||||
if not hasItems then
|
||||
lib.notify({
|
||||
title = 'Müllschredder',
|
||||
description = 'Der Schredder ist leer!',
|
||||
type = 'error'
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
lib.registerContext({
|
||||
id = 'shredder_menu',
|
||||
title = '🗑️ Müllschredder Verwaltung',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue