Add usable items

This commit is contained in:
Jérémie N'gadi
2017-08-08 21:35:51 +02:00
parent e065a26e46
commit a2ef3b0aa0
2 changed files with 10 additions and 1 deletions
@@ -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)