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:
@@ -275,4 +275,83 @@ ESX.RegisterUsableItem('carokit', function(source)
|
||||
TriggerClientEvent('esx_mecanojob:onCarokit', _source)
|
||||
TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de carosserie')
|
||||
|
||||
end)
|
||||
|
||||
----------------------------------
|
||||
---- Ajout Gestion Stock Boss ----
|
||||
----------------------------------
|
||||
|
||||
RegisterServerEvent('esx_mecanojob:getStockItem')
|
||||
AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
|
||||
|
||||
local item = inventory.getItem(itemName)
|
||||
|
||||
if item.count >= count then
|
||||
inventory.removeItem(itemName, count)
|
||||
xPlayer.addInventoryItem(itemName, count)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide')
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez retiré x' .. count .. ' ' .. item.label)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
|
||||
cb(inventory.items)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
-------------
|
||||
-- AJOUT 2 --
|
||||
-------------
|
||||
|
||||
RegisterServerEvent('esx_mecanojob:putStockItems')
|
||||
AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
|
||||
|
||||
local item = inventory.getItem(itemName)
|
||||
|
||||
if item.count >= 0 then
|
||||
xPlayer.removeInventoryItem(itemName, count)
|
||||
inventory.addItem(itemName, count)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide')
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ajouté x' .. count .. ' ' .. item.label)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
--ESX.RegisterServerCallback('esx_mecanojob:putStockItems', function(source, cb)
|
||||
|
||||
-- TriggerEvent('esx_addoninventory:getSharedInventory', 'society_policestock', function(inventory)
|
||||
-- cb(inventory.items)
|
||||
-- end)
|
||||
|
||||
--end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, cb)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local items = xPlayer.inventory
|
||||
|
||||
cb({
|
||||
items = items
|
||||
})
|
||||
|
||||
end)
|
||||
Reference in New Issue
Block a user