immediately after installing the plugin
[DOUBLEPOST=1457427340][/DOUBLEPOST]maybe I made a mistake ?
using System;
using System.Collections.Generic;
using CodeHatch.Engine.Networking;
using CodeHatch.Networking.Events.Entities;
using CodeHatch.Engine.Core.Cache;
using System.Linq;
using Oxide.Core;
using CodeHatch.Damaging;
namespace Oxide.Plugins
{
[Info("Death Messages", "PaiN", 0.4, ResourceId = 1042)]
[Description("Displays a server wide message showing who killed who")]
class DeathMessages : ReignOfKingsPlugin
{
private List<string>DamageT = new List<string>{"Slash","Bash","Pierce","Projectile"};
void OnEntityDeath(EntityDeathEvent e)
{
if(e.Entity == null || e.KillingDamage.DamageSource == null || e == null || e.Entity.IsPlayer == false || e.KillingDamage.DamageSource.Owner.IsServer || e.Entity.Owner.IsServer) return;
foreach(string dmgt in DamageT)
if(e.KillingDamage.DamageTypes.ToString() == dmgt)
PrintToChat($"[0083FF]{e.KillingDamage.DamageSource.Owner.DisplayName} [EE0000]killed[0083FF] {e.Entity.Owner.DisplayName}[FFFFFF]");
}
}
}
[DOUBLEPOST=1457643849,1457426846][/DOUBLEPOST]Up

Death Messages
Displays a server wide messages of deaths.
Total Downloads: 2,408 - First Release: May 23, 2015 - Last Update: Mar 8, 2018
- 5/5, 5 likes
-
-
Not work. ;(
-
-
-
I just started downloading the server so if you want to help add me on steam Steam Community :: PaiN -
-
-
-
-
I think, either the game, or oxide had some changes in the last updates.
Almost all older plugins who revolve around death (eg Bountytracker) throw a null in certain cases (for most plugins this would be lethal impact/falling damage).
J
edit:
and come to think of that:
when a "e.Damage.DamageSourceOwner" is declared, i think it always will throw an exception at OnEntityHealthChange when it comes to falling, because there is no "real" DamageSource (because Terrain is no Entity) and no DamageSourceOwner (because the Terrain is not even owned by the server)
just a logical conclusion, could as well be total rubbish.
I'm gonna try that out.
j
edit 2:
So my conclusion:
I tested the above and was successful.
If any of your plugins use:
OnEntityHealthChange
or
OnEntityDeath
and declare a "DamageSource"
(for OnEntityHealthChange it is e.Damage.DamageSource, for OnEntityDeath it is e.KillingDamage.DamageSource)
and/or a respective "Owner"
you should add the following null checks:
Code:if (damageEvent.Damage.DamageSource == null || damageEvent.Damage.DamageSource.Owner == null) { return; }
Code:if (deathEvent.KillingDamage.DamageSource == null || deathEvent.KillingDamage.DamageSource.Owner == null) { return; }
JLast edited by a moderator: Jul 25, 2016 -
-
(did you try to compile ?) and the second ones I already check for them but you just added .Owner at the end.
-
PaiN updated Death Messages with a new update entry:
0.5
-
for all my plugins, this works perfect
if it does for you, too: glad i could help.
if it does not: Sorry I am not a programmer -
14:52 [Error] Failed to call hook 'OnEntityDeath' on plugin 'DeathMessages v0.5.0' (NullReferenceException: Object reference not set to an instance of an object)
14:52 [Debug] at Oxide.Plugins.DeathMessages.OnEntityDeath (CodeHatch.Networking.Events.Entities.EntityDeathEvent e) [0x00000] in <filename unknown>:0
at Oxide.Plugins.DeathMessages.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 -
Is there anyone alive ?
-
-
-