mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 02:08:55 +00:00
Use new boss menu + Add chest
This commit is contained in:
+118
-61
@@ -136,7 +136,15 @@ function OpenArmoryMenu(station)
|
||||
|
||||
if data.current.value == 'buy_weapons' then
|
||||
OpenBuyWeaponsMenu(station)
|
||||
end
|
||||
end
|
||||
|
||||
if data.current.value == 'put_stock' then
|
||||
OpenPutStocksMenu()
|
||||
end
|
||||
|
||||
if data.current.value == 'get_stock' then
|
||||
OpenGetStocksMenu()
|
||||
end
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
@@ -827,84 +835,121 @@ function OpenBuyWeaponsMenu(station)
|
||||
|
||||
end
|
||||
|
||||
function OpenBossActionsMenu()
|
||||
function OpenGetStocksMenu()
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.TriggerServerCallback('esx_policejob:getStockItems', function(items)
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'realestateagent',
|
||||
{
|
||||
title = PlayerData.job.grade_label,
|
||||
elements = {
|
||||
{label = _U('take_company_money'), value = 'withdraw_society_money'},
|
||||
{label = _U('deposit_money'), value = 'deposit_money'},
|
||||
}
|
||||
},
|
||||
function(data, menu)
|
||||
print(json.encode(items))
|
||||
|
||||
if data.current.value == 'withdraw_society_money' then
|
||||
local elements = {}
|
||||
|
||||
for i=1, #items, 1 do
|
||||
table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'stocks_menu',
|
||||
{
|
||||
title = 'Police Stock',
|
||||
elements = elements
|
||||
},
|
||||
function(data, menu)
|
||||
|
||||
local itemName = data.current.value
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount',
|
||||
'dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count',
|
||||
{
|
||||
title = _U('amount_of_withdrawal')
|
||||
title = 'Quantité'
|
||||
},
|
||||
function(data, menu)
|
||||
function(data2, menu2)
|
||||
|
||||
local amount = tonumber(data.value)
|
||||
local count = tonumber(data2.value)
|
||||
|
||||
if amount == nil then
|
||||
ESX.ShowNotification(_U('invalid_amount'))
|
||||
if count == nil then
|
||||
ESX.ShowNotification('Quantité invalide')
|
||||
else
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_society:withdrawMoney', 'police', amount)
|
||||
menu2.close()
|
||||
menu.close()
|
||||
OpenGetStocksMenu()
|
||||
|
||||
TriggerServerEvent('esx_policejob:getStockItem', itemName, count)
|
||||
end
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
function(data2, menu2)
|
||||
menu2.close()
|
||||
end
|
||||
)
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function OpenPutStocksMenu()
|
||||
|
||||
ESX.TriggerServerCallback('esx_policejob:getPlayerInventory', function(inventory)
|
||||
|
||||
local elements = {}
|
||||
|
||||
for i=1, #inventory.items, 1 do
|
||||
|
||||
local item = inventory.items[i]
|
||||
|
||||
if item.count > 0 then
|
||||
table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name})
|
||||
end
|
||||
|
||||
if data.current.value == 'deposit_money' then
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'dialog', GetCurrentResourceName(), 'deposit_money_amount',
|
||||
{
|
||||
title = _U('amount_of_deposit')
|
||||
},
|
||||
function(data, menu)
|
||||
|
||||
local amount = tonumber(data.value)
|
||||
|
||||
if amount == nil then
|
||||
ESX.ShowNotification(_U('invalid_amount'))
|
||||
else
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_society:depositMoney', 'police', amount)
|
||||
end
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
|
||||
menu.close()
|
||||
|
||||
CurrentAction = 'menu_boss_actions'
|
||||
CurrentActionMsg = _U('open_bossmenu')
|
||||
CurrentActionData = {}
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'stocks_menu',
|
||||
{
|
||||
title = 'Inventaire',
|
||||
elements = elements
|
||||
},
|
||||
function(data, menu)
|
||||
|
||||
local itemName = data.current.value
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count',
|
||||
{
|
||||
title = 'Quantité'
|
||||
},
|
||||
function(data2, menu2)
|
||||
|
||||
local count = tonumber(data2.value)
|
||||
|
||||
if count == nil then
|
||||
ESX.ShowNotification('Quantité invalide')
|
||||
else
|
||||
menu2.close()
|
||||
menu.close()
|
||||
OpenPutStocksMenu()
|
||||
|
||||
TriggerServerEvent('esx_policejob:putStockItems', itemName, count)
|
||||
end
|
||||
|
||||
end,
|
||||
function(data2, menu2)
|
||||
menu2.close()
|
||||
end
|
||||
)
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
@@ -1420,7 +1465,19 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if CurrentAction == 'menu_boss_actions' then
|
||||
OpenBossActionsMenu()
|
||||
|
||||
ESX.UI.menu.CloseAll()
|
||||
|
||||
TriggerEvent('esx_society:openBossMenu', 'police', function(data, menu)
|
||||
|
||||
menu.close()
|
||||
|
||||
CurrentAction = 'menu_boss_actions'
|
||||
CurrentActionMsg = _U('open_bossmenu')
|
||||
CurrentActionData = {}
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
if CurrentAction == 'remove_entity' then
|
||||
|
||||
Reference in New Issue
Block a user