Best way to detect if AFK
#1

What is the best way to check if someone is AFK?
Reply
#2

Quote:
Originally Posted by -Luis
View Post
What is the best way to check if someone is AFK?
Check the players coordinates, using GetPlayerPos.
Initialize a timer of 'x' seconds/minutes, checking his coordinates. If they match the previous coordinates. He hasn't moved.
Punish/Warn, as you please.
Reply
#3

Quote:
Originally Posted by shitbird
View Post
Check the players coordinates, using GetPlayerPos.
Initialize a timer of 'x' seconds/minutes, checking his coordinates. If they match the previous coordinates. He hasn't moved.
Punish/Warn, as you please.
what if he hasnt moved -.-

once u stop moving u get kicked for AFK ? i think there is a better way..
Reply
#4

There's two ways. Movement with GetPlayerPos or updates with OnPlayerUpdate. One for not moving, one for being paused. Which one do you want? The playerpos one would do both.
Reply
#5

Chech if OnPlayerUpdate is called.
Once you go afk, it won't get called anymore.

This is very accurate!


@MP2:
Damn, why are you always 1 second faster
Reply
#6

This doesn't even compile, no doubt it is wrong.
pawn Code:
new Float:Pos[3], Float:OldPos[3], Float:NewPos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    OldPos[0] = Pos[0];
    OldPos[1] = Pos[1];
    OldPos[2] = Pos[2];
    GetPlayerPos(playerid, NewPos[0], NewPos[1], NewPos[2]);
    if(OldPos[0] == NewPos[0]))
    {
        print("Player stopped moving");
    }
Error is: invalid expression, assumed zero.
Reply
#7

Wich line?
Reply
#8

This one,
Code:
if(OldPos[0] == NewPos[0]))
Reply
#9

Can anyone help?
Reply
#10

Code:
if(OldPos[0] == NewPos[0]))
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)