afk detect - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: afk detect (
/showthread.php?tid=233460)
afk detect -
Amine_Mejrhirrou - 01.03.2011
is ther any way to detect if a player is afk ! if yes can you pls show me an example plss
Re: afk detect -
park4bmx - 01.03.2011
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!
Re : afk detect -
Amine_Mejrhirrou - 01.03.2011
yйah thanks again
park4bmx that's what i was look'n for
Re : afk detect -
Amine_Mejrhirrou - 01.03.2011
man i've been trying to change to adapt it to my FS but it wont work ... can some one help plz
Re: afk detect -
Antonio [G-RP] - 01.03.2011
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]))
Re: afk detect -
Mean - 02.03.2011
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^^.
Re : afk detect -
Amine_Mejrhirrou - 02.03.2011
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