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 }
OnLootEntityEnd -> Get Looter Name
Discussion in 'Rust Development' started by azalea`, Mar 7, 2016.
-
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"); } } } -
No, because looter always is null.
-
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. -
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:
-
-
So the OnLootEntityEnd(...) hook is implemented in two places inside Rust.
First implementation is inside the LootableCorpse class:
Seems like everything is fine here, both the player and the LootableCorpse are passed in for use in plugins.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); }
Second implementation is inside the StorageContainer class:
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.Code:public virtual void PlayerStoppedLooting(BasePlayer player) { Interface.CallHook("OnLootEntityEnd", null); base.SetFlag(BaseEntity.Flags.Open, false); base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); }
Edit: Just saw you mentioned it above, as well. So yeah complete right.
-
So, I need to know assembler for add new parameters to the OnLootEntityEnd function?
-
No the oxide team just needs to fix the parameters passed into the hook.


