OnLootItem is not being calledNot An Issue

void OnLootItem(BasePlayer player, Item item)

It's just never called. I tried both in RustPlugin and in CovalencePlugin

The hook is OnLootItem(PlayerLoot, Item). I don't think it has ever existed with BasePlayer.

I know this is an older post, but I'm having the same problem and haven't been able to find any solutions or other plugins that implement this hook. I have tried both of these hook signatures and neither of them work. The API for the hook states that it uses (BasePlayer, Item) as FBarbarian said. I also tried the (PlayerLoot, Item) hook but neither are called. I'm not sure if something has changed in the past year to where this hook no longer works. Wulf, do you have any updated information?

To maybe find an alternate solution, I'm specifically trying to check anytime a player picks up a specific item off the ground (using OnItemPickup, which is working as expected) or loots that specific item out of a container (using OnLootItem which isn't working.) Maybe I should be using a different hook? Any suggestion would be greatly appreciated.

l33tpr0digy

I know this is an older post, but I'm having the same problem and haven't been able to find any solutions or other plugins that implement this hook. I have tried both of these hook signatures and neither of them work. The API for the hook states that it uses (BasePlayer, Item) as FBarbarian said. I also tried the (PlayerLoot, Item) hook but neither are called. I'm not sure if something has changed in the past year to where this hook no longer works. Wulf, do you have any updated information?

To maybe find an alternate solution, I'm specifically trying to check anytime a player picks up a specific item off the ground (using OnItemPickup, which is working as expected) or loots that specific item out of a container (using OnLootItem which isn't working.) Maybe I should be using a different hook? Any suggestion would be greatly appreciated.

So, I think I may have found a better way of handling this issue. I never could make OnLootItem work, but as I started looking at the other hook names like OnLootEntity, OnLootPlayer, etc., I started thinking that OnLootItem wasn't actually picking up an item, but rather looting what's in an item. So, I turned to OnInventoryNetworkUpdate() to intercept specific items that a player would pickup either off the ground, from a container, or a player/npc body. Here's an example code that I got working for anyone else who may run across this same issue:

object OnInventoryNetworkUpdate(PlayerInventory inventory, ItemContainer container, ProtoBuf.UpdateItemContainer updateItemContainer, PlayerInventory.Type type, bool broadcast)
{
       string msgTemplate = "<color=orange>You found {x} Research Paper!</color>";
       int researchPaperQty = inventory.GetAmount(-544317637); // -544317637 is the item number for research paper
       if ( researchPaperQty > 0 )
       {
           inventory.Take(null, -544317637, researchPaperQty); // remove all the research paper from the user's inventory
           SendReply(inventory.baseEntity, msgTemplate.Replace("{x}", researchPaperQty.ToString())); // send a chat reply to the user
       }
       return null;
}

Docs have been updated, sorry about that. The correct signature is what I previously mentioned though. OnLootItem(PlayerLoot, Item)

This plugin does not use that hook though from what I can tell.

Locked automatically