1. Somebody tried to work with OnLootEntityEnd?

    How to get looter name? Looter in this example always null when I'm try to loot a furnace.
    Code:
    void OnLootEntityEnd(BasePlayer looter)
    {
       // looter = null
    }
     
    Last edited by a moderator: Mar 7, 2016
  2. I cant be 100% sure(made this without testing ingame) but this should work I think.
    Code:
    namespace Oxide.Plugins
    {
        [Info("Looter", "DylanSMR", "1.0.0", ResourceId = 3921)]
        class Looter : RustPlugin
        {
            void OnLootEntityEnd(BasePlayer looter)
            {
                BasePlayer player = looter.ToPlayer();
                SendReply(player, "Test");
            }   
        }
    }
     
  3. No, because looter always is null.
     
  4. Oh? Then try OnLootOpened or whatever that hook is(See docs):Sorry for lack of code to show, im at dinner currently
    [DOUBLEPOST=1457409440][/DOUBLEPOST]Or if your trying to find out who looted it, I think there is a few loot logger plugins that use the hook your using, see those.
     
  5. It has two oxide hooks, first without any arguments.
    Now, I'm get looter in OnItemAddedToContainer function.

    Thank you for trying to help.
     

    Attached Files:

  6. So the OnLootEntityEnd(...) hook is implemented in two places inside Rust.

    First implementation is inside the LootableCorpse class:
    Code:
    public void PlayerStoppedLooting(BasePlayer player)
    {
        object[] objArray = new object[] { player, this };
        Interface.CallHook("OnLootEntityEnd", objArray);
        base.ResetRemovalTime();
        base.SetFlag(BaseEntity.Flags.Open, false);
        base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
    }
    Seems like everything is fine here, both the player and the LootableCorpse are passed in for use in plugins.

    Second implementation is inside the StorageContainer class:
    Code:
    public virtual void PlayerStoppedLooting(BasePlayer player)
    {
        Interface.CallHook("OnLootEntityEnd", null);
        base.SetFlag(BaseEntity.Flags.Open, false);
        base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
    }
    Here it seems like someone accidentally passed null into the hook. At least I can't see why you wouldn't pass the player inside the hook. Probably needs fixing.

    Edit: Just saw you mentioned it above, as well. So yeah complete right. :p
     
  7. So, I need to know assembler for add new parameters to the OnLootEntityEnd function? :)
     
  8. No the oxide team just needs to fix the parameters passed into the hook.