Hurting players if Container isn't fully LootedSolved
hey guys

i've tried to make a plugin that hurts players after they looted a chest not fully.
no idea how i detect "closing storage"

i tried something like this:

        void OnItemRemovedFromContainer(ItemContainer container, Item item, BasePlayer player) {
            if ((container == null) || (item == null) || (player == null)) return;
            int _containerCount = container.itemList.Count;
            if (container.itemList.Count != 0) {
                // this will always count
            }
        }

        void OnLootEntity(BasePlayer player, BaseEntity entity) {
            if (entity == null || player == null) return;
            LootContainer container = entity as LootContainer;
            int count = 0;
            if (container) {
                foreach (var item in container.inventory.itemList) {
                    count++;
                }
            }
            lootcontroll.Add(new LootControl((int)player.userID, count));
        }​


but i dont find a way how to detect when he closing/leaving the container, so it will hurt him anytime he picks a item...

thanks!
In response to Arrow ():
hey guys

i've tried to make a plugin that hurts players after they looted a chest not ful...
OnPlayerLootEnd
  • Called when the player stops looting
  • No return behavior
void OnPlayerLootEnd(PlayerLoot inventory)
{
    Puts("OnPlayerLootEnd works!");
}

also

OnLootEntityEnd
  • Called when the player stops looting an entity
  • No return behavior
void OnLootEntityEnd(BasePlayer player, BaseCombatEntity entity)
{
    Puts("OnLootEntityEnd works!");
}
In response to Orange ():
OnPlayerLootEndCalled when the player stops lootingNo return behaviorvoid OnPlayerLootEnd(Pla...
Ahhhhh, thank you!
In response to Arrow ():
Ahhhhh, thank you!
Mark this thread as "Solved"
In response to Arrow ():
Ahhhhh, thank you!
you are welcome
Locked automatically