Hi,
How to find sessions KillerName ?
Code:private void OnPlayerDeath(PlayerSession session, EntityEffectSourceData dataSource) { var prefix = $"<color={Config["ServerColor"]}>{Config["ServerName"]}</color>"; var textcolor = $"<color={Config["TextColor"]}>"; string name = session.Name; string KillerName = GetNameOfObject(dataSource.EntitySource); if (KillerName == "") { hurt.BroadcastChat(prefix, textcolor + (lang.GetMessage(dataSource.SourceDescriptionKey, this) ?? lang.GetMessage("Unknown", this)).Replace("{Name}", name) + "</color>"); } else { hurt.BroadcastChat(prefix, textcolor + (lang.GetMessage(dataSource.SourceDescriptionKey, this) ?? lang.GetMessage("player", this)).Replace("{Name}", name).Replace("{Killer}", KillerName) + "</color>"); } }
Solved Find session from dataSource.EntitySource
Discussion in 'Hurtworld Development' started by MonkeY12, Aug 2, 2017.