mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Add usable items
This commit is contained in:
@@ -858,7 +858,7 @@ ESX.ShowInventory = function()
|
||||
local elements = {}
|
||||
|
||||
if data.current.usable then
|
||||
table.insert(elements, {label = 'Utiliser', action = 'use', type = data.current.type, value = data.current.value})
|
||||
table.insert(elements, {label = 'Utiliser', action = 'use', type = data.current.type, value = data.current.value})
|
||||
end
|
||||
|
||||
table.insert(elements, {label = 'Donner', action = 'give', type = data.current.type, value = data.current.value})
|
||||
@@ -941,6 +941,10 @@ ESX.ShowInventory = function()
|
||||
|
||||
end
|
||||
|
||||
elseif data.current.action == 'use' then
|
||||
|
||||
TriggerServerEvent('esx:useItem', data.current.value)
|
||||
|
||||
elseif data.current.action == 'return' then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.ShowInventory()
|
||||
|
||||
@@ -490,6 +490,11 @@ AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx:useItem')
|
||||
AddEventHandler('esx:useItem', function(item)
|
||||
ESX.UseItem(source, item)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx:getPlayerData', function(source, cb)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
Reference in New Issue
Block a user