Best way to detect if AFK -
Luis- - 03.02.2012
What is the best way to check if someone is AFK?
Re: Best way to detect if AFK -
shitbird - 03.02.2012
Quote:
Originally Posted by -Luis
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.
Re: Best way to detect if AFK -
jamesbond007 - 03.02.2012
Quote:
Originally Posted by shitbird
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..
Re: Best way to detect if AFK -
MP2 - 03.02.2012
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.
Re: Best way to detect if AFK -
ғαιιοцт - 03.02.2012
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
Re: Best way to detect if AFK -
Luis- - 04.02.2012
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.
Re: Best way to detect if AFK -
thimo - 04.02.2012
Wich line?
Re: Best way to detect if AFK -
Luis- - 04.02.2012
This one,
Code:
if(OldPos[0] == NewPos[0]))
Re: Best way to detect if AFK -
Luis- - 04.02.2012
Can anyone help?
AW: Best way to detect if AFK -
xXpatoXx - 04.02.2012
Code:
if(OldPos[0] == NewPos[0]))