[HELP]AFK Checker
#3

It may be an idea to edit MAX_PLAYERS to the max server slots you have.

Код:
#include <a_samp>

#define AFK_TIME 30000

new bool:respond[MAX_PLAYERS];
forward CheckAFK();

public OnGameModeInit()
{
	SetTimer("CheckAFK", AFK_TIME, 1);
	return 1;
}

public CheckAFK(){
	new i = -1;
	while(++i < MAX_PLAYERS){
	  if(!IsPlayerConnected(i)) continue;
	  if(respond[i] == false){ // Keel them for being AFK
	    SendClientMessage(i, 0xFFFFFFFF, "You are away from keyboard!");
	    printf("Playerid %i is AFK", i);
	  }
	  else respond[i] = false;
	}
}

public OnPlayerUpdate(playerid)
{
	if(respond[playerid] == false){
	  respond[playerid] = true;
	}
	return 1;
}
Replace this code with the actions you want to take. So if you want to kick them. Use Kick(i);
Код:
SendClientMessage(i, 0xFFFFFFFF, "You are away from keyboard!");
printf("Playerid %i is AFK", i);
Reply


Messages In This Thread
[HELP]AFK Checker - by [SsC11]MAVERIK - 21.04.2010, 18:03
Re: [HELP]AFK Checker - by [SsC11]MAVERIK - 22.04.2010, 13:17
Re: [HELP]AFK Checker - by Tr1viUm - 22.04.2010, 13:59
Re: [HELP]AFK Checker - by [SsC11]MAVERIK - 22.04.2010, 14:52
Re: [HELP]AFK Checker - by Tr1viUm - 22.04.2010, 16:03
Re: [HELP]AFK Checker - by [Mr]Fred - 22.04.2010, 21:27
Re: [HELP]AFK Checker - by [SsC11]MAVERIK - 23.04.2010, 13:33
Re: [HELP]AFK Checker - by DarK_FeneR - 25.05.2012, 15:48
Re: [HELP]AFK Checker - by DarK_FeneR - 25.05.2012, 17:21

Forum Jump:


Users browsing this thread: 1 Guest(s)