NullReferenceException at GetPlayTimeFixed
 Failed to call hook 'GetPlayTime' on plugin 'PlaytimeTracker v0.2.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlaytimeTracker.GetPlayTime (System.String id) [0x00000] in <24c767516106490cb437845c374f36ad>:0 
  at Oxide.Plugins.PlaytimeTracker.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00309] in <24c767516106490cb437845c374f36ad>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0

This spams on serevr load. not sure if it's important or not. But it's been a thing. Figured I should mention it.

Ive also been getting this.

same. I wondered about this. could it be related to a player that hasn't logged in for awhile?

same error

Same, lots of spam on server load.

I had this last night. 

dito just now but only after a restart

This would likely indicate that your data is corrupt for the plugin or whatever is calling that method isn't passing a valid arg.

Having to lose years of player playtime would really suck. I use this plugin to grant access on some other plugins based on time. But it is what it is I suppose.

4Puzba2XkFbNCZR.jpg thepiercedweirdo

Having to lose years of player playtime would really suck. I use this plugin to grant access on some other plugins based on time. But it is what it is I suppose.

I would check to see if you have any ohter plugins using the GetPlaytime method in this plugin first.
dsHFRYFVm9wS03e.jpg Wulf
I would check to see if you have any ohter plugins using the GetPlaytime method in this plugin first.

GetPlaytime comes up for me only for ServerRewards, PlayerRanks, PlayTimeTracker, and Guardian.

In my case, the error message comes up after a server restart. It happens for about 5 minutes and spams my log with about 16,000 lines. Then the error stops and I presume the plugin works fine.

I'd imagine if it was a corrupt data file it would continue to error out constantly.

2uqbTuR5XAiLdv5.png Bumfuzzler

GetPlaytime comes up for me only for ServerRewards, PlayerRanks, PlayTimeTracker, and Guardian.

In my case, the error message comes up after a server restart. It happens for about 5 minutes and spams my log with about 16,000 lines. Then the error stops and I presume the plugin works fine.

I'd imagine if it was a corrupt data file it would continue to error out constantly.

Sounds like one of those other 3 plugins is passing a null arg to the API in this then, which I can add a fix to avoid the error, but ideally the plugin sending erroneously should be fixed.

I know how busy one can get and appreciate all the work people do, but if anything can be done about this would be greatly appreciated. It's killing my logs with entries and probably causing some performance issues.

@Bumfuzzler Player Ranks is the only one of the plugins you listed that I'm using as well, and also getting the error - just FYI. Letting Steenamaroo know on the relevant thread, too.
20:51 [Error] Failed to call hook 'GetPlayTime' on plugin 'PlaytimeTracker v0.2.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlaytimeTracker.GetPlayTime (System.String id) [0x00000] in <6f21e0765f2242609d6392ccf7d079a3>:0

  at Oxide.Plugins.PlaytimeTracker.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00309] in <6f21e0765f2242609d6392ccf7d079a3>:0

  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0

  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <0fbce81d88d64454b3e7abb24df7026b>:0

  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <0fbce81d88d64454b3e7abb24df7026b>:0

20:51 [Error] Failed to call hook 'GetPlayTime' on plugin 'PlaytimeTracker v0.2.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlaytimeTracker.GetPlayTime (System.String id) [0x00000] in <6f21e0765f2242609d6392ccf7d079a3>:0

  at Oxide.Plugins.PlaytimeTracker.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00309] in <6f21e0765f2242609d6392ccf7d079a3>:0

  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0

  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <0fbce81d88d64454b3e7abb24df7026b>:0

  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <0fbce81d88d64454b3e7abb24df7026b>:0


Merged post

plugin using GetPlaytime: ServerRewards:
            if (configData.UIOptions.ShowPlaytime)
            {
                object time = Interface.CallHook("GetPlayTime", player.UserIDString);
                if (time is double)
                {
                    string playTime = FormatTime((double)time);
                    if (!string.IsNullOrEmpty(playTime))
                        message = $"{color1}{msg("storePlaytime", player.UserIDString)}: {playTime}</color> {color2}||</color> " + message;
                }
            }​


and PlayerRanks:

        public void UpdateOfflinePlayer(ulong userID)
        {
            var path = data.PlayerRankData[userID];
            bool gotClan = (Clans?.CallHook("GetClanOf", userID) != null);
            var time = PlaytimeTracker?.Call("GetPlayTime", userID.ToString());

            path["Status"] = "offline";
            path["Economics"] = Economics ? Economics?.Call("Balance", userID) : path["Economics"];
            path["ServerRewards"] = ServerRewards ? ServerRewards?.Call("CheckPoints", userID) : path["ServerRewards"];
            path["Clan"] = gotClan ? (string)Clans?.CallHook("GetClanOf", userID) : "None";
            path["TimePlayed"] = (time == null) ? "0" : time;
        }

        public void UpdatePlayer(BasePlayer player, bool titles)
        {
            var path = data.PlayerRankData[player.userID];
            bool gotClan = (Clans?.CallHook("GetClanOf", player.userID) != null);
            var time = PlaytimeTracker?.Call("GetPlayTime", player.UserIDString);

            path["UserID"] = player.userID;
            path["Admin"] = IsAuth(player);
            path["Changed"] = true;
            path["Name"] = CleanString(player.displayName, "");
            path["Status"] = "online";
            path["ActiveDate"] = DateTime.UtcNow;
            path["Economics"] = Economics ? Economics?.Call("Balance", player.userID) : path["Economics"];
            path["ServerRewards"] = ServerRewards ? ServerRewards?.Call("CheckPoints", player.userID) : path["ServerRewards"];
            path["Clan"] = gotClan ? (string)Clans?.CallHook("GetClanOf", player.userID) : "None";
            path["TimePlayed"] = (time == null) ? "0" : time;
            data.PlayerRankData[player.userID]["OptOut"] = HasPermission(player.UserIDString, permOptOut);

            if (titles)
                LoadTitles();
        }​

PlayerRanks use GetPlayTimeClock, not same so not this?

Could someone tell if the plugin is the cause or the others?Thank you

Locked automatically