1. ArcaneCraeda submitted a new resource:

    Playtime and AFK Tracker - Logs every players' play and AFK time, separately

    Read more about this resource...
     
  2. You don't really have any documentation of how to read the data to use it for something on the resource page? How to use ;o
     
  3. I'm not quite sure I understand your question. The data is stored in a data file in JSON format, like so:

    steamID: {
    Name,
    PlayTime,
    AfkTime
    }

    Can you elaborate?
     
  4. Firstly - thank you for your plugin.

    But I have error with it at my server:

    1) the AfkTime doesn't counts for the players. For every player I can see - "AfkTime": 0

    2) At my console I continuously can see the error alerts:

    [Oxide] 4:10 PM [Error] Failed to call hook 'OnPlayerSleepEnded' on plugin 'PlayTimeTracker v1.0.0' (ArgumentException: An element with the same key already exists in the dictionary.)

    "[Oxide] 4:18 PM [Error] Failed to call hook 'OnPlayerSleepEnded' on plugin 'PlayTimeTracker v1.0.0' (ArgumentException: An element with the same key already exists in the dictionary.)"
     
  5. Oh I see, I think I know what's causing that second issue (the error), I forgot a check in my code. I'll try to roll out a fix tonight or tomorrow night. If there's a more detailed version of the error (with more stuff) post it, it would help a ton with debugging.

    As for the first error, did you set Track AFK Time? to true in the config file?

    Edit: Already found the error, I'll be uploading it tonight after a quick test.
     
    Last edited by a moderator: Sep 30, 2015
  6. sorry, but I do not have more debug info


    my PlayTimeTracker.json:

    Code:
    {  "Afk Check Interval": 30,
      "Cycles Until Afk": 4,
      "Track AFK Time?": true
    }
    ps: "PlayTime" - working excellent! :)

     
  7. ArcaneCraeda updated Playtime and AFK Tracker with a new update entry:

    1.0.1

     
  8. Thank you for your fast update. I need some time to collect my stats for AfkTime.

    the only one error I now catch are for the player logout:

    [Oxide] 9:45 AM [Error] Failed to call hook 'OnPlayerDisconnected' on plugin 'PlayTimeTracker v1.0.0' (KeyNotFoundException: The given key was not present in the dictionary.)
    [DOUBLEPOST=1443684247][/DOUBLEPOST]...seems I have old one version PlayTimeTracker v1.0.0'

    just remove all and install all new

    [DOUBLEPOST=1443685057][/DOUBLEPOST]installed all new - testing...
    [DOUBLEPOST=1443690464][/DOUBLEPOST]Yes! Tested and all working great!
    Thank you!
     
  9. Glad to hear it! If you get the 'OnPlayerDisconnected' error again, go ahead and post it and I'll look into it. Cheers!
     
  10. Requests:
    • add secondary fields for the times in the data file and display Hours:minutes:seconds for quick "human" references
    ( .ToString(@"hh\:mm\:ss")
     
  11. On it. I don't think Unity supports the .ToString method for TimeSpan, since it's only available for .NET > 4.0. I'll double check though.
     
  12. For .NET <= 4.0 you could use
    Code:
    TimeSpan t = TimeSpan.FromSeconds( secs );
    string.Format("{0:D2}h:{1:D2}m:{2:D2}s",  t.Hours,  t.Minutes,  t.Seconds);
     
  13. Beat you to it, I found that same StackOverflow thread ;) I can't seem to update my local Rust server to latest, so I'll be uploading a beta version in a little bit. Could you test it out and let me know if it works?
     
  14. ArcaneCraeda updated Playtime and AFK Tracker with a new update entry:

    1.1.0-beta

     
  15. HumanTime represents PlayTime. I'll add one for AFK time. Does it work as expected?
     
  16. ArcaneCraeda updated Playtime and AFK Tracker with a new update entry:

    1.1.0

     
  17. Shows null for the time.

    "HumanPlayTime": null,
    "HumanAfkTime": null
     
  18. Damn it, ok. I'll work on getting my local server working so I can do some debugging.
     
  19. Error info:

    Code:
    [Oxide] 11:04 PM [Error] Failed to call hook 'OnPlayerDisconnected' on plugin 'PlayTimeTracker v1.0.0' (FormatException: The specified format 'D2' is invalid)
    [Oxide] 11:04 PM [Debug]   at System.NumberFormatter.NumberToString (System.String format, System.Globalization.NumberFormatInfo nfi) [0x00000] in <filename unknown>:0
      at System.NumberFormatter.NumberToString (System.String format, Double value, IFormatProvider fp) [0x00000] in <filename unknown>:0
      at System.Double.ToString (System.String format, IFormatProvider provider) [0x00000] in <filename unknown>:0
      at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0
      at System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0
      at System.String.Format (System.String format, System.Object arg0, System.Object arg1, System.Object arg2) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlayTimeTracker.OnPlayerDisconnected (.BasePlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlayTimeTracker.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (System.Reflection.MethodInfo 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 hookname, System.Object[] args) [0x00000] in <filename unknown>:0