ed
This commit is contained in:
parent
55ce22c3de
commit
b960315876
2 changed files with 141 additions and 223 deletions
|
@ -6,7 +6,7 @@ local shredderPropModels = {
|
|||
'prop_bin_08a'
|
||||
}
|
||||
|
||||
-- List of prop models that should be targetable as trash bins with delayed deletion
|
||||
-- List of prop models that should be targetable as storage containers (formerly trash bins)
|
||||
local trashBinPropModels = {
|
||||
'prop_bin_01a',
|
||||
'prop_bin_03a',
|
||||
|
@ -59,14 +59,14 @@ Citizen.CreateThread(function()
|
|||
distance = 2.0
|
||||
})
|
||||
|
||||
-- Add target to trash bin props
|
||||
-- Add target to storage container props (formerly trash bins)
|
||||
exports['qb-target']:AddTargetModel(trashBinPropModels, {
|
||||
options = {
|
||||
{
|
||||
type = "client",
|
||||
event = "disposal:openInventory",
|
||||
icon = "fas fa-trash",
|
||||
label = "Mülltonne öffnen",
|
||||
icon = "fas fa-box-open",
|
||||
label = "Lager öffnen",
|
||||
action = function(entity)
|
||||
currentEntity = entity
|
||||
currentType = "trash"
|
||||
|
@ -79,8 +79,8 @@ Citizen.CreateThread(function()
|
|||
{
|
||||
type = "client",
|
||||
event = "disposal:openMenu",
|
||||
icon = "fas fa-clock",
|
||||
label = "Müll entsorgen",
|
||||
icon = "fas fa-archive",
|
||||
label = "Items lagern",
|
||||
action = function(entity)
|
||||
currentEntity = entity
|
||||
currentType = "trash"
|
||||
|
@ -94,7 +94,7 @@ Citizen.CreateThread(function()
|
|||
distance = 2.0
|
||||
})
|
||||
|
||||
print("^2[DISPOSAL]^7 Added QB-Target to " .. #shredderPropModels .. " shredder models and " .. #trashBinPropModels .. " trash bin models")
|
||||
print("^2[DISPOSAL]^7 Added QB-Target to " .. #shredderPropModels .. " shredder models and " .. #trashBinPropModels .. " storage container models")
|
||||
end)
|
||||
|
||||
-- Function to get container ID from entity
|
||||
|
@ -113,8 +113,8 @@ RegisterNetEvent('disposal:openInventory', function()
|
|||
|
||||
if not currentEntity or not DoesEntityExist(currentEntity) then
|
||||
lib.notify({
|
||||
title = currentType == "shredder" and 'Müllschredder' or 'Mülltonne',
|
||||
description = currentType == "shredder" and 'Kein Schredder gefunden!' or 'Keine Mülltonne gefunden!',
|
||||
title = currentType == "shredder" and 'Müllschredder' or 'Lager',
|
||||
description = currentType == "shredder" and 'Kein Schredder gefunden!' or 'Kein Lager gefunden!',
|
||||
type = 'error'
|
||||
})
|
||||
return
|
||||
|
@ -135,8 +135,8 @@ RegisterNetEvent('disposal:openMenu', function()
|
|||
|
||||
if not currentEntity or not DoesEntityExist(currentEntity) then
|
||||
lib.notify({
|
||||
title = currentType == "shredder" and 'Müllschredder' or 'Mülltonne',
|
||||
description = currentType == "shredder" and 'Kein Schredder gefunden!' or 'Keine Mülltonne gefunden!',
|
||||
title = currentType == "shredder" and 'Müllschredder' or 'Lager',
|
||||
description = currentType == "shredder" and 'Kein Schredder gefunden!' or 'Kein Lager gefunden!',
|
||||
type = 'error'
|
||||
})
|
||||
return
|
||||
|
@ -151,15 +151,15 @@ RegisterNetEvent('disposal:openMenu', function()
|
|||
end)
|
||||
|
||||
-- Show menu with items
|
||||
RegisterNetEvent('disposal:client:showMenu', function(items, containerID, type, timeRemaining)
|
||||
RegisterNetEvent('disposal:client:showMenu', function(items, containerID, type)
|
||||
-- Make sure items is a table
|
||||
items = items or {}
|
||||
|
||||
-- Check if items is empty
|
||||
if next(items) == nil then
|
||||
lib.notify({
|
||||
title = type == "shredder" and 'Müllschredder' or 'Mülltonne',
|
||||
description = type == "shredder" and 'Der Schredder ist leer!' or 'Die Mülltonne ist leer!',
|
||||
title = type == "shredder" and 'Müllschredder' or 'Lager',
|
||||
description = type == "shredder" and 'Der Schredder ist leer!' or 'Das Lager ist leer!',
|
||||
type = 'error'
|
||||
})
|
||||
return
|
||||
|
@ -168,32 +168,20 @@ RegisterNetEvent('disposal:client:showMenu', function(items, containerID, type,
|
|||
local menuOptions = {}
|
||||
|
||||
-- All items action option
|
||||
local actionText = type == "shredder" and "ALLE ITEMS VERNICHTEN" or "ALLE ITEMS ENTSORGEN"
|
||||
local actionText = type == "shredder" and "ALLE ITEMS VERNICHTEN" or "ALLE ITEMS LAGERN"
|
||||
local actionDesc = type == "shredder"
|
||||
and 'Vernichtet alle Items im Schredder permanent!'
|
||||
or 'Entsorgt alle Items in der Mülltonne (automatische Löschung nach Zeit)!'
|
||||
or 'Lagert alle Items im Container!'
|
||||
|
||||
table.insert(menuOptions, {
|
||||
title = '🔥 ' .. actionText,
|
||||
title = type == "shredder" and '🔥 ' .. actionText or '📦 ' .. actionText,
|
||||
description = actionDesc,
|
||||
icon = type == "shredder" and 'fire' or 'trash',
|
||||
icon = type == "shredder" and 'fire' or 'archive',
|
||||
onSelect = function()
|
||||
confirmDestroyAll(containerID, type)
|
||||
end
|
||||
})
|
||||
|
||||
-- If it's a trash bin with scheduled deletion, show the time remaining
|
||||
if type == "trash" and timeRemaining then
|
||||
local minutes = math.floor(timeRemaining / 60)
|
||||
local seconds = timeRemaining % 60
|
||||
|
||||
table.insert(menuOptions, {
|
||||
title = '⏱️ Automatische Leerung',
|
||||
description = string.format('In %d Minuten und %d Sekunden', minutes, seconds),
|
||||
disabled = true
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(menuOptions, {
|
||||
title = '─────────────────',
|
||||
description = 'Einzelne Items:',
|
||||
|
@ -208,7 +196,7 @@ RegisterNetEvent('disposal:client:showMenu', function(items, containerID, type,
|
|||
table.insert(menuOptions, {
|
||||
title = (item.label or item.name),
|
||||
description = 'Anzahl: ' .. item.amount .. ' | Slot: ' .. slot,
|
||||
icon = 'trash',
|
||||
icon = type == "shredder" and 'trash' or 'box',
|
||||
onSelect = function()
|
||||
confirmDestroySingle(item.name, item.amount, slot, containerID, type)
|
||||
end
|
||||
|
@ -218,8 +206,8 @@ RegisterNetEvent('disposal:client:showMenu', function(items, containerID, type,
|
|||
|
||||
if not hasItems then
|
||||
lib.notify({
|
||||
title = type == "shredder" and 'Müllschredder' or 'Mülltonne',
|
||||
description = type == "shredder" and 'Der Schredder ist leer!' or 'Die Mülltonne ist leer!',
|
||||
title = type == "shredder" and 'Müllschredder' or 'Lager',
|
||||
description = type == "shredder" and 'Der Schredder ist leer!' or 'Das Lager ist leer!',
|
||||
type = 'error'
|
||||
})
|
||||
return
|
||||
|
@ -227,7 +215,7 @@ RegisterNetEvent('disposal:client:showMenu', function(items, containerID, type,
|
|||
|
||||
lib.registerContext({
|
||||
id = 'disposal_menu',
|
||||
title = type == "shredder" and '🗑️ Müllschredder Verwaltung' or '🗑️ Mülltonne Verwaltung',
|
||||
title = type == "shredder" and '🗑️ Müllschredder Verwaltung' or '📦 Lager Verwaltung',
|
||||
options = menuOptions
|
||||
})
|
||||
|
||||
|
@ -236,19 +224,19 @@ end)
|
|||
|
||||
-- Confirm single item disposal
|
||||
function confirmDestroySingle(itemName, amount, slot, containerID, type)
|
||||
local actionText = type == "shredder" and "vernichten" or "entsorgen"
|
||||
local actionText = type == "shredder" and "vernichten" or "lagern"
|
||||
local actionDesc = type == "shredder"
|
||||
and (itemName .. ' (' .. amount .. 'x) wird permanent gelöscht!')
|
||||
or (itemName .. ' (' .. amount .. 'x) wird entsorgt und nach Zeit gelöscht!')
|
||||
or (itemName .. ' (' .. amount .. 'x) wird im Lager gespeichert!')
|
||||
|
||||
lib.registerContext({
|
||||
id = 'dispose_single_confirm',
|
||||
title = '⚠️ Item ' .. actionText .. '?',
|
||||
options = {
|
||||
{
|
||||
title = type == "shredder" and '🔥 Ja, vernichten' or '🗑️ Ja, entsorgen',
|
||||
title = type == "shredder" and '🔥 Ja, vernichten' or '📦 Ja, lagern',
|
||||
description = actionDesc,
|
||||
icon = 'check',
|
||||
icon = type == "shredder" and 'check' or 'box',
|
||||
onSelect = function()
|
||||
TriggerServerEvent('disposal:server:disposeSingle', itemName, amount, slot, containerID, type)
|
||||
end
|
||||
|
@ -269,19 +257,19 @@ end
|
|||
|
||||
-- Confirm all items disposal
|
||||
function confirmDestroyAll(containerID, type)
|
||||
local actionText = type == "shredder" and "VERNICHTEN" or "ENTSORGEN"
|
||||
local actionText = type == "shredder" and "VERNICHTEN" or "LAGERN"
|
||||
local actionDesc = type == "shredder"
|
||||
and 'ALLE Items im Schredder werden permanent gelöscht!'
|
||||
or 'ALLE Items in der Mülltonne werden nach Zeit automatisch gelöscht!'
|
||||
or 'ALLE Items werden im Lager gespeichert!'
|
||||
|
||||
lib.registerContext({
|
||||
id = 'dispose_all_confirm',
|
||||
title = '⚠️ WARNUNG ⚠️',
|
||||
title = type == "shredder" and '⚠️ WARNUNG ⚠️' or '📦 LAGERUNG',
|
||||
options = {
|
||||
{
|
||||
title = type == "shredder" and '🔥 JA, ALLES VERNICHTEN' or '🗑️ JA, ALLES ENTSORGEN',
|
||||
title = type == "shredder" and '🔥 JA, ALLES VERNICHTEN' or '📦 JA, ALLES LAGERN',
|
||||
description = actionDesc,
|
||||
icon = type == "shredder" and 'fire' or 'trash',
|
||||
icon = type == "shredder" and 'fire' or 'archive',
|
||||
onSelect = function()
|
||||
TriggerServerEvent('disposal:server:disposeAll', containerID, type)
|
||||
end
|
||||
|
@ -303,7 +291,7 @@ end
|
|||
-- Success notification with effect
|
||||
RegisterNetEvent('disposal:client:itemDisposed', function(message, type)
|
||||
lib.notify({
|
||||
title = type == "shredder" and 'Müllschredder' or 'Mülltonne',
|
||||
title = type == "shredder" and 'Müllschredder' or 'Lager',
|
||||
description = message,
|
||||
type = 'success',
|
||||
duration = 4000
|
||||
|
@ -320,13 +308,13 @@ RegisterNetEvent('disposal:client:itemDisposed', function(message, type)
|
|||
|
||||
UseParticleFxAssetNextCall("core")
|
||||
|
||||
-- Different effects for shredder vs trash
|
||||
-- Different effects for shredder vs storage
|
||||
if type == "shredder" then
|
||||
-- More intense effect for shredder
|
||||
StartParticleFxNonLoopedAtCoord("ent_sht_flame", coords.x, coords.y, coords.z + 1.0, 0.0, 0.0, 0.0, 1.0, false, false, false)
|
||||
PlaySoundFrontend(-1, "CHECKPOINT_PERFECT", "HUD_MINI_GAME_SOUNDSET", 1)
|
||||
else
|
||||
-- Subtle effect for trash
|
||||
-- Subtle effect for storage
|
||||
StartParticleFxNonLoopedAtCoord("ent_sht_dust", coords.x, coords.y, coords.z + 0.5, 0.0, 0.0, 0.0, 1.0, false, false, false)
|
||||
PlaySoundFrontend(-1, "PICK_UP", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue