Playtime Tracker

Track playtime and AFK time of users with a built in reward system

Total Downloads: 1,848 - First Release: Sep 9, 2016 - Last Update: Feb 28, 2017

5/5, 5 likes
  1. ☺ Tanki ☺

    ☺ Tanki ☺ Wood Hoarder

    hello,

    You could add: record the duration of the afk for each player in log file?

    edit: Oh i found log in data folder but is not correctly...

    Code (Text):
    {
      "timeData": {
        "76561197984580089": {
          "playTime": 4315.539999961853,
          "afkTime": 0.0,
          "lastReward": 0.0,
          "referrals": 0
        },
        "76561198050287733": {
          "playTime": 3239.9189999103546,
          "afkTime": 0.0,
          "lastReward": 0.0,
          "referrals": 0
        }
      }
    }
    AFK plugin kicked 76561198050287733 after 5min... and your log
    Code (Text):
    "afkTime": 0.0,
    or i'm wrong?

    my config:
    Code (Text):
    {
      "Options": {
        "SaveTimer": 10,
        "TrackAFKTime": true
      },
      "ReferralSystem": {
        "IssueRewardForReferral": false,
        "UseReferralSystem": false
      },
      "RewardSystem": {
        "Enabled": false,
        "Points": {
          "Playtime_Points": 5,
          "Playtime_PointTimer": 3600,
          "Referral_InvitePoints": 5,
          "Referral_JoinPoints": 3
        },
        "RewardPlugins": {
          "Hurtworld": {
            "Economy": false
          },
          "Rust": {
            "Economics": false,
            "ServerRewards": false
          },
          "Universal": {
            "UEconomics": false
          }
        },
        "SendDepositMessage": false
      }
    }
     
    Last edited: Mar 17, 2017
  2. LoneSurvivor

    LoneSurvivor Wood Hoarder

    Everyone on my server keeps getting "Unable to find player with that name". obviously we've tried using quotes, reloading plugin, tried multiple players, and even tried deleting data files while the plugin was unloaded, still no progress. am i doing something wrong?
     
  3. Virgil

    Virgil Naked Wanderer

    Im having an issue with this plugin atm, the timer works, but sending RP does not work for me anymore
    please help : |

    Code (Text):
    {
      "Options": {
        "SaveTimer": 15,
        "TrackAFKTime": false
      },
      "ReferralSystem": {
        "IssueRewardForReferral": true,
        "UseReferralSystem": false
      },
      "RewardSystem": {
        "Enabled": true,
        "Points": {
          "Playtime_Points": 350,
          "Playtime_PointTimer": 5,
          "Referral_InvitePoints": 3,
          "Referral_JoinPoints": 1
        },
        "RewardPlugins": {
          "Hurtworld": {
            "Economy": false
          },
          "Rust": {
            "Economics": false,
            "ServerRewards": true
          },
          "Universal": {
            "UEconomics": false
          }
        },
        "SendDepositMessage": true
      }
    }
    Every time when the plugin breaks the timer will keep going but the timer will look like (Playtime: 00:-21:-07) by the looks of it, it is counting down here is a screenshot of the text

    Screenshot: http://puu.sh/va5e0/d19f0f9874.jpg

    some time later

    Screenshot: http://puu.sh/va5pl/10d961351e.jpg
     
    Last edited: Apr 5, 2017
  4. Virgil

    Virgil Naked Wanderer


    Im sorry i just found out that my bios battery was empty the plugin works fine, i just replaced the battery :)
     
  5. CaseMan

    CaseMan Naked Wanderer

    AFK not working for me! I find connected user. He sleep many minutes. But no changes in log.
     
  6. CaseMan

    CaseMan Naked Wanderer

    I find solution!!!!

    This part:
    Code (Text):
            bool CheckPosition(IPlayer player)
            {
                if (player?.Position() == null)
                    return false;
                if (posCache.ContainsKey(player.Id))
                {
                    if (posCache[player.Id] == player.Position())
                        return true;          

                }
                return false;
            }
    replace by:

    Code (Text):
            bool CheckPosition(IPlayer player)
            {
                if (player?.Position() == null)
                    return false;
                if (posCache.ContainsKey(player.Id))
                {  
                var last = posCache[player.Id];
                     var current = player.Position();
                 if (last.X.Equals(current.X)) return true;
                }
                return false;
            }
     
  7. Dead Skin Mask

    Dead Skin Mask Scavenger

    Hi guys I am lost on this plug, It will not issue money to players at all but it will track time. Any ideas?
     
  8. GnRLies

    GnRLies Scavenger

    Feature Request: An option to track offline player time to grant points equal to online players. Because casual players get ripped off in Rust.
     
  9. RustyNutz

    RustyNutz Naked Wanderer

    i have this Error
    Code (Text):
    14:57 [Error] Failed to run a 60.00 timer in 'PlaytimeTracker v0.1.5' (NullReferenceException: )
    14:57 [Stacktrace]   at (wrapper managed-to-native) UnityEngine.Component:get_transform ()
      at Oxide.Game.Rust.Libraries.Player.Position (.BasePlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Game.Rust.Libraries.Covalence.RustPlayer.Position () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlaytimeTracker.CheckPosition (IPlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlaytimeTracker.AddTime (IPlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlaytimeTracker.ResetTimer (IPlayer player, Boolean isNew) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlaytimeTracker+<ResetTimer>c__AnonStorey0.<>m__1 () [0x00000] in <filename unknown>:0
      at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00000] in <filename unknown>:0
     
  10. OldRusty

    OldRusty Naked Wanderer

    Hello Im having an issue that everytime my server restarts players points are reset, even though the playtime is still tracking, can someone please tell me how to prevent player points from being wiped on server restarts, my server restarts every 24 hours and I want players to be able to retain points indefinately. Thanks in advance.

    Also is it possible for players to accumilate points whilst sleeping if still connected but AFK? if so how do i achieve this.
     
  11. GnRLies

    GnRLies Scavenger

    There is no reason for the points to wipe with a simple restart. For that to happen your data directory "PTTracker" that holds the data would have to be getting deleted each restart. You'll need to see if that is happening and why.

    Change the track afk setting.
     
  12. OldRusty

    OldRusty Naked Wanderer

    ok So it dosnt appear that the PTTracker data is being deleted at each start, but it does give the reset time as the last modified time for the file, here is the content of the playtime_data.json

    {
    "timeData": {
    "76561198165440944": {
    "playTime": 31805.45082950592,
    "afkTime": 0.0,
    "lastReward": 30600.0,
    "referrals": 0
    },
    "76561198305878695": {
    "playTime": 85.326629161834717,
    "afkTime": 0.0,
    "lastReward": 0.0,
    "referrals": 0
    },
    "76561198253336347": {
    "playTime": 5100.157767534256,
    "afkTime": 0.0,
    "lastReward": 3600.0,
    "referrals": 0
    }
    }
    }

    I am the top player in the file and as you can see it keeps trak of my playtime and last rewards, I havnt done any referrals or set up any VIP permissions so both these files are empty, when I open server rewards store I can still see my total play time, its just my points have been reset to zero, even though ive not spent any, I start accumilating them again but if I do a simple restart they reset still.
     
  13. GnRLies

    GnRLies Scavenger

    Have you recently updated to ServerRewards 0.4.0? It's a big change I think and would reset your points.