[FilterScript] AFK system ( little diffrent than other systems, detecting possible AFK players )
#8

Quote:
Originally Posted by Master_Gangster
Посмотреть сообщение
to make it kick the player due to 30 seconds of inactivity do something like this:

Код:
#include < a_samp >
#include < a_npc >
#include < foreach >

#define RED 0xE60000FF

new Float:x, Float:y, Float:z;
new Float:x2, Float:y2, Float:z2;

public OnPlayerConnect( playerid )
{
	SetTimerEx( "CheckForAfk", 30000, 1, "i", playerid );
	return 1;
}

forward CheckForAfk( playerid );
public CheckForAfk( playerid )
{
	GetPlayerPos( playerid, x, y, z );
	if( x == x2 && y == y2 && z == z2 )
	{
		foreach(Player, i) if(!IsPlayerNPC(i))
		{
		   SendClientMessage(i, RED, "You have been kicked due to massive inactivity.");
		   Kick(i);
		}
	}
	GetPlayerPos( playerid, x2, y2, z2 );
	return 1;
}
BTW I used "foreach" in this since I find it ALOT faster than the normal usage.
Why kick the player? Your only goal is to mark those who are AFK, thinking that they might come back and continue playing... It's annoying for them to be kicked 30 seconds after they went AFK...
The whole point of AFK systems is to make them "immune" until they return so they won't lose progress.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)