#include <a_samp>enum e_STATE{ e_STATE_NONE, e_STATE_CONNECTED, e_STATE_UPDATING}new gLastUpdate[MAX_PLAYERS], e_STATE:gState[MAX_PLAYERS] = {e_STATE_NONE, ...};// Max time a player is allowed to be AFK (in milliseconds)#define MAX_AFK_TIME (2000)forward KickUpdate();public OnFilterScriptInit(){ print("\n---------------------------------------"); print(" _____.___.___________ _________"); print(" \\__ | |\\_ _____// _____/"); print(" / | | | __)_ \\_____ \\"); print(" \\____ | | \\/ \\"); print(" / ______|/_______ /_______ /"); print(" \\/ \\/ \\/"); print(" Anti-ESC script by Alex \"Y_Less\" Cole"); print("---------------------------------------\n"); SetTimer("KickUpdate", 100, 1); return 1;}public OnPlayerUpdate(playerid){ // Get the time of a player's last update gLastUpdate[playerid] = GetTickCount(); // When you first connect you don't send much, don't kick players for this gState[playerid] = e_STATE_UPDATING; return 1;}public OnPlayerConnect(playerid){ // Give new players some leway gState[playerid] = e_STATE_CONNECTED; return 1;}public OnPlayerDisconnect(playerid, reason){ gState[playerid] = e_STATE_NONE; return 1;}public KickUpdate(){ // Get the last valid time new time = GetTickCount() - MAX_AFK_TIME; // Loop through all players for (new i = 0; i < MAX_PLAYERS; i++) { if (gState[i] == e_STATE_UPDATING && time >= gLastUpdate[i]) { SendClientMessage(i, 0xFF0000AA, "You have been kicked for being out the game"); Kick(i); } }}