I am attempting to create a plugin that removes entities based on what you fire at using a custom weapon I've created.
When I fire at any recognizable entity, like a BasicBuildingStructure, BuildingStructure, Door, OreResourceEntity, etc. I don't get any NullReferenceExceptions. But, when I shoot the terrain, I get this error:
Failed to call hook 'OnPlayerAttack' on plugin 'AdminGun v0.1.0' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.AdminGun.OnPlayerAttack (BasePlayer attacker, HitInfo info) [0x0002b] in <77adcaa4e6884b909102b8f38d2dc000>:0
at Oxide.Plugins.AdminGun.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0019c] in <77adcaa4e6884b909102b8f38d2dc000>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <60c318df79ed41688ea59335e48d61ad>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <50629aa0e75d4126b345d8d9d64da28d>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <50629aa0e75d4126b345d8d9d64da28d>:0Is there a way that I can get the Type of the terrain, so that I can do an if check, and if I can determine the HitInfo of the terrain I can tell it to return null?
I've tried having the plugin PrintToChat each hitInfo.HitEntity.GetEntity().toString() to read what each entity is, but it gives nothing when I hit the terrain.
Thanks!