Oxide error: Failed to call hook 'IOnBasePlayerAttacked'
Failed to call hook 'IOnBasePlayerAttacked' on plugin 'RustCore v2.0.5648' (NullReferenceException: )
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000fb] in <bae5f1223fce49c493b01571c99dce02>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <bae5f1223fce49c493b01571c99dce02>:0  
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object)
  at UnityEngine.Object.get_name () [0x00001] in <745c4d442eef4e08b35b5975d62d89d1>:0 
  at CombatLog.Log (BaseEntity attacker, AttackEntity weapon, BaseCombatEntity hitEntity, System.String description, Projectile projectilePrefab, System.Int32 projectileId, System.Single healthOld, HitInfo hitInfo) [0x00125] in <b8d4152df172449199af1593a758e79d>:0 
  at CombatLog.LogAttack (HitInfo info, System.String description, System.Single oldHealth) [0x00000] in <b8d4152df172449199af1593a758e79d>:0 
  at BasePlayer.OnAttacked (HitInfo info) [0x0038a] in <b8d4152df172449199af1593a758e79d>:0 
  at BasePlayer.OnProjectileAttack (BaseEntity+RPCMessage msg) [0x011ec] in <b8d4152df172449199af1593a758e79d>:0 
  at BasePlayer.OnRpcMessage (BasePlayer player, System.UInt32 rpc, Network.Message msg) [0x00721] in <b8d4152df172449199af1593a758e79d>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
BasePlayer:OnRpcMessage(BasePlayer, UInt32, Message)
BaseEntity:SV_RPCMessage(UInt32, Message)
ServerMgr:OnRPCMessage(Message)
ServerMgr:OnNetworkMessage(Message)
Facepunch.Network.Raknet.Server:ConnectedPacket(Connection)
Facepunch.Network.Raknet.Server:Cycle()
ServerMgr:Update()
 
(Filename: <745c4d442eef4e08b35b5975d62d89d1> Line: 0)

The error is actually coming from your plugin or another using that hook. Looking at your code, I see a few missing null checks there the exception could be from. Make sure to null check anything that isn't directly provided by the hook call, including any casts made to other types.

If you noticed an error in the CombatLog.Log function, it takes a null value in one of the parameters. I know at least 1 server that has a similar problem. There are no errors in my code, since it has been working without errors for 2 years before the September update. And you can see for yourself - the error is in your hook when it calls BasePlayer.OnAttack. I ask you to help because the error occurs several times an hour in a dynamic game mode.

Thanks



Merged post

If the error was from my plugin, we would see "Failed to call hook OnEntityTakeDamage'", but we see "Failed to call hook 'IOnBasePlayerAttacked"

Merged post

This error can only appear when calling BasePlayer.OnAttacked

Merged post

Video review of the bug (2 videos):
https://www.youtube.com/watch?v=9GmHEXpOU3A
https://www.youtube.com/watch?v=AkeKPvhzy8o

Bug Details:
1. We run the server on any map, example: https://cdn.discordapp.com/attachments/797797687722115084/1005058701264171108/FUNRUST_v6.map
(There should be a flat area on the map and 2 players with a distance of 100 meters between them)
2. Uploading the Oxide plugin to the server: https://pastebin.com/kvvDD5gy
3. 2 players connect to server and stand at distance of 100 meters
4. Players pick up AK-47 and start shooting each other in the head
5. After 10-60 seconds, one of them will be kicked with the error OnProjectileAttack

Merged post

Screenshots with bug from servers:

UKN: GPMzrYrWPtDJ0QF.png

PERFECT AIM: Uk8j7HPnpiNGaNh.png

 

Also my server - FUNRUST:

lc9bMi7ozQZPNu2.png