Solved Decay Ticks causing ArgumentNullException for On_EntityHurt hook

.phase

Member
Member
Jul 29, 2014
58
12
8
Southern California
This might be in the Magma forums, but it may be a good idea to refresh it here.

Is there a way to check for decay damage type. Every time the server decay ticks, I get the following error message:

[MagmaPlugin] Error invoking function On_EntityHurt in Remover plugin.
ArgumentNullException: null key
Parameter name: key
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
This might be in the Magma forums, but it may be a good idea to refresh it here.

Is there a way to check for decay damage type. Every time the server decay ticks, I get the following error message:

[MagmaPlugin] Error invoking function On_EntityHurt in Remover plugin.
ArgumentNullException: null key
Parameter name: key
Also got that,
Only seemed to happen on the BaseHome plugin when a player tryed to set a base in someone elses house.
 

.phase

Member
Member
Jul 29, 2014
58
12
8
Southern California
So, I thought just IsDecay handled the errors, but I just wasn't looking hard enough, or at the right time. There was no decay going on during the active hour when I was testing things, so I assumed the errors went away after the implementation.

Since I was checking for e.Attacker.SteamID, I needed to handle the null instances, i.e. the decay ticks. This does the trick:

JavaScript:
if(e.Attacker.SteamID != null && !e.IsDecay){}