Hook for when a player loots an item

I'm trying to find a way to send a message to a player when they get a certain item, but can't find a hook what can let me do this. I was going to use the OnLootItem hook, but it doesn't provide a BasePlayer object so the plugin doesn't know who to send the message to. My plugin is supposed to do this when a player gets an item in any way possible, including picking it up off the floor and removing it from a lootable container. Is there any way to do this?

i would give the plugin AdvanceGather a look through since it uses a system that gives you an item upon interacting with stuff you might find what your looking for somwhere in that script

I'm pretty sure you can get the BasePlayer from PlayerLoot.

wXLxOgFUEnSjh1r.png 0x89A

I'm pretty sure you can get the BasePlayer from PlayerLoot.

How would I do that? It seems like there isn't any way to from what Visual Studio is showing:

public class PlayerLoot : EntityComponent<BasePlayer>
{
    public BaseEntity entitySource;
    public Item itemSource;
    public List<ItemContainer> containers;
    public bool PositionChecks;

    public PlayerLoot();

    public void AddContainer(ItemContainer container);
    public void Check();
    public void Clear();
    public ItemContainer FindContainer(uint id);
    public Item FindItem(uint id);
    public bool IsLooting();
    public void MarkDirty();
    public override bool OnRpcMessage(BasePlayer player, uint rpc, Message msg);
    public void RemoveContainer(ItemContainer container);
    public bool RemoveContainerAt(int index);
    public void SendImmediate();
    public bool StartLootingEntity(BaseEntity targetEntity, bool doPositionChecks = true);
    public void StartLootingItem(Item item);
}​


Merged post

After doing some more reading it seems like this should work:
BasePlayer player = playerLoot?.GetComponent("BasePlayer") as BasePlayer;​

Now I'm running into a problem where the OnLootItem hook never actually fires. Just to make sure, is it supposed to be triggered when a player takes an item from a crate or something?