Full error:
Failed to call hook 'OnEnterZone' on plugin 'ParkorCode v1.0.0' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.ParkorCode.OnEnterZone (System.String ZoneID, BasePlayer player) [0x0003b] in <691f8d7732f2449c9dcc1784f0de299a>:0
at Oxide.Plugins.ParkorCode.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0008d] in <691f8d7732f2449c9dcc1784f0de299a>: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 <9882f28dc2204b4dba514a9ad18f5042>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <9882f28dc2204b4dba514a9ad18f5042>:0
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)This error happens when you walk into the zone. Tried to get more of the error from logs file but didn't change unless i looked in the wrong log file?
This is my code:
void OnEnterZone(string ZoneID, BasePlayer player) // Called when a player enters a zone
{
IPlayer iplayer = player as IPlayer;
if (ZoneID == _pluginConfig.zoneID && !Codes.ContainsKey(iplayer.Id))
{
var code = GenerateCode(_pluginConfig.CodeLength, _pluginConfig.CodeLowercase);
iplayer.Reply($"Congratulations! You have finished the parkour, To redeem your prize please join our <color=red>Discord</color>\n\n From there on, message our bot the code below!");
iplayer.Reply($"Here is your code <color=red>{code}</color>");
Codes.Add(iplayer.Id, code);
}
else return;
timer.In(_pluginConfig.CodeLifetime, () =>
{
if (Codes.ContainsKey(iplayer.Id))
{
Codes.Remove(iplayer.Id);
if (player != null) iplayer.Reply("Code Expired");
}
else return;
});
}