Check AFK Player - 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)
+--- Thread: Check AFK Player (
/showthread.php?tid=417189)
Check AFK Player -
Manowar - 20.02.2013
With what function you can check to see if the player is AFK?
Checking the position is not suitable
Re: Check AFK Player -
M3mPHi$_S3 - 20.02.2013
In case checking for /afklist
PHP Code:
new AFK[MAX_PLAYERS];
for(new i = 0; i< MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(AFK[i] == 1)
in-case like not allowind to chat or already afk
PHP Code:
new AFK [MAX_PLAYERS];
if(AFK[playerid] == 1)
{
return GameTextForPlayer(playerid, "You are already in AFK. Use /back",3000,3);
}
Re: Check AFK Player -
Manowar - 05.03.2013
This is not an option, the script itself should determine the player is in the AFC or not
Re: Check AFK Player -
Marco_Valentine - 05.03.2013
Code:
forward AFK();
new afk[MAX_PLAYERS];
public AFK()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
afk[i]++;
}
}
public OnGameModeInit()
{
SetTimer("AFK", 1000, true);
}
public OnPlayerUpdate(playerid)
{
afk[playerid] = 0;
}
CMD: afk(playerid)
{
new name[28];
new string[128]
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(afk[i] = 3;
{
format(string, sizeof(string), "%s is AFK.",GetPlayerName(i, name, sizeof(name));
SendClientMessage(playerid, -1, string);
}
}
return 1;
}
Your welcome
Re: Check AFK Player -
RajatPawar - 05.03.2013
See if the player returns 0 because when you are 'Escape' (in the menu or main screen) away from the game, the updates are not sent. (Am I right, can this be used?)
You can use this in mixture with position checking to create a powerful AFK check-er.
Re: Check AFK Player -
PaulDinam - 05.03.2013
jeez... Jujst look up for the include OnPlayerPause on googpe. it has two functions, when player pauses and when he gets back. start a timer that check how long a player been afk for
Re: Check AFK Player -
Jewell - 05.03.2013
if you want try this
https://sampforum.blast.hk/showthread.php?tid=418384
Re: Check AFK Player -
Vegas. - 05.03.2013
You can use OnPlayerPause inc.
Re: Check AFK Player -
RajatPawar - 05.03.2013
Now that we have the little 'hourglass' icon depicting the player pause, I was expecting an OnPlayerPause callback/IsPlayerPaused function too! Alas.