PlaytimeTracker

Moved

Total Downloads: 4,803 - First Release: Sep 9, 2016 - Last Update: Nov 10, 2017

5/5, 10 likes
  1. 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:
    {
      "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:
    "afkTime": 0.0,
    or i'm wrong?

    my config:
    Code:
    {
      "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 by a moderator: Mar 17, 2017
  2. 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. Im having an issue with this plugin atm, the timer works, but sending RP does not work for me anymore
    please help : |

    Code:
    {
      "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 by a moderator: Apr 5, 2017

  4. Im sorry i just found out that my bios battery was empty the plugin works fine, i just replaced the battery :)
     
  5. AFK not working for me! I find connected user. He sleep many minutes. But no changes in log.
     
  6. I find solution!!!!

    This part:
    Code:
            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:
            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. Hi guys I am lost on this plug, It will not issue money to players at all but it will track time. Any ideas?
     

    Attached Files:

  8. 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. i have this Error
    Code:
    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. 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. 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. 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. Have you recently updated to ServerRewards 0.4.0? It's a big change I think and would reset your points.
     
  14. I have just installed both plugins yesterday, the server is a new server, I have used both plugins previously but never had this problem before, so are you saying that this is a ServerRewards issue due to its recent update?
     
  15. @k1lly0u,@Wulf
    it's not tracking afk cause it can't compare GenericPosition?
    wrote to debug it
    Code:
    if (posCache.ContainsKey(player.Id))
                {
                    Puts($"checkafk {posCache[player.Id]} {player.Position()}");
                    if (posCache[player.Id]== player.Position()) {
                        Puts("isafk");
                        return true;
                    }
                }
    when comparing strings - it works (posCache[player.Id].ToString() == player.Position().ToString())
     
  16. Wulf

    Wulf Community Admin

    Yeah, that's what I have locally for this, though not sure why GenericPosition isn't able to be properly compared right now.
     
  17. I would think so.
     
  18. i have this error

    Code:
    (13:06:13) | Failed to call hook 'OnUserConnected' on plugin 'PlaytimeTracker v0.1.5' (ArgumentException: An element with the same key already exists in the dictionary.)
    (13:06:14) | at System.Collections.Generic.Dictionary`2[System.String,Oxide.Plugins.Timer].Add (System.String key, Oxide.Plugins.Timer value) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlaytimeTracker.ResetTimer (IPlayer player, Boolean isNew) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlaytimeTracker.InitPlayerData (IPlayer player) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PlaytimeTracker.OnUserConnected (IPlayer 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 (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
     
  19. Wulf

    Wulf Community Admin

    Wulf updated Playtime Tracker with a new update entry:

    0.1.6

     
  20. No matter what I put in the config for "Playtime_PointTimer": 3600, it will always be every 1 min to give out RP, the only way around this is to edit the cs file.