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:
I tried writing the contents to the console but I'm guessing it's an object because I just got an error.Code:info.damageTypes.GetMajorityDamageType()
Thanks in advance.
Tony.
Detecting how a player died e.g. cold
Discussion in 'Rust Development' started by Rebajas, Jan 11, 2017.
-
Code:
info.damageTypes.GetMajorityDamageType().ToString()
-
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. -
Code:
void OnEntityDeath(BaseCombatEntity entity, HitInfo info) { var player = entity.ToPlayer(); if (player != null) { // Do Stuff } }