/*Здесь расположен только Анти-Чит*/
forward AntiCheat(playerid);
public AntiCheat(playerid)
{
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
	{
	    if(PlayerACtest[playerid] > 0)
		return 1;
		PlayerACtest[playerid] = 1;
	    //НАЧАЛО АНТИ-ДЕНЬГИ
		if(DengiTime[playerid] > 0)
		DengiTime[playerid] --;
	    else
	    {
			if((GetPlayerMoney(playerid) != PlayerInfo[playerid][pCash]))
	    	{
	        	new raz = GetPlayerMoney(playerid) - PlayerInfo[playerid][pCash];
	            if(raz <= 50 && raz  > 0)
			  	{
					GivePlayerMoney(playerid,- raz);
				}
				else if(raz > 50)
			  	{
					new plname[MAX_PLAYER_NAME];
				  	TogglePlayerControllable(playerid, 0);
				  	if(PlayerLang[playerid] == 1)
					SendClientMessage(playerid, COLOR_LIGHTRED, " Античит: Ты был кикнут за читерство денег");
					else
					SendClientMessage(playerid, COLOR_LIGHTRED, " Anticheat: You has been kicked due of money cheating");
		        	GetPlayerName(playerid, plname, sizeof(plname));
					new string[256];
		            new year, month,day;
					new hackedmoney = GetPlayerMoney(playerid) - PlayerInfo[playerid][pCash];
					format(string,sizeof(string)," Анти-Хак: Игрок %s был кикнут. Причина: Чит на деньги ($%d)",plname,hackedmoney);
					SendClientMessageToAll(COLOR_LIGHTRED,string);
					getdate(year, month, day);
     				SavePlayer(playerid);
					Kick(playerid);
					return 1;
				}
				else if(GetPlayerMoney(playerid) < PlayerInfo[playerid][pCash])
			  	{
					DengiTime[playerid] = 15;
		            PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
	   			}
	 		}
	 	}
	 	//КОНЕЦ АНТИ-ДЕНЬГИ
		//НАЧАЛО АНТИ-БРОНЯ
		if(ArmourTime[playerid] > 0)
		ArmourTime[playerid] --;
		else
		{
		    new Float:b;
		    GetPlayerArmour(playerid,b);
			if(b != PlayerArmour[playerid])
		    {
   	            if(b < PlayerArmour[playerid])
			  	{
					PlayerArmour[playerid] = b;
				}
				else
			  	{
			  	    if(PlayerLang[playerid] == 1)
      				SendClientMessage(playerid, COLOR_LIGHTRED, " Античит: Читерство на нашем сервере запрещено!");
      				else
      				SendClientMessage(playerid, COLOR_LIGHTRED, " Anticheat: Cheating is not available at our server!");
					SetPlayerArmour(playerid,0);
				 }
			 }
		}
			//КОНЕЦ АНТИ-БРОНЯ
		//НАЧАЛО АНТИ-ЗДОРОВЬЕ
		if(HealthTime[playerid] > 0)
		HealthTime[playerid] --;
		else
		{
		    new Float:h;
		    GetPlayerHealth(playerid,h);
			if(h != PlayerHealth[playerid])
		    {
                if(h < PlayerHealth[playerid] || IsPlayerInRangeOfPoint(playerid,4,2224.1589,-1153.4944,1025.7969) ||
                IsPlayerInRangeOfPoint(playerid,4,-17.6480,-90.9690,1003.54693) ||
                IsPlayerInRangeOfPoint(playerid,4,-16.0147,-90.8517,1003.5469) ||
                IsPlayerInRangeOfPoint(playerid,4,2060.2913,-1898.4542,13.5538) ||
                IsPlayerInRangeOfPoint(playerid,4,495.9008,-23.5287,1000.6797))
			  	{
					PlayerHealth[playerid] = h;
				}
				else
			  	{
			  	    if(PlayerLang[playerid] == 1)
      				SendClientMessage(playerid, COLOR_LIGHTRED, " Античит: Читерство на нашем сервере запрещено!");
      				else
      				SendClientMessage(playerid, COLOR_LIGHTRED, " Anticheat: Cheating is not available at our server!");
    				SetPlayerHealth(playerid,PlayerHealth[playerid]);
				}
			 }
		}
			//КОНЕЦ АНТИ-ЗДОРОВЬЕ
       //НАЧАЛО АНТИ-ОРУЖИЕ
        if(PyxiTime[playerid] > 0)
       	PyxiTime[playerid] --;
		if(GetPVarInt(playerid,"WeaponJustChanged") == 1)//Заценим
		SetPVarInt(playerid,"WeaponJustChanged",0);
		else
		{
			new gun,ammo, cheater = 0, gunname[32];
			for(new i = 0; i < 11; i++)
			{
			    GetPlayerWeaponData(playerid,i,gun,ammo);
			    if(!IsPlayerInAnyVehicle(playerid)/* || i == 4*/)//Баг сампа, либо самой ГТА: в транспорте оружие не обновляется
			    {
				    if(PlayerGun[playerid][i] != gun)//Если оружие не совпадает
					{
						if(gun != 0)
						{
							GetWeaponName(gun,gunname,sizeof(gunname));
							cheater = 1;//Чит на оружие
						}
					}
					if(PlayerAmmo[playerid][i] != ammo && i != 0 && i != 1)//У 0 и 1 слота патроны не важны
					{
					    if(PlayerAmmo[playerid][i] > ammo && ammo >= 0 && PlayerGun[playerid][i] != 0)
					    PlayerAmmo[playerid][i] = ammo;
					    else if(PlayerAmmo[playerid][i] < ammo)
					    {
					        if(PlayerAmmo[playerid][i] < 0)
					        PlayerAmmo[playerid][i] = 0;
					        else
					        {
					            GetWeaponName(gun,gunname,sizeof(gunname));
     							cheater = 2;//Чит на патроны
					        }
		 				}
						else
						{
						    /*if(ammo < 0) Багонутая функция сампа - иногда патроны меньше нуля
						    SendClientMessage(playerid,COLOR_WHITE,"Расскажи об этом сообщении разработчику (NUM 1)");*/
							if(PlayerGun[playerid][i] == 0)
							SendClientMessage(playerid,COLOR_WHITE,"Расскажи об этом сообщении разработчику (NUM 2)");
							else if(ammo >= 0)
							SendClientMessage(playerid,COLOR_WHITE,"Расскажи об этом сообщении разработчику (NUM 3)");
						}
					}
				}
			}
		/*	new gunname[32];
			if(PlayerGun[playerid][0] == 0 && gun[0] > 0)//Кулак, кастет
			{
			    GetWeaponName(gun[0],gunname,sizeof(gunname)); cheater = 1;
			}
			if(PlayerGun[playerid][1] == 0 && gun[1] > 0)//Рукопашное оружие
			{
			    GetWeaponName(gun[1],gunname,sizeof(gunname)); cheater = 1;
			}
			if(PlayerGun[playerid][2] != gun[2])//Пистолеты
			{
				if(gun[2] != 0 && !IsPlayerInAnyVehicle(playerid))
				{
					GetWeaponName(gun[2],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerAmmo[playerid][2] != ammo[2])//Пистолеты, патроны
			{
			    if(PlayerAmmo[playerid][2] > ammo[2] && ammo[2] >= 0 && PlayerGun[playerid][2] != 0 && IsAPistol(GetPlayerWeapon(playerid)))
			    PlayerAmmo[playerid][2] = ammo[2];
			    else if(PlayerAmmo[playerid][2] < ammo[2] && IsAPistol(GetPlayerWeapon(playerid)))
			    {
			        if(PlayerAmmo[playerid][2] < 0)
			        PlayerAmmo[playerid][2] = 0;
			        else
			        {
			            GetWeaponName(gun[2],gunname,sizeof(gunname));
						cheater = 2;
			        }
 				}
			}
			if(PlayerGun[playerid][3] != gun[3] && !IsPlayerInAnyVehicle(playerid))//Дробовики
			{
				if(gun[3] != 0)
				{
					GetWeaponName(gun[3],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerInfo[playerid][pAmmo3] != ammo[3])//Дробовики, патроны
			{
			    if(PlayerInfo[playerid][pAmmo3] > ammo[3] && ammo[3] >= 0 && PlayerGun[playerid][3] != 0 && IsAShotgun(GetPlayerWeapon(playerid)))
   		    	PlayerInfo[playerid][pAmmo3] = ammo[3];
			    else if(PlayerInfo[playerid][pAmmo3] < ammo[3])
			    {
			        if(PlayerInfo[playerid][pAmmo3] < 0)
		        	PlayerInfo[playerid][pAmmo3] = 0;
			        else
			        {
				    	GetWeaponName(gun[3],gunname,sizeof(gunname));
						cheater = 2;
					}
				}
			}
			if(PlayerGun[playerid][4] != gun[4] && !IsPlayerInAnyVehicle(playerid))//Автоматы
			{
				if(gun[4] != 0)
				{
	 		   		GetWeaponName(gun[4],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerInfo[playerid][pAmmo4] != ammo[4])//Автоматы, патроны
			{
			    if(PlayerInfo[playerid][pAmmo4] > ammo[4] && ammo[4] >= 0 && PlayerGun[playerid][4] != 0 && IsAShotgun(GetPlayerWeapon(playerid)))
			    PlayerInfo[playerid][pAmmo4] = ammo[4];
			    else if(PlayerInfo[playerid][pAmmo4] < ammo[4])
			    {
			        if(PlayerInfo[playerid][pAmmo4] < 0)
			        PlayerInfo[playerid][pAmmo4] = 0;
			        else
			        {
				    	GetWeaponName(gun[4],gunname,sizeof(gunname));
						cheater = 2;
					}
				}
			}
			if(PlayerGun[playerid][5] != gun[5] && !IsPlayerInAnyVehicle(playerid))//Штурмовое
			{
				if(gun[5] != 0)
				{
			   		GetWeaponName(gun[5],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerInfo[playerid][pAmmo5] != ammo[5])//Штурмовое, патроны
			{
			    if(PlayerInfo[playerid][pAmmo5] > ammo[5] && PlayerGun[playerid][5] != 0 && IsAnAssault(GetPlayerWeapon(playerid)))
			    PlayerInfo[playerid][pAmmo5] = ammo[5];
			    else if(PlayerInfo[playerid][pAmmo5] < ammo[5] && ammo[5] >= 0 )
			    {
			        if(PlayerInfo[playerid][pAmmo5] < 0)
			        PlayerInfo[playerid][pAmmo5] = 0;
			        else
			        {
				    	GetWeaponName(gun[5],gunname,sizeof(gunname));
						cheater = 2;
					}
				}
			}
			if(PlayerGun[playerid][6] != gun[6] && !IsPlayerInAnyVehicle(playerid))//Винтовки
			{
				if(gun[6] != 0)
				{
			   		GetWeaponName(gun[6],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerInfo[playerid][pAmmo6] != ammo[6])//Винтовки, патроны
			{
			    if(PlayerInfo[playerid][pAmmo6] > ammo[6] && PlayerGun[playerid][6] != 0 && IsARifle(GetPlayerWeapon(playerid)))
			    PlayerInfo[playerid][pAmmo6] = ammo[6];
			    else if(PlayerInfo[playerid][pAmmo6] < ammo[6] && ammo[6] >= 0)
			    {
			        if(PlayerInfo[playerid][pAmmo6] < 0)
			        PlayerInfo[playerid][pAmmo6] = 0;
			        else
			        {
				    	GetWeaponName(gun[6],gunname,sizeof(gunname));
						cheater = 2;
					}
				}
			}
			if(PlayerGun[playerid][7] != gun[7] && !IsPlayerInAnyVehicle(playerid))//Мощное оружие
			{
				if(gun[7] != 0)
				{
			   		GetWeaponName(gun[7],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerInfo[playerid][pAmmo7] != ammo[7])//Мощное оружие, патроны
			{
			    if(PlayerInfo[playerid][pAmmo7] > ammo[7] && PlayerGun[playerid][7] != 0 && IsAHeavyAssault(GetPlayerWeapon(playerid)))
			    PlayerInfo[playerid][pAmmo7] = ammo[7];
			    else if(PlayerInfo[playerid][pAmmo7] < ammo[7] && ammo[7] >= 0)
				{
				    if(PlayerInfo[playerid][pAmmo7] < 0)
			        PlayerInfo[playerid][pAmmo7] = 0;
			        else
			        {
				    	GetWeaponName(gun[7],gunname,sizeof(gunname));
						cheater = 2;
					}
				}
			}
			if(PlayerGun[playerid][8] != gun[8] && !IsPlayerInAnyVehicle(playerid))//Гранаты
			{
				if(gun[8] != 0)
				{
			   		GetWeaponName(gun[8],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerInfo[playerid][pAmmo8] != ammo[8])//Гранаты, патроны
			{
			    if(PlayerInfo[playerid][pAmmo8] > ammo[8] && PlayerGun[playerid][8] != 0 && IsAGrenade(GetPlayerWeapon(playerid)))
			    PlayerInfo[playerid][pAmmo8] = ammo[8];
			    else if(PlayerInfo[playerid][pAmmo8] < ammo[8] && ammo[8] >= 0)
				{
				    if(PlayerInfo[playerid][pAmmo8] < 0)
			        PlayerInfo[playerid][pAmmo8] = 0;
			        else
			        {
				    	GetWeaponName(gun[8],gunname,sizeof(gunname));
						cheater = 2;
					}
				}
			}
			if(PlayerGun[playerid][9] != gun[9] && !IsPlayerInAnyVehicle(playerid))//Вещи
			{
				if(gun[9] != 0)
				{
	  		   		GetWeaponName(gun[9],gunname,sizeof(gunname));
					cheater = 1;
				}
			}
			if(PlayerInfo[playerid][pAmmo9] != ammo[9])//Вещи, патроны
			{
			    if(PlayerInfo[playerid][pAmmo9] > ammo[9] && PlayerGun[playerid][9] != 0 && IsAStuff1(GetPlayerWeapon(playerid)))
			    PlayerInfo[playerid][pAmmo9] = ammo[9];
			    else if(PlayerInfo[playerid][pAmmo9] < ammo[9] && ammo[9] >= 0)
				{
				    if(PlayerInfo[playerid][pAmmo9] < 0)
			        PlayerInfo[playerid][pAmmo9] = 0;
			        else
			        {
				    	GetWeaponName(gun[9],gunname,sizeof(gunname));
						cheater = 2;
					}
				}
			}
			if(PlayerGun[playerid][10] == 0 && gun[10] > 0)//Вещи для девушек
			{
			    GetWeaponName(gun[10],gunname,sizeof(gunname)); cheater = 1;
			}
			if(PlayerGun[playerid][11] == 0 && gun[11] > 0)//Парашют, очки
			{
			    GetWeaponName(gun[11],gunname,sizeof(gunname)); cheater = 1;
			}*/
			if(cheater == 1 && PyxiTime[playerid] == 0)
			{
				if(PlayerLang[playerid]== 1)
			    SendClientMessage(playerid,COLOR_RED,"Читерство на нашем сервере запрещено!");
			    else
			    SendClientMessage(playerid,COLOR_RED,"Cheating is not allowed on our server!");
				ResetPlayerWeapons(playerid);
			}
			else if(cheater == 2 && PyxiTime[playerid] == 0)
			{
			    if(PlayerLang[playerid]== 1)
			    SendClientMessage(playerid,COLOR_RED,"Читерство на нашем сервере запрещено !");
			    else
			    SendClientMessage(playerid,COLOR_RED,"Cheating is not allowed on our server!");
			    ResetPlayerWeapons(playerid);
	  		}
	  		else if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
	  		{
	  		    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
	  		    if(PlayerLang[playerid]== 1)
			    SendClientMessage(playerid,COLOR_RED,"Читерство на нашем сервере запрещено!");
			    else
			    SendClientMessage(playerid,COLOR_RED,"Cheating is not allowed on our server!");
	  		}
		}
		PlayerACtest[playerid] = 0;
	}
	return 1;
}
