/*
Anti-Flood by Nexius v0.7.3
Publics:
OnDialogResponse				(0)
OnEnterExitModShop				(1)
OnPlayerClickMap				(2)
OnPlayerClickPlayer				(3)
OnPlayerClickTextDraw			(4)
OnPlayerCommandText				(5)
OnPlayerEnterVehicle			(6)
OnPlayerExitVehicle				(7)
OnPlayerPickUpPickup			(8)
OnPlayerRequestClass			(9)
OnPlayerSelectedMenuRow			(10)
OnPlayerStateChange				(11)
OnVehicleMod					(12)
OnVehiclePaintjob				(13)
OnVehicleRespray				(14)
OnVehicleDeath					(15)
OnPlayerText					(16)
OnPlayerEnterCheckpoint			(17)
OnPlayerLeaveCheckpoint			(18)
OnPlayerRequestSpawn			(19)
OnPlayerExitedMenu				(20)
OnIncomingConnection			(21)
Other: Cross-public antiflood	(22)
*/

#include <a_samp>

//Min time call public
//Time in Milliseconds
static const Mtc[] = {
	250,	//OnDialogResponse
	800,	//OnEnterExitModShop
	250,	//OnPlayerClickMap
	480,	//OnPlayerClickPlayer
	200,	//OnPlayerClickTextDraw
	400,	//OnPlayerCommandText
	180,	//OnPlayerEnterVehicle
	180,	//OnPlayerExitVehicle
	500,	//OnPlayerPickUpPickup
	180,	//OnPlayerRequestClass
	250,	//OnPlayerSelectedMenuRow
	700,	//OnPlayerStateChange
	530,	//OnVehicleMod
	530,	//OnVehiclePaintjob
	530,	//OnVehicleRespray
	600,	//OnVehicleDeath
	400,	//OnPlayerText
	500,	//OnPlayerEnterCheckpoint
	500,	//OnPlayerLeaveCheckpoint
	200,	//OnPlayerRequestSpawn
	350,	//OnPlayerExitedMenu
	800,	//OnIncomingConnection
	200/*,	//Cross-public
	500,	//OnPlayerEnterRaceCheckpoint
	500,	//OnPlayerLeaveRaceCheckpoint
	200*/	//OnPlayerClickPlayerTextDraw
},

//Max counts calls
Mfc[] =
{
	3,		//OnDialogResponse
	2,		//OnEnterExitModShop
	3,		//OnPlayerClickMap
	2,		//OnPlayerClickPlayer
	4,		//OnPlayerClickTextDraw
	2,		//OnPlayerCommandText
	3,		//OnPlayerEnterVehicle
	3,		//OnPlayerExitVehicle
	2,		//OnPlayerPickUpPickup
	3,		//OnPlayerRequestClass
	3,		//OnPlayerSelectedMenuRow
	3,		//OnPlayerStateChange
	2,		//OnVehicleMod
	2,		//OnVehiclePaintjob
	2,		//OnVehicleRespray
	2,		//OnVehicleDeath
	2,		//OnPlayerText
	2,		//OnPlayerEnterCheckpoint
	2,		//OnPlayerLeaveCheckpoint
	3,		//OnPlayerRequestSpawn
	2,		//OnPlayerExitedMenu
	2,		//OnIncomingConnection
	3/*,	//Cross-public
	2,		//OnPlayerEnterRaceCheckpoint
	2,		//OnPlayerLeaveRaceCheckpoint
	4*/		//OnPlayerClickPlayerTextDraw
};

new
	Call[23][MAX_PLAYERS],			//Time call public
	FloodCount[23][MAX_PLAYERS];	//Flood count

forward OnPlayerFlood(playerid, publicid, attempt, time);

public OnPlayerFlood(playerid, publicid, attempt, time)
{
    if(attempt > Mfc[publicid]) return Kick(playerid);
    Call[publicid][playerid] = GetTickCount();
    Call[22][playerid] = Call[publicid][playerid];
	return 0;
}

public OnPlayerConnect(playerid)
{
    for(new i = 23; i != -1; --i)
	{
	    Call[i][playerid] = 0;
		FloodCount[i][playerid] = 0;
	}
	new a = 1;
	#if defined af_OnPlayerConnect
		a = af_OnPlayerConnect(playerid);
	#endif
	Call[22][playerid] = GetTickCount();
	return a;
}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect af_OnPlayerConnect
#if defined af_OnPlayerConnect
    forward af_OnPlayerConnect(playerid);
#endif

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new gtc = GetTickCount();
    if(gtc - Call[0][playerid] < Mtc[0]) OnPlayerFlood(playerid, 0, FloodCount[0][playerid]++, Call[0][playerid]);
	else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[0][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
	new a = 1;
	#if defined af_OnDialogResponse
		a = af_OnDialogResponse(playerid, dialogid, response, listitem, inputtext);
    #endif
    Call[0][playerid] = GetTickCount();
    Call[22][playerid] = Call[0][playerid];
	return a;
}

#if defined _ALS_OnDialogResponse
    #undef OnDialogResponse
#else
    #define _ALS_OnDialogResponse
#endif
#define OnDialogResponse af_OnDialogResponse
#if defined af_OnDialogResponse
    forward af_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
#endif

public OnEnterExitModShop(playerid, enterexit, interiorid)
{
    new gtc = GetTickCount();
    if(gtc - Call[1][playerid] < Mtc[1]) OnPlayerFlood(playerid, 1, FloodCount[1][playerid]++, Call[1][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[1][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
	new a = 1;
	#if defined af_OnEnterExitModShop
		a = af_OnEnterExitModShop(playerid, enterexit, interiorid);
    #endif
    Call[1][playerid] = GetTickCount();
    Call[22][playerid] = Call[1][playerid];
    return a;
}

#if defined _ALS_OnEnterExitModShop
    #undef OnEnterExitModShop
#else
    #define _ALS_OnEnterExitModShop
#endif
#define OnEnterExitModShop af_OnEnterExitModShop
#if defined af_OnEnterExitModShop
    forward af_OnEnterExitModShop(playerid, enterexit, interiorid);
#endif

public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    new gtc = GetTickCount();
    if(gtc - Call[2][playerid] < Mtc[2]) OnPlayerFlood(playerid, 2, FloodCount[2][playerid]++, Call[2][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[2][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
	new a = 1;
	#if defined af_OnPlayerClickMap
		a = af_OnPlayerClickMap(playerid, fX, fY, fZ);
	#endif
    Call[2][playerid] = GetTickCount();
    Call[22][playerid] = Call[2][playerid];
	return a;
}

#if defined _ALS_OnPlayerClickMap
    #undef OnPlayerClickMap
#else
    #define _ALS_OnPlayerClickMap
#endif
#define OnPlayerClickMap af_OnPlayerClickMap
#if defined af_OnPlayerClickMap
    forward af_OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ);
#endif

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new gtc = GetTickCount();
    if(gtc - Call[3][playerid] < Mtc[3]) return OnPlayerFlood(playerid, 3, FloodCount[3][playerid]++, Call[3][playerid]);
	if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[3][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerClickPlayer
		a = af_OnPlayerClickPlayer(playerid, clickedplayerid, source);
	#endif
    Call[3][playerid] = GetTickCount();
    Call[22][playerid] = Call[3][playerid];
	return a;
}

#if defined _ALS_OnPlayerClickPlayer
    #undef OnPlayerClickPlayer
#else
    #define _ALS_OnPlayerClickPlayer
#endif
#define OnPlayerClickPlayer af_OnPlayerClickPlayer
#if defined af_OnPlayerClickPlayer
    forward af_OnPlayerClickPlayer(playerid, clickedplayerid, source);
#endif

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    new gtc = GetTickCount();
    if(gtc - Call[4][playerid] < Mtc[4]) return OnPlayerFlood(playerid, 4, FloodCount[4][playerid]++, Call[4][playerid]);
	if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[4][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerClickTextDraw
		a = af_OnPlayerClickTextDraw(playerid, clickedid);
	#endif
    Call[4][playerid] = GetTickCount();
    Call[22][playerid] = Call[4][playerid];
	return a;
}

#if defined _ALS_OnPlayerClickTextDraw
	#undef OnPlayerClickTextDraw
#else
	#define _ALS_OnPlayerClickTextDraw
#endif
#define OnPlayerClickTextDraw af_OnPlayerClickTextDraw
#if defined af_OnPlayerClickTextDraw
	forward af_OnPlayerClickTextDraw(playerid, Text:clickedid);
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    new gtc = GetTickCount();
    if(gtc - Call[5][playerid] < Mtc[5])
	{
		OnPlayerFlood(playerid, 5, FloodCount[5][playerid]++, Call[5][playerid]);
		return 1;
	}
	if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[5][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerCommandText
		a = af_OnPlayerCommandText(playerid, cmdtext);
	#endif
    Call[5][playerid] = GetTickCount();
    Call[22][playerid] = Call[5][playerid];
	return a;
}

#if defined _ALS_OnPlayerCommandText
	#undef OnPlayerCommandText
#else
	#define _ALS_OnPlayerCommandText
#endif
#define OnPlayerCommandText af_OnPlayerCommandText
#if defined af_OnPlayerCommandText
	forward af_OnPlayerCommandText(playerid, cmdtext[]);
#endif

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new gtc = GetTickCount();
    if(gtc - Call[6][playerid] < Mtc[6]) return OnPlayerFlood(playerid, 6, FloodCount[6][playerid]++, Call[6][playerid]);
	if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[6][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerEnterVehicle
		a = af_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
	#endif
    Call[6][playerid] = GetTickCount();
    Call[22][playerid] = Call[6][playerid];
	return a;
}

#if defined _ALS_OnPlayerEnterVehicle
	#undef OnPlayerEnterVehicle
#else
	#define _ALS_OnPlayerEnterVehicle
#endif
#define OnPlayerEnterVehicle af_OnPlayerEnterVehicle
#if defined af_OnPlayerEnterVehicle
	forward af_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
#endif

public OnPlayerExitVehicle(playerid, vehicleid)
{
    new gtc = GetTickCount();
    if(gtc - Call[7][playerid] < Mtc[7]) return OnPlayerFlood(playerid, 7, FloodCount[7][playerid]++, Call[7][playerid]);
	if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[7][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerExitVehicle
		a = af_OnPlayerExitVehicle(playerid, vehicleid);
	#endif
    Call[7][playerid] = GetTickCount();
    Call[22][playerid] = Call[7][playerid];
	return a;
}

#if defined _ALS_OnPlayerExitVehicle
	#undef OnPlayerExitVehicle
#else
	#define _ALS_OnPlayerExitVehicle
#endif
#define OnPlayerExitVehicle af_OnPlayerExitVehicle
#if defined af_OnPlayerExitVehicle
	forward af_OnPlayerExitVehicle(playerid, vehicleid);
#endif

public OnPlayerPickUpPickup(playerid, pickupid)
{
    new gtc = GetTickCount();
    if(gtc - Call[8][playerid] < Mtc[8]) OnPlayerFlood(playerid, 8, FloodCount[8][playerid]++, Call[8][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[8][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerPickUpPickup
		a = af_OnPlayerPickUpPickup(playerid, pickupid);
	#endif
    Call[8][playerid] = GetTickCount();
    Call[22][playerid] = Call[8][playerid];
	return a;
}

#if defined _ALS_OnPlayerPickUpPickup
	#undef OnPlayerPickUpPickup
#else
	#define _ALS_OnPlayerPickUpPickup
#endif
#define OnPlayerPickUpPickup af_OnPlayerPickUpPickup
#if defined af_OnPlayerPickUpPickup
	forward af_OnPlayerPickUpPickup(playerid, pickupid);
#endif

public OnPlayerRequestClass(playerid, classid)
{
    new gtc = GetTickCount();
    if(gtc - Call[9][playerid] < Mtc[9]) return OnPlayerFlood(playerid, 9, FloodCount[9][playerid]++, Call[9][playerid]);
	if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[9][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerRequestClass
		a = af_OnPlayerRequestClass(playerid, classid);
	#endif
    Call[9][playerid] = GetTickCount();
    Call[22][playerid] = Call[9][playerid];
	return a;
}

#if defined _ALS_OnPlayerRequestClass
	#undef OnPlayerRequestClass
#else
	#define _ALS_OnPlayerRequestClass
#endif
#define OnPlayerRequestClass af_OnPlayerRequestClass
#if defined af_OnPlayerRequestClass
	forward af_OnPlayerRequestClass(playerid, classid);
#endif

public OnPlayerSelectedMenuRow(playerid, row)
{
    new gtc = GetTickCount();
    if(gtc - Call[10][playerid] < Mtc[10]) OnPlayerFlood(playerid, 10, FloodCount[10][playerid]++, Call[10][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[10][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerSelectedMenuRow
		a = af_OnPlayerSelectedMenuRow(playerid, row);
	#endif
    Call[10][playerid] = GetTickCount();
    Call[22][playerid] = Call[10][playerid];
	return a;
}

#if defined _ALS_OnPlayerSelectedMenuRow
	#undef OnPlayerSelectedMenuRow
#else
	#define _ALS_OnPlayerSelectedMenuRow
#endif
#define OnPlayerSelectedMenuRow af_OnPlayerSelectedMenuRow
#if defined af_OnPlayerSelectedMenuRow
	forward af_OnPlayerSelectedMenuRow(playerid, row);
#endif

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new gtc = GetTickCount();
    if(gtc - Call[11][playerid] < Mtc[11]) OnPlayerFlood(playerid, 11, FloodCount[11][playerid]++, Call[11][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[11][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerStateChange
		a = af_OnPlayerStateChange(playerid, newstate, oldstate);
	#endif
    Call[11][playerid] = GetTickCount();
    Call[22][playerid] = Call[11][playerid];
	return a;
}

#if defined _ALS_OnPlayerStateChange
	#undef OnPlayerStateChange
#else
	#define _ALS_OnPlayerStateChange
#endif
#define OnPlayerStateChange af_OnPlayerStateChange
#if defined af_OnPlayerStateChange
	forward af_OnPlayerStateChange(playerid, newstate, oldstate);
#endif

public OnVehicleMod(playerid, vehicleid, componentid)
{
    new gtc = GetTickCount();
    if(gtc - Call[12][playerid] < Mtc[12]) OnPlayerFlood(playerid, 12, FloodCount[12][playerid]++, Call[12][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[12][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnVehicleMod
		a = af_OnVehicleMod(playerid, vehicleid, componentid);
	#endif
    Call[12][playerid] = GetTickCount();
    Call[22][playerid] = Call[12][playerid];
	return a;
}

#if defined _ALS_OnVehicleMod
	#undef OnVehicleMod
#else
	#define _ALS_OnVehicleMod
#endif
#define OnVehicleMod af_OnVehicleMod
#if defined af_OnVehicleMod
	forward af_OnVehicleMod(playerid, vehicleid, componentid);
#endif

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    new gtc = GetTickCount();
    if(gtc - Call[13][playerid] < Mtc[13]) OnPlayerFlood(playerid, 13, FloodCount[13][playerid]++, Call[13][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[13][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnVehiclePaintjob
		a = af_OnVehiclePaintjob(playerid, vehicleid, paintjobid);
	#endif
    Call[13][playerid] = GetTickCount();
    Call[22][playerid] = Call[13][playerid];
	return a;
}

#if defined _ALS_OnVehiclePaintjob
	#undef OnVehiclePaintjob
#else
	#define _ALS_OnVehiclePaintjob
#endif
#define OnVehiclePaintjob af_OnVehiclePaintjob
#if defined af_OnVehiclePaintjob
	forward af_OnVehiclePaintjob(playerid, vehicleid, paintjobid);
#endif

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    new gtc = GetTickCount();
    if(gtc - Call[14][playerid] < Mtc[14]) OnPlayerFlood(playerid, 14, FloodCount[14][playerid]++, Call[14][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[14][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnVehicleRespray
		a = af_OnVehicleRespray(playerid, vehicleid, color1, color2);
	#endif
    Call[14][playerid] = GetTickCount();
    Call[22][playerid] = Call[14][playerid];
	return a;
}

#if defined _ALS_OnVehicleRespray
	#undef OnVehicleRespray
#else
	#define _ALS_OnVehicleRespray
#endif
#define OnVehicleRespray af_OnVehicleRespray
#if defined af_OnVehicleRespray
	forward af_OnVehicleRespray(playerid, vehicleid, color1, color2);
#endif

public OnVehicleDeath(vehicleid, killerid)
{
    new gtc = GetTickCount();
    if(gtc - Call[15][killerid] < Mtc[15]) OnPlayerFlood(killerid, 15, FloodCount[15][killerid]++, Call[15][killerid]);
	else if(gtc - Call[22][killerid] < Mtc[22]) OnPlayerFlood(killerid, 22, FloodCount[22][killerid]++, Call[22][killerid]);
    else
	{
	    FloodCount[15][killerid] = 0;
		FloodCount[22][killerid] = 0;
	}
	new a = 1;
	#if defined af_OnVehicleDeath
		a = af_OnVehicleDeath(vehicleid, killerid);
	#endif
    Call[15][killerid] = GetTickCount();
    Call[22][killerid] = Call[15][killerid];
	return a;
}

#if defined _ALS_OnVehicleDeath
	#undef OnVehicleDeath
#else
	#define _ALS_OnVehicleDeath
#endif
#define OnVehicleDeath af_OnVehicleDeath
#if defined af_OnVehicleDeath
	forward af_OnVehicleDeath(vehicleid, killerid);
#endif

public OnPlayerText(playerid, text[])
{
    new gtc = GetTickCount();
    if(gtc - Call[16][playerid] < Mtc[16]) return OnPlayerFlood(playerid, 16, FloodCount[16][playerid]++, Call[16][playerid]);
	if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[16][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerText
		a = af_OnPlayerText(playerid, text);
	#endif
    Call[16][playerid] = GetTickCount();
    Call[22][playerid] = Call[16][playerid];
	return a;
}

#if defined _ALS_OnPlayerText
	#undef OnPlayerText
#else
	#define _ALS_OnPlayerText
#endif
#define OnPlayerText af_OnPlayerText
#if defined af_OnPlayerText
	forward af_OnPlayerText(playerid, text[]);
#endif

public OnPlayerEnterCheckpoint(playerid)
{
    new gtc = GetTickCount();
    if(gtc - Call[17][playerid] < Mtc[17]) OnPlayerFlood(playerid, 17, FloodCount[17][playerid]++, Call[17][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[17][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerEnterCheckpoint
		a = af_OnPlayerEnterCheckpoint(playerid);
	#endif
    Call[17][playerid] = GetTickCount();
    Call[22][playerid] = Call[17][playerid];
	return a;
}

#if defined _ALS_OnPlayerEnterCheckpoint
	#undef OnPlayerEnterCheckpoint
#else
	#define _ALS_OnPlayerEnterCheckpoint
#endif
#define OnPlayerEnterCheckpoint af_OnPlayerEnterCheckpoint
#if defined af_OnPlayerEnterCheckpoint
	forward af_OnPlayerEnterCheckpoint(playerid);
#endif

public OnPlayerLeaveCheckpoint(playerid)
{
    new gtc = GetTickCount();
    if(gtc - Call[18][playerid] < Mtc[18]) OnPlayerFlood(playerid, 18, FloodCount[18][playerid]++, Call[18][playerid]);
    else if(gtc - Call[22][playerid] < Mtc[22]) OnPlayerFlood(playerid, 22, FloodCount[22][playerid]++, Call[22][playerid]);
    else
	{
	    FloodCount[18][playerid] = 0;
		FloodCount[22][playerid] = 0;
	}
    new a = 1;
	#if defined af_OnPlayerLeaveCheckpoint
		a = af_OnPlayerLeaveCheckpoint(playerid);
	#endif
    Call[18][playerid] = GetTickCount();
    Call[22][playerid] = Call[18][playerid];
	return a;
}

#if defined _ALS_OnPlayerLeaveCheckpoint
	#undef OnPlayerLeaveCheckpoint
#else
	#define _ALS_OnPlayerLeaveCheckpoint
#endif
#define OnPlayerLeaveCheckpoint af_OnPlayerLeaveCheckpoint
#if defined af_OnPlayerLeaveCheckpoint
	forward af_OnPlayerLeaveCheckpoint