1. Rebajas

    Rebajas Scavenger

    Title says it all, I'm looking to detect how a player has died, specifically of environmental conditions e.g. cold, hunger, heat, radiation etc

    I found this in another plugin, but I'm not really sure how to use it:
    Code (Text):
    info.damageTypes.GetMajorityDamageType()
    I tried writing the contents to the console but I'm guessing it's an object because I just got an error.

    Thanks in advance.


    Tony.
     
  2. Fujikura

    Fujikura Grenade Master Plugin Developer

    Code (Text):
    info.damageTypes.GetMajorityDamageType().ToString()
     
  3. Rebajas

    Rebajas Scavenger

    Thanks - that worked a treat.

    I notice that OnPlayerDie triggers when the player is wounded in Rust. Is there a way to detect that the player has actually died?

    So just now a player was attacked by a bear and was wounded, OnPlayerDie was triggered - then when they actually died it was triggered again.
     
  4. k1lly0u

    k1lly0u Grenade Master Plugin Developer

    Code (C#):
    void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
    {
       var player = entity.ToPlayer();
       if (player != null)
       {
          // Do Stuff
       }
    }