Alt + Tab
#18

Yes, but don't use GetTickCount for that, you can increment the variable in the timer.

fast and easy:
Код:
#undef MAX_PLAYERS

#define MAX_PLAYERS 30

new afk[MAX_PLAYERS];

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	
	SetTimer("AFKTimer", 1000, 1);
	return 1;
}

forward AFKTimer();
public AFKTimer()
{
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if (IsPlayerConnected(i))
		{
			afk[i]++;
			if (afk[i] % 30 == 0)
			{
				new msg[60];
				format(msg, 59, "player %d is afk for %d seconds now!", i, afk[i]);
				SendClientMessageToAll(0xFFFFFF00, msg);
			}
		}
	}
}

public OnPlayerUpdate(playerid)
{
	afk[playerid] = 0;
	return 1;
}
Reply


Messages In This Thread
Alt + Tab - by Anthonyx3' - 28.11.2010, 01:39
Re: Alt + Tab - by XoSarahMoX - 28.11.2010, 01:50
Re: Alt + Tab - by Anthonyx3' - 28.11.2010, 02:08
Re: Alt + Tab - by Cypog - 28.11.2010, 02:27
Re: Alt + Tab - by Fj0rtizFredde - 28.11.2010, 02:29
Re: Alt + Tab - by cessil - 28.11.2010, 02:30
Re: Alt + Tab - by Cypog - 28.11.2010, 02:34
Re: Alt + Tab - by cessil - 28.11.2010, 02:39
Re: Alt + Tab - by Cypog - 28.11.2010, 02:49
Re: Alt + Tab - by Anthonyx3' - 28.11.2010, 03:04
Re: Alt + Tab - by cessil - 28.11.2010, 03:08
Re: Alt + Tab - by Anthonyx3' - 28.11.2010, 03:18
Re: Alt + Tab - by Retardedwolf - 28.11.2010, 03:20
Re: Alt + Tab - by cessil - 28.11.2010, 03:23
Re: Alt + Tab - by Cypog - 28.11.2010, 11:57
Re: Alt + Tab - by The_Moddler - 28.11.2010, 12:07
Re: Alt + Tab - by Hiddos - 28.11.2010, 12:10
Re: Alt + Tab - by Cypog - 28.11.2010, 13:09

Forum Jump:


Users browsing this thread: 2 Guest(s)