If you want to add throwing feature to usable items, you should follow this step
Step 1: Find the code of the item used on the server side
In this example I will show qb-smallresources/server/consumables.lua which is available in qb-core
for k, _ in pairs(Config.Consumables.eat) do
QBCore.Functions.CreateUseableItem(k, function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if not Player.Functions.RemoveItem(item.name, 1, item.slot) then return end
TriggerClientEvent('consumables:client:Eat', source, item.name)
end)
end
When item is used, this event consumables:client:Eat is triggered on the client side and the name of the item goes client side.
Step 2: Modify Event
After finding the event going to the client, you should add the export below to the head of the event.
if not exports["rm_throw"]:useableItem(itemName) then
return
end