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

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.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)