lua:
RegisterNetEvent('police:client:EvidenceStashDrawer', function(data)
local currentEvidence = data.number
local currentType = data.type
local pos = GetEntityCoords(PlayerPedId())
local takeLoc = Config.Locations["evidence"][currentEvidence]
if not takeLoc then return end
if #(pos - takeLoc) <= 1.0 then
if currentType == 'drawer' then
local drawer = lib.inputDialog({
heading = Lang:t('info.evidence_stash', { value = currentEvidence }), -- 正确使用 Lang:t 函数和格式化字符串
submitText = Lang:t('info.slot'), -- 假设 'menu.open' 是您想要的提交按钮文本
rows = {
{
type = 'input', -- 输入类型为 'input'
label = Lang:t('info.slot'), -- 假设 'info.slot' 是输入框的标签文本
name = 'slot', -- 输入框的名称
required = true, -- 输入框是否必填
placeholder = "Enter slot number" -- 提供一个占位符
}
},
options = {
allowCancel = true -- 允许用户取消
}
})
if drawer then
if not drawer.slot then return end
if Config.Inventory == 'ox_inventory' then
local id = 'policedrawer_' .. drawer.slot
local name = Lang:t('info.current_evidence', { value = currentEvidence, value2 = drawer.slot })
TriggerServerEvent('police:server:openStash', id, name)
elseif Config.Inventory == 'new-ps-inventory' then
local id = 'policedrawer_' .. drawer.slot
TriggerServerEvent('qb-policejob:server:OpenOtherInventory', id)
else
TriggerServerEvent("inventory:server:OpenInventory", "stash",
Lang:t('info.current_evidence', { value = currentEvidence, value2 = drawer.slot }), {
maxweight = 4000000,
slots = 500,
})
TriggerEvent("inventory:client:SetCurrentStash",
Lang:t('info.current_evidence', { value = currentEvidence, value2 = drawer.slot }))
end
else
return
end
elseif currentType == 'stash' then
if Config.Inventory == 'ox_inventory' then
local id = 'generalevidence_' .. currentEvidence
local name = Lang:t('info.general_current_evidence', { value = currentEvidence })
TriggerServerEvent('police:server:openStash', id, name)
elseif Config.Inventory == 'new-ps-inventory' then
local id = 'generalevidence_' .. currentEvidence
TriggerServerEvent('qb-policejob:server:OpenOtherInventory', id)
else
TriggerServerEvent("inventory:server:OpenInventory", "stash",
Lang:t('info.general_current_evidence', { value = currentEvidence }),
{ maxweight = 4000000, slots = 300, })
TriggerEvent("inventory:client:SetCurrentStash",
Lang:t('info.general_current_evidence', { value = currentEvidence }))
end
end
else
ContextSystem.Close()
end
end)