1. I want to make a simple plugin that notifies the chat if an item has been taken out of the supply drop so they know it has been claimed...

    How would I do that? Been messing around with

    Code:
    void OnItemRemovedFromContainer(ItemContainer container, Item item)
    {
    if (container == "supply_drop") 
    Doesn't work....

    Neither does

    Code:
    if (container.ShortPrefabName == "supply_drop")
    Can someone give me a hand please? :) Thanks.
     
  2. Code:
    void OnItemRemovedFromContainer(ItemContainer container, Item item)
    {
    if (container.entityOwner is SupplyDrop)
     
  3. Thanks alot dude. :)
     
  4. Is there an easy way to make it so it only PrintToChat's once? Not every time an item is taken out. And also how to get player?
     
  5. I managed to get it working using OnEntityKill instead

    Code:
    void OnEntityKill(BaseNetworkable entity)
                {
                if (entity is SupplyDrop) {       
                PrintToChat("Supply drop has been claimed.");
               }
            }
    But how would I get the player that initiated it?
     
  6. Code:
    void OnEntityKill(BaseNetworkable entity)
            {
                var player = entity.net.connection.player as BasePlayer;
                if (entity is SupplyDrop)
                {
                    PrintToChat($"{player.displayName} has claimed a Supply Drop.");
                }
            }
    
    Your method isnt very good, try this.
    Code:
            private void OnExplosiveThrown(BasePlayer player, BaseEntity entity)
            {
                if (!(entity is SupplySignal))
                    return;
                PrintToChat($"{player.displayName} has thrown a Supply Signal!");
            }
    
    Oh sorry didn't read the title lol.
     
    Last edited by a moderator: Mar 9, 2018
  7. Tried it. Doesn't work...