diff --git a/[esx]/es_extended/server/functions.lua b/[esx]/es_extended/server/functions.lua index 8bd40ffa..f6c4f4c3 100644 --- a/[esx]/es_extended/server/functions.lua +++ b/[esx]/es_extended/server/functions.lua @@ -311,8 +311,14 @@ end function ESX.UseItem(source, item, ...) if ESX.Items[item] then - if Core.UsableItemsCallbacks[item] then - Core.UsableItemsCallbacks[item](source, item, ...) + local itemCallback = Core.UsableItemsCallbacks[item] + + if itemCallback then + local success, result = pcall(itemCallback, source, item, ...) + + if not success then + return result and print(result) or print(('[^3WARNING^7] An error occured when using item ^5"%s"^7! This was not caused by ESX.'):format(item)) + end end else print(('[^3WARNING^7] Item ^5"%s"^7 was used but does not exist!'):format(item))