i am working on a script that involves gathering food from various sources, i am to the point where i get the item into my inventory and it is usable, but i get a esx_status error when i try to get the player to use it…
ESX.RegisterUsableItem(‘item’, function(source)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem('item', 1)
TriggerEvent('esx_status:getStatus', xPlayer.source, 'hunger', function(status)
status.add(50000)
status.updateClient()
TriggerClientEvent('esx_basicneeds:onEat', xPlayer.source)
TriggerClientEvent('esx_xxxxx:onEatitem', xPlayer.source)
TriggerClientEvent('esx:showNotification', xPlayer.source, 'You ate an item')
end)
end)
that is it so far, but it doesnt work, any help is appreciated