1. Hi,

    Written a simple plugin which broadcasts to chat when the heli is taken down. Works fine, however I'd like to take it one step further. Assuming the heli was killed by a player, I'd like to announce that the heli was taken down by said player.

    I have the below so far - is it about right?

    Code:
    void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
        {
            if (!entity is BaseHelicopter) return;        if (info.Initiator is BasePlayer && entity is BaseHelicopter)
            {
                if (info.Initiator?.ToPlayer() != null)
                {
                    name = info.Initiator.ToPlayer().displayName;
                }
                    rust.BroadcastChat("Patrol Helicopter has been taken down by" + name);
            }
        }
    I tried setting up a dev environment in VS2015 try and see if it would help me figure out what info was available in the info arg but resharper has completely blown up and I'm currently re-installing!
     
  2. Code:
            void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
            {
                var killerPlayer = info?.Initiator?.ToPlayer();
                if(entity is BaseHelicopter && killerPlayer.IsValid())
                    rust.BroadcastChat("Patrol Helicopter has been taken down by " + killerPlayer.displayName);
            }
    This should work.

    Edit: Fixed code
     
  3. Thanks man, gone for a kind of combination between the two. :)