afk detect
#1

is ther any way to detect if a player is afk ! if yes can you pls show me an example plss
Reply
#2

Well you do something like this
Save the players position and then lets say after 2 minutes check if the players is in the same position

EXAMPLE
pawn Код:
//add this at the top
new Float:PosY[MAX_PLAYERS], Float:PosZ[MAX_PLAYERS], Float:PosA[MAX_PLAYERS] Float:PosX[MAX_PLAYERS];
//Add This wherever you want to chech for the player not moving
SetTimer("SavePlayerPos",1000,false);

//then put this in the bottom of your script
forward SavePlayerPos(playerid);
public SavePlayerPos(playerid)
{
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
//Now set a timer lets say 1 minute to check if the player is in the same position
SetTimer("CheckPlayerPos",60000,false);
return 1;
}
forward CheckPlayerPos(playerid);
public CheckPlayerPos(playerid)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
if(x && y && z == PosX[playerid] && PosY[playerid] && PosZ[playerid])
{
SendClientMessage(playerid,RED,"You have not moved in 1 minute!!!");
}
return 1;
}
UnTested and is just and example but im preaty sure it will work!
Reply
#3

yйah thanks again park4bmx that's what i was look'n for
Reply
#4

man i've been trying to change to adapt it to my FS but it wont work ... can some one help plz
Reply
#5

Shouldn't

pawn Код:
if(x && y && z == PosX[playerid] && PosY[playerid] && PosZ[playerid])
be

pawn Код:
if((x == PosX[playerid]) && (y == PosY[playerid])  && (z == PosZ[playerid]))
Reply
#6

Quote:
Originally Posted by Antonio [G-RP]
Посмотреть сообщение
Shouldn't

pawn Код:
if(x && y && z == PosX[playerid] && PosY[playerid] && PosZ[playerid])
be

pawn Код:
if((x == PosX[playerid]) && (y == PosY[playerid])  && (z == PosZ[playerid]))
Not really.

And that method isn't really efficient or correct, use The_Moddler's IsPlayerAFK and OnPlayerAFK include.

EDIT: Oh yea it should be like antonio said^^.
Reply
#7

wйll thanks guys
Quote:

use The_Moddler's IsPlayerAFK and OnPlayerAFK include.

no man i can't alwas use the other's FS this time i make my own afk systeme
thnks for helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)