JiminyKroket / Invhud

ESX_InventoryHUD rework
11 stars 12 forks source link

es_extended error on item use from hotbar #61

Closed bdxndev closed 3 years ago

bdxndev commented 3 years ago

image You get this error when using some items from your hotbar. Not all items.

bdxndev commented 3 years ago

Nevermind, the problem occured because they are not usable if you go to es_extended/server/main.lua and find 'esx:useItem' change:

RegisterNetEvent('esx:useItem') AddEventHandler('esx:useItem', function(itemName) local xPlayer = ESX.GetPlayerFromId(source) local count = xPlayer.getInventoryItem(itemName).count

if count > 0 then
    ESX.UseItem(source, itemName)
else
    xPlayer.showNotification(_U('act_imp'))
end

end)

to

RegisterNetEvent('esx:useItem') AddEventHandler('esx:useItem', function(itemName) local xPlayer = ESX.GetPlayerFromId(source) local count = xPlayer.getInventoryItem(itemName).count local canUse = xPlayer.getInventoryItem(itemName).usable

if count > 0 and canUse then
    ESX.UseItem(source, itemName)
else
    xPlayer.showNotification(_U('act_imp'))
end

end)