01.03.2011, 19:38
is ther any way to detect if a player is afk ! if yes can you pls show me an example plss
//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;
}
if(x && y && z == PosX[playerid] && PosY[playerid] && PosZ[playerid])
if((x == PosX[playerid]) && (y == PosY[playerid]) && (z == PosZ[playerid]))
Shouldn't
pawn Код:
pawn Код:
|
use The_Moddler's IsPlayerAFK and OnPlayerAFK include. |