Posts: 36
Threads: 16
Joined: Jun 2016
Reputation:
0
so,there's a problem on my server,I see many players is online but in reality they're afk,they are doing this
because of the business earnings.
so,is there any code to detect if player doesn't move for x minutes,then they automatically using /afk command?
I have tried them if the player is paused,but they doesn't paused for unknown reason
Posts: 141
Threads: 6
Joined: Jun 2015
Reputation:
0
Use OnPlayerUpdate with SetTimerEx to check it.
Posts: 36
Threads: 16
Joined: Jun 2016
Reputation:
0
Can I start the timer when the player is logged in?
Posts: 3,085
Threads: 37
Joined: Nov 2012
Reputation:
0
It's okay to use OnPlayerUpdate... you need to stop being scared of using it. For this exact purpose however, OnPlayerUpdate would be fine to use but UNNECESSARY. Not to mention SetTimerEx in OnPlayerUpdate would most certainly bug things out and return unexpected results...
If I were you, I would start the timer when they spawn/come back from being AFK. Kill the timer when they die/disconnect/go afk.
Posts: 1,199
Threads: 238
Joined: Feb 2016
Reputation:
0
I am not being scared of OnPlayerUpdate. I just don't like it because it is unpredictable..
Timers arebest for this because you can use them when you need them and kill them when you don't..