mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Use new boss menu + Add chest
This commit is contained in:
+135
-64
@@ -96,12 +96,12 @@ function OpenMecanoActionsMenu()
|
||||
local elements = {
|
||||
{label = 'Sortir Véhicule', value = 'vehicle_list'},
|
||||
{label = 'Tenue de travail', value = 'cloakroom'},
|
||||
{label = 'Tenue civile', value = 'cloakroom2'}
|
||||
{label = 'Tenue civile', value = 'cloakroom2'},
|
||||
{label = 'Déposer Stock', value = 'put_stock'},
|
||||
{label = 'Prendre Stock', value = 'get_stock'}
|
||||
}
|
||||
if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then
|
||||
table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'})
|
||||
table.insert(elements, {label = 'Déposer argent ', value = 'deposit_money'})
|
||||
table.insert(elements, {label = 'Blanchir argent', value = 'wash_money'})
|
||||
table.insert(elements, {label = 'Action Patron', value = 'boss_actions'})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
@@ -187,68 +187,20 @@ function OpenMecanoActionsMenu()
|
||||
end)
|
||||
end
|
||||
|
||||
if data.current.value == 'withdraw_society_money' then
|
||||
ESX.UI.Menu.Open(
|
||||
'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount',
|
||||
{
|
||||
title = 'Montant du retrait'
|
||||
},
|
||||
function(data, menu)
|
||||
local amount = tonumber(data.value)
|
||||
if amount == nil then
|
||||
ESX.ShowNotification('Montant invalide')
|
||||
else
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_society:withdrawMoney', 'mecano', amount)
|
||||
end
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
if data.current.value == 'put_stock' then
|
||||
OpenPutStocksMenu()
|
||||
end
|
||||
|
||||
if data.current.value == 'get_stock' then
|
||||
OpenGetStocksMenu()
|
||||
end
|
||||
|
||||
if data.current.value == 'boss_actions' then
|
||||
TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end
|
||||
|
||||
if data.current.value == 'deposit_money' then
|
||||
ESX.UI.Menu.Open(
|
||||
'dialog', GetCurrentResourceName(), 'deposit_money_amount',
|
||||
{
|
||||
title = 'Montant du dépôt'
|
||||
},
|
||||
function(data, menu)
|
||||
local amount = tonumber(data.value)
|
||||
if amount == nil then
|
||||
ESX.ShowNotification('Montant invalide')
|
||||
else
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_society:depositMoney', 'mecano', amount)
|
||||
end
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
if data.current.value == 'wash_money' then
|
||||
ESX.UI.Menu.Open(
|
||||
'dialog', GetCurrentResourceName(), 'wash_money_amount',
|
||||
{
|
||||
title = 'Montant à blanchir'
|
||||
},
|
||||
function(data, menu)
|
||||
local amount = tonumber(data.value)
|
||||
if amount == nil then
|
||||
ESX.ShowNotification('Montant invalide')
|
||||
else
|
||||
menu.close()
|
||||
TriggerServerEvent('esx_society:washMoney', 'mecano', amount)
|
||||
end
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
end
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
@@ -643,6 +595,125 @@ function OpenMobileMecanoActionsMenu()
|
||||
)
|
||||
end
|
||||
|
||||
function OpenGetStocksMenu()
|
||||
|
||||
ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items)
|
||||
|
||||
print(json.encode(items))
|
||||
|
||||
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 = 'Mecano Stock',
|
||||
elements = elements
|
||||
},
|
||||
function(data, menu)
|
||||
|
||||
local itemName = data.current.value
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'dialog', GetCurrentResourceName(), 'stocks_menu_get_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()
|
||||
OpenGetStocksMenu()
|
||||
|
||||
TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count)
|
||||
end
|
||||
|
||||
end,
|
||||
function(data2, menu2)
|
||||
menu2.close()
|
||||
end
|
||||
)
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function OpenPutStocksMenu()
|
||||
|
||||
ESX.TriggerServerCallback('esx_mecanojob: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
|
||||
|
||||
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_mecanojob:putStockItems', itemName, count)
|
||||
end
|
||||
|
||||
end,
|
||||
function(data2, menu2)
|
||||
menu2.close()
|
||||
end
|
||||
)
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
RegisterNetEvent('esx_mecanojob:onHijack')
|
||||
AddEventHandler('esx_mecanojob:onHijack', function()
|
||||
local playerPed = GetPlayerPed(-1)
|
||||
|
||||
Reference in New Issue
Block a user