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?
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!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); } }
OnEntityDeath info initiator toPlayer()
Discussion in 'Rust Development' started by myles., Mar 23, 2017.