Having a play, came across this issue, seems that it relates to the other hook issues or is this just a issue with my code? this worked fine (the hook for OnConsumeFuel) before i used Oxide.Core.Libraries.Covalence when i add Covalence and then the time check i get the error below, maybe its my code im not sure, thanks in advance for any assistance.
Protocol: 1995.145.1Code:(02:11:44) | Failed to call hook 'OnConsumeFuel' on plugin 'LightsOut v1.0.0' (NullReferenceException: Object reference not set to an instance of an object) (02:11:44) | at Oxide.Plugins.LightsOut.OnConsumeFuel (.BaseOven oven, .Item fuel, .ItemModBurnable burnable) [0x00000] in <filename unknown>:0 at Oxide.Plugins.LightsOut.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 hook, System.Object[] args) [0x00000] in <filename unknown>:0
Build Date: 07/03/2017 11:56:32
Unity Version: 5.6.0f3
Changeset: 21387
Branch: main
Oxide Version: 2.0.3355
Below works fine (no Oxide.Core.Libraries.Covalence refrence or TOD_Sky)
Code:void OnConsumeFuel(BaseOven oven, Item fuel, ItemModBurnable burnable) { oven.StopCooking(); }
Then i add Oxide.Core.Libraries.Covalence and TOD_Sky with the below code and it fails
Code:void OnConsumeFuel(BaseOven oven, Item fuel, ItemModBurnable burnable) { if (sky.Cycle.Hour < sky.SunriseTime) { oven.StopCooking(); } }
Thanks kindly,
Console
Solved NullReferenceException in my plugin
Discussion in 'Rust Development' started by ConsoleCOWBOY, Jul 6, 2017.