//=============================Banya v1.0=======================================
//_______________Created by +Z90 for http://samp-rus.com/_______________________
//______________________ICQ GLOBAL: 351-214-628_________________________________
//==============================================================================

#include <a_samp>

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GREEN 0x33AA33AA
#pragma tabsize 0

forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
forward ProxDetectorS(Float:radi, playerid, targetid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward Ventilyato();
forward vent();
forward CustomPickups();
forward Dvig();
forward PlaySoundAll(playerid, soundid, Float:psx ,Float:psy ,Float:psz);
forward OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
forward Timers();

new object1;
new object2;
new object3;
new object4;
new object5;
new object6;
new camin;
new Ventilyator;
new VentilyatorTime[MAX_PLAYERS];
new MusicTime[MAX_PLAYERS];
new gPlayerUsingLoopingAnim[MAX_PLAYERS];
new Anim1[MAX_PLAYERS];
new bhelp[MAX_PLAYERS];
new dush;
new obj1;
new obj2;

//------------------------------------------------------------------------------------------------------
strtok(const string[], &index){
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' ')){
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))){
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

//------------------------------------------------------------------------------------------------------

IsKeyJustDown(key, newkeys, oldkeys){
	if((newkeys & key) && !(oldkeys & key)) return 1;
	return 0;
}
//------------------------------------------------------------------------------------------------------
public OnFilterScriptInit(){

print("___________________________________________");
print("|____________ [FS] Banya v1.0 _____________|");
print("|              Coded by +Z90               |");
print("|           http://samp-rus.com/           |");
print("___________________________________________");

    SetTimer("Ventilyato", 100, 1);
	SetTimer("Dvig", 300, 1);
	SetTimer("Timers", 1000, 1);
	SetTimer("CustomPickups", 1000, 1);
    
    CreateObject(1744,2026.457,-2489.420,1112.532,0.0,0.0,-90.000);
	CreateObject(2314,2021.367,-2492.417,1112.536,0.0,0.0,0.0);
	CreateObject(2314,2021.357,-2492.823,1113.036,0.0,0.0,0.0);
	CreateObject(2314,2023.759,-2492.418,1112.536,0.0,0.0,0.0);
	CreateObject(2314,2023.747,-2492.816,1113.036,0.0,0.0,0.0);
	CreateObject(2314,2025.668,-2491.432,1112.536,0.0,0.0,-90.000);
	CreateObject(2314,2026.108,-2491.444,1113.011,0.0,0.0,-90.000);
	CreateObject(2314,2026.102,-2491.435,1112.521,0.0,0.0,-90.000);
	CreateObject(927,2026.467,-2489.510,1114.246,0.0,0.0,-90.000);
	CreateObject(931,2021.562,-2487.964,1113.501,0.0,0.0,-90.000);
	CreateObject(1555,2022.435,-2489.167,1112.071,0.0,0.0,-180.000);
	CreateObject(1555,2021.046,-2487.724,1112.093,0.0,0.0,-90.000);
	CreateObject(1555,2021.046,-2486.931,1112.076,0.0,0.0,-90.000);
	CreateObject(1555,2022.390,-2489.164,1112.146,0.0,-90.241,-90.077);
	CreateObject(1555,2022.478,-2486.938,1112.037,0.0,0.0,-180.000);
	CreateObject(1555,2021.108,-2489.064,1113.025,0.0,-88.522,-90.000);
	CreateObject(1675,2024.367,-2491.225,1118.256,0.0,-179.623,-0.937);
	CreateObject(18258,2016.336,-2490.037,1112.517,0.0,-1.719,-362.578);
	CreateObject(18258,2023.776,-2497.097,1112.491,0.0,-1.719,-632.578);
	CreateObject(18258,2031.039,-2491.257,1112.266,0.0,-1.719,-902.578);
	CreateObject(18258,2025.048,-2482.956,1112.216,0.0,-1.719,-1172.578);
	CreateObject(1535,2026.475,-2487.255,1112.532,0.0,0.0,-450.000);
	CreateObject(15048,2011.816,-2493.800,1116.459,0.0,0.0,0.0);
	CreateObject(15033,1205.296,-1368.529,1112.495,0.0,0.0,-90.000);
	CreateObject(1646,1206.259,-1365.443,1112.632,0.0,0.0,-90.000);
	CreateObject(1646,1206.272,-1366.434,1112.621,0.0,0.0,-90.000);
	CreateObject(1767,1206.498,-1369.006,1112.369,0.0,0.0,-360.000);
	CreateObject(1767,1205.053,-1368.987,1112.352,0.0,0.0,-360.000);
	CreateObject(1814,1205.786,-1371.343,1112.359,0.0,0.0,-360.000);
	CreateObject(2708,1199.717,-1366.540,1112.375,0.0,0.0,90.000);
	CreateObject(1738,1199.586,-1367.980,1112.977,0.0,0.0,-90.000);
	CreateObject(1791,1206.171,-1374.873,1114.042,0.0,0.0,-180.000);
	CreateObject(1808,1199.626,-1374.207,1112.373,0.0,0.0,-270.000);
	CreateObject(1828,1201.688,-1376.745,1112.375,0.0,0.0,-90.000);
	CreateObject(1841,1205.528,-1374.523,1114.741,0.0,0.0,-450.000);
	CreateObject(1841,1206.978,-1374.529,1114.714,0.0,0.0,-90.000);
	CreateObject(2099,1199.335,-1370.930,1112.397,0.0,0.0,-270.000);
	CreateObject(2689,1199.838,-1365.625,1114.132,0.0,0.0,0.0);
	CreateObject(2704,1199.813,-1366.621,1114.107,0.0,0.0,0.0);
	CreateObject(1535,1202.379,-1381.129,1112.496,0.0,0.0,-180.000);
	CreateObject(1535,1203.616,-1377.477,1112.469,0.0,0.0,-450.000);
	CreateObject(1535,1199.067,-1376.971,1112.496,0.0,0.0,-270.000);
	CreateObject(11490,1278.223,-1337.763,11.643,0.0,0.0,-630.000);
	CreateObject(1502,1273.882,-1339.270,13.083,0.0,0.0,-270.000);
	CreateObject(1649,1285.548,-1334.769,14.766,0.0,0.0,-90.000);
	CreateObject(1649,1285.548,-1335.228,18.075,0.0,0.0,-90.000);
	CreateObject(1649,1285.548,-1340.662,14.790,0.0,0.0,-90.000);
	CreateObject(1649,1285.523,-1340.056,18.081,0.0,0.0,-90.000);
	CreateObject(1736,1285.230,-1337.719,16.564,0.0,0.0,-90.000);
	CreateObject(1828,1276.049,-1337.837,13.123,0.0,0.0,-360.000);
	CreateObject(1765,1281.274,-1341.783,13.157,0.0,0.0,-180.000);
	CreateObject(1765,1280.200,-1333.726,13.175,0.0,0.0,-360.000);
	CreateObject(1502,1273.839,-1336.253,13.091,0.0,0.0,-450.000);
	CreateObject(1535,1244.808,-1277.788,1112.775,0.0,0.0,-191.250);
	CreateObject(2514,1244.334,-1282.469,1112.725,0.0,0.0,-101.250);
	CreateObject(2515,1245.363,-1278.703,1113.666,0.0,0.0,-101.250);
	CreateObject(2515,1245.133,-1279.811,1113.691,0.0,0.0,-101.250);
	CreateObject(2602,1242.082,-1280.397,1113.224,0.0,0.0,-281.250);
	CreateObject(2528,1243.670,-1285.366,1112.625,0.0,0.0,-191.250);
	CreateObject(2741,1245.390,-1279.304,1114.080,0.0,0.0,-101.250);
	CreateObject(14484,1230.077,-1312.571,1115.975,0.0,0.0,-11.250);
	CreateObject(14865,1244.335,-1406.375,1114.108,0.0,0.0,0.0);
	CreateObject(14831,1242.775,-1395.269,1113.594,0.0,0.0,0.0);
	CreateObject(1511,1245.314,-1409.871,1113.418,0.0,0.0,-180.000);
	CreateObject(1541,1244.988,-1407.489,1113.476,0.0,0.0,-180.000);
	CreateObject(1665,1247.707,-1407.391,1113.185,0.0,0.0,0.0);
	CreateObject(1546,1246.812,-1407.290,1113.239,0.0,0.0,0.0);
	CreateObject(14588,1377.871,-1401.498,1115.563,0.0,0.0,-90.000);
	CreateObject(1348,1337.304,-1410.367,1112.365,0.0,0.0,0.0);
	CreateObject(927,1342.932,-1416.496,1113.459,0.0,0.0,-180.000);
	CreateObject(929,1341.048,-1416.073,1112.557,0.0,0.0,-450.000);
	CreateObject(959,1336.199,-1414.165,1112.478,0.0,0.0,-90.000);
	CreateObject(1555,1343.966,-1412.188,1111.656,0.0,0.0,-270.000);
	CreateObject(1535,1248.423,-1405.241,1112.096,0.0,0.0,-90.000);
	CreateObject(14481,1241.446,-1284.603,1114.154,0.0,0.0,-191.250);

	CreatePickup(1318,2, 1201.5577,-1380.5771,1113.5028);
	CreatePickup(1318,2, 2026.0839,-2488.0210,1113.6621);
	CreatePickup(1318,2, 1240.7853,-1406.9570,1113.1080);
	CreatePickup(1318,2, 1203.0576,-1378.1368,1113.5028);
	CreatePickup(1318,2, 1277.8596,-1341.8712,14.1508);
	CreatePickup(1318,2, 1343.2898,-1411.4813,1112.6689);
	CreatePickup(1318,2, 1243.7854,-1278.2550,1113.7250);
	CreatePickup(1318,2, 1199.9458,-1376.3235,1113.5028);
	CreatePickup(1318,2, 1277.9873,-1333.6337,14.1508);
	CreatePickup(1318,2, 1247.5471,-1405.9254,1113.1080);
	CreatePickup(1239,2,1245.2161,-1406.1733,1113.1154);
	CreatePickup(1239,2,1200.1912,-1374.1790,1113.5028);
	CreatePickup(1239,2,1338.8295,-1415.9998,1112.6646);
	CreatePickup(1239,2,1200.7101,-1370.7496,1113.5028);
	
	Ventilyator = CreateObject(14527,1203.568,-1370.835,1115.135,0.0,0.0,0.0);
	return 1;
}

public OnPlayerConnect(playerid){
	SendClientMessage(playerid, COLOR_YELLOW, "На сервере установлен скрипт 'Баня' (v1.0) от +Z90. Скачано с http://samp-rus.com/");
	SendClientMessage(playerid, COLOR_YELLOW, "Рекомендуем посетить этот сайт. Там Вы найдёте множество полезных программ/скриптов/модов.");
	SendClientMessage(playerid, COLOR_GREEN, "Чтобы получить помощь по скрипту - используйте команду '/bhelp'");
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[]){
	new cmd[256];
	new idx;
	new sendername[MAX_PLAYER_NAME];
	new string[256];
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/culer",true) == 0){
	    if(IsPlayerConnected(playerid)){
	    new Float:health;
	    GetPlayerHealth(playerid, health);
	        if(PlayerToPoint(3, playerid, 1200.1912,-1374.1790,1113.5028)){
			 if(health < 110){
			 	SetPlayerHealth(playerid, health + 25.0);
			 	PlayerPlaySound(playerid, 1052, 1200.1912,-1374.1790,1113.5028);
			 	GetPlayerName(playerid, sendername, sizeof(sendername));
			 	format(string, sizeof(string), "** %s выпил воды из кулера", sendername);
	 		 	ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
 			 	SendClientMessage(playerid, COLOR_YELLOW, " Вы выпили воды из кулера! ");
			 }
	         else{
   				SendClientMessage(playerid, COLOR_LIGHTRED, " Вы не хотите пить! ");
       		 }
			}
			else{
   			SendClientMessage(playerid, COLOR_YELLOW, " Вы слишком далеко от кулера! ");
			}
		}
	return 1;
	}
	
	if(strcmp(cmd, "/bar", true) == 0){
		if(IsPlayerConnected(playerid)){
		new Float:health;
		GetPlayerHealth(playerid, health);
		new x_nr[256];
		x_nr = strtok(cmdtext, idx);
		if(PlayerToPoint(5, playerid, 1245.2161,-1406.1733,1113.1154)){
				if(!strlen(x_nr)){
				SendClientMessage(playerid, COLOR_GREEN, "|__________________ Бар __________________|");
				SendClientMessage(playerid, COLOR_WHITE, "Используйте: /bar [наименование товарв]");
				SendClientMessage(playerid, COLOR_GREY, " Чипсы (12$), Кальмары (20$) Пицца (40$)");
				SendClientMessage(playerid, COLOR_GREY, " Сода (5$), Кока-Кола (10$), Чай (6$), Кофе (8$) ");
				SendClientMessage(playerid, COLOR_GREEN, "|_________________________________________|");
				return 1;
				}
			if(strcmp(x_nr,"Чипсы",true) == 0){
				GivePlayerMoney(playerid, -12 );
					if(health < 110){
						SetPlayerHealth(playerid, health + 12.0);
						OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
						PlayerPlaySound(playerid, 1052, 1245.2161,-1406.1733,1113.1154);
			 			GetPlayerName(playerid, sendername, sizeof(sendername));
			 			format(string, sizeof(string), "** %s ест чипсы", sendername);
	 		 			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SendClientMessage(playerid, COLOR_GRAD2, "Вы съели чипсы!");
					}
			}
			if(strcmp(x_nr,"Кальмары",true) == 0){
				GivePlayerMoney(playerid, - 20);
					if(health < 110){
						SetPlayerHealth(playerid, health + 20.0);
						OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
						PlayerPlaySound(playerid, 1052, 1245.2161,-1406.1733,1113.1154);
			 			GetPlayerName(playerid, sendername, sizeof(sendername));
			 			format(string, sizeof(string), "** %s ест кальмары", sendername);
	 		 			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SendClientMessage(playerid, COLOR_GRAD2, "Вы съели кальмары!");
				    }
			}
			if(strcmp(x_nr,"Пицца",true) == 0){
				GivePlayerMoney(playerid, - 40);
					if(health < 110){
						SetPlayerHealth(playerid, health + 40.0);
						OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
						PlayerPlaySound(playerid, 1052, 1245.2161,-1406.1733,1113.1154);
			 			GetPlayerName(playerid, sendername, sizeof(sendername));
			 			format(string, sizeof(string), "** %s ест пиццу", sendername);
	 		 			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SendClientMessage(playerid, COLOR_GRAD2, "Вы съели пиццу!");
				    }
			}
			if(strcmp(x_nr,"Сода",true) == 0){
				GivePlayerMoney(playerid, - 5);
					if(health < 110){
						SetPlayerHealth(playerid, health + 5.0);
						OnePlayAnim(playerid,"BAR","dnk_stndM_loop",4.1,0,1,1,1,1);
						PlayerPlaySound(playerid, 1052, 1245.2161,-1406.1733,1113.1154);
			 			GetPlayerName(playerid, sendername, sizeof(sendername));
			 			format(string, sizeof(string), "** %s пьёт соду", sendername);
	 		 			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SendClientMessage(playerid, COLOR_GRAD2, "Вы выпили баночку соды !");
					}
			}
			if(strcmp(x_nr,"Кока-кола",true) == 0){
				GivePlayerMoney(playerid, - 10);
					if(health < 100){
						SetPlayerHealth(playerid, health + 10.0);
						OnePlayAnim(playerid,"BAR","dnk_stndM_loop",4.1,0,1,1,1,1);
						PlayerPlaySound(playerid, 1052, 1245.2161,-1406.1733,1113.1154);
			 			GetPlayerName(playerid, sendername, sizeof(sendername));
			 			format(string, sizeof(string), "** %s пьёт кока-колу", sendername);
	 		 			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SendClientMessage(playerid, COLOR_GRAD2, "Вы выпили баночку кока-колы!");
					}
			}
			if(strcmp(x_nr,"Чай",true) == 0){
				GivePlayerMoney(playerid, - 6);
					if(health < 110){
						SetPlayerHealth(playerid, health + 6.0);
						OnePlayAnim(playerid,"BAR","dnk_stndM_loop",4.1,0,1,1,1,1);
						PlayerPlaySound(playerid, 1052, 1245.2161,-1406.1733,1113.1154);
			 			GetPlayerName(playerid, sendername, sizeof(sendername));
			 			format(string, sizeof(string), "** %s пьёт чай", sendername);
	 		 			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SendClientMessage(playerid, COLOR_GRAD2, "Вы выпили чай !");
					}
			}
			if(strcmp(x_nr,"Кофе",true) == 0){
				GivePlayerMoney(playerid, - 8);
					if(health < 110){
						SetPlayerHealth(playerid, health + 8.0);
						OnePlayAnim(playerid,"BAR","dnk_stndM_loop",4.1,0,1,1,1,1);
						PlayerPlaySound(playerid, 1052, 1245.2161,-1406.1733,1113.1154);
			 			GetPlayerName(playerid, sendername, sizeof(sendername));
			 			format(string, sizeof(string), "** %s пьёт кофе", sendername);
	 		 			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SendClientMessage(playerid, COLOR_GRAD2, "Вы выпили чашечку кофе!");
					}
			}
		}
		}
	return 1;
	}
	if(strcmp(cmd, "/on", true) == 0){
	new Float:posx, Float:posy, Float:posz;
	GetPlayerPos(playerid, posx, posy, posz);
	for(new i = 0; i < MAX_PLAYERS; i++){
		 if(PlayerToPoint(2.0, i, 1338.8295,-1415.9998,1112.6646)){
			object1 = CreateObject(2780,2021.741,-2488.449,1113.172,221.735,-436.593,-138.334);
			object2 = CreateObject(2780,2021.741,-2488.449,1113.172,221.735,-436.593,-138.334);
			object3 = CreateObject(3461,2021.982,-2487.891,1110.322,0.0,0.0,0.0);
			object4 = CreateObject(1691,1278.944,-1353.368,17.529,0.0,-1436.970,-718.110);
			object5 = CreateObject(1689,1343.493,-1417.086,1111.164,0.0,0.0,0.0);
			object6 = CreateObject(3461,2021.627,-2488.143,-110.142,0.0,0.0,0.0);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "** %s включил систему отопления", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			SetPlayerPos(playerid, 1338.8230,-1415.9785,1112.6646);
			SetPlayerFacingAngle(playerid, 266.5533);
		 	LoopingAnim(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0);
		 	Anim1[playerid] = 1;
		 	MusicTime[i] = 1;
		}
		else{
		SendClientMessage(playerid, COLOR_LIGHTRED, " Вы не находитесь возле панели управления! ");
		}
		return 1;
	}
	}
	if(strcmp(cmd, "/off", true) == 0){
	new Float:posx, Float:posy, Float:posz;
	GetPlayerPos(playerid, posx, posy, posz);
	for(new i = 0; i < MAX_PLAYERS; i++){
		if(PlayerToPoint(1.0, i,1338.8295,-1415.9998,1112.6646)){
			DestroyObject(object1);
			DestroyObject(object2);
			DestroyObject(object3);
			DestroyObject(object4);
			DestroyObject(object5);
			DestroyObject(object6);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "** %s выключил систему отопления", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			MusicTime[i] = 0;
			SetPlayerPos(playerid, 1338.8230,-1415.9785,1112.6646);
			SetPlayerFacingAngle(playerid, 266.5533);
		 	LoopingAnim(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0);
		 	Anim1[playerid] = 1;
		}
		else{
		SendClientMessage(playerid, COLOR_LIGHTRED, " Вы не находитесь возле панели управления! ");
		}
		return 1;
	}
	}
	
	if(strcmp(cmd, "/caminon", true) == 0){
		if(PlayerToPoint(2, playerid,1284.7249,-1337.3871,14.1508)){
			camin = CreateObject(3461,1285.931,-1338.014,10.107,0.0,0.0,-303.750);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "** %s зажёг камин", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			OnePlayAnim(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
		}
		else{
		SendClientMessage(playerid, COLOR_LIGHTRED, " Вы слишком далеко от камина! ");
		}
		return 1;
	}
	
	if(strcmp(cmd, "/caminoff", true) == 0){
		if(PlayerToPoint(2, playerid,1284.7249,-1337.3871,14.1508)){
			DestroyObject(camin);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "** %s потушил камин", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			OnePlayAnim(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
		}
		else{
		SendClientMessage(playerid, COLOR_LIGHTRED, " Вы слишком далеко от камина! ");
		}
		return 1;
	}
	
	if(strcmp(cmd, "/dush", true) == 0){
		if(PlayerToPoint(2, playerid,1241.2308,-1284.8712,1113.7250)){
			dush = CreateObject(3515,1240.426,-1290.515,1112.245,0.0,-18.908,-88.900);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "** %s открыл воду", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			Anim1[playerid] = 1;
			LoopingAnim(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0);
			SetPlayerFacingAngle(playerid, 169.5847);
		}
		else{
		SendClientMessage(playerid, COLOR_LIGHTRED, " Вы не в душе! ");
		}
		return 1;
	}
	
	if(strcmp(cmd, "/dushoff", true) == 0){
		if(PlayerToPoint(2, playerid,1241.2308,-1284.8712,1113.7250)){
			DestroyObject(dush);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "** %s закрыл воду", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			Anim1[playerid] = 1;
			LoopingAnim(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0);
			SetPlayerFacingAngle(playerid, 169.5847);
		}
		else{
		SendClientMessage(playerid, COLOR_LIGHTRED, " Вы не в душе! ");
		}
		return 1;
	}
	
	if(strcmp(cmd, "/vent", true) == 0){
		new Float:posx, Float:posy, Float:posz;
        GetPlayerPos(playerid, posx, posy, posz);
        for(new i = 0; i < MAX_PLAYERS; i++){
            if(PlayerToPoint(3.0, i, 1200.7101,-1370.7496,1113.5028)){
				VentilyatorTime[i] = 1;
            	GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "** %s включил вентилятор", sendername);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
        }
        return 1;
     }
     if(strcmp(cmd, "/ventoff", true) == 0){
     	for(new i = 0; i < MAX_PLAYERS; i++){
     		if(PlayerToPoint(3.0, i, 1200.7101,-1370.7496,1113.5028)){
	 			VentilyatorTime[i] = 0;
	 			GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "** %s выключил вентилятор", sendername);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
     		
   		}
        return 1;
     }
     if(strcmp(cmd, "/bhelp", true) == 0){
        bhelp[playerid] = 1;
        return 1;
     }
	if(strcmp(cmd, "/enter", true) == 0)
	{
	    if(IsPlayerConnected(playerid)){
			if (PlayerToPoint(2.0, playerid, 1201.5577,-1380.5771,1113.5028)){
				SetPlayerPos(playerid, 2026.0839,-2488.0210,1113.6621);
				SetPlayerWorldBounds(playerid, 2026.0925,2020.9636,-2487.3752,-2492.0056);
			}
			else if (PlayerToPoint(2.0, playerid, 1240.7853,-1406.9570,1113.1080)){
				SetPlayerPos(playerid, 1203.0576,-1378.1368,1113.5028);
			}
			else if (PlayerToPoint(2.0, playerid, 1277.8596,-1341.8712,14.1508)){
				SetPlayerPos(playerid, 1343.2898,-1411.4813,1112.6689);
			}
			else if (PlayerToPoint(2.0, playerid, 1243.7854,-1278.2550,1113.7250)){
				SetPlayerPos(playerid, 1199.9458,-1376.3235,1113.5028);
			}
			else if (PlayerToPoint(2.0, playerid, 1277.9873,-1333.6337,14.1508)){
			    SetPlayerPos(playerid, 1247.5471,-1405.9254,1113.1080);
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/exit", true) == 0){
	    if(IsPlayerConnected(playerid)){
			if (PlayerToPoint(2.0, playerid, 2026.0839,-2488.0210,1113.6621)){
				SetPlayerPos(playerid, 1201.5577,-1380.5771,1113.5028);
				SetPlayerWorldBounds(playerid, 20000.0000,-20000.0000,20000.0000,-20000.0000);
			}
			else if (PlayerToPoint(2.0, playerid, 1203.0576,-1378.1368,1113.5028)){
				SetPlayerPos(playerid, 1240.7853,-1406.9570,1113.1080);
			}
			else if (PlayerToPoint(2.0, playerid, 1343.2898,-1411.4813,1112.6689)){
			SetPlayerPos(playerid, 1277.8596,-1341.8712,14.1508);
			}
			else if (PlayerToPoint(2.0, playerid, 1199.9458,-1376.3235,1113.5028)){
				SetPlayerPos(playerid, 1243.7854,-1278.2550,1113.7250);
			}
			else if (PlayerToPoint(2.0, playerid, 1247.5471,-1405.9254,1113.1080)){
			    SetPlayerPos(playerid, 1277.9873,-1333.6337,14.1508);
			}
		}
		return 1;
	}
	return 0;
}

public Ventilyato(){
for(new i = 0; i < MAX_PLAYERS; i++){
    if(IsPlayerConnected(i)){
    if(VentilyatorTime[i] < 1) VentilyatorTime[i] = 0;
		if(VentilyatorTime[i] >= 1){
 			VentilyatorTime[i] += 1;
			if(VentilyatorTime[i] == 1){
   			    SetObjectRot(Ventilyator, 0.0,0.0,20);
			}
			else if(VentilyatorTime[i] == 2){
			    SetObjectRot(Ventilyator, 0.0,0.0,40);
			}
			else if(VentilyatorTime[i] == 3){
			    SetObjectRot(Ventilyator, 0.0,0.0,60);
			}
			else if(VentilyatorTime[i] == 4){
			    SetObjectRot(Ventilyator, 0.0,0.0,80);
			}
			else if(VentilyatorTime[i] == 5){
			    SetObjectRot(Ventilyator, 0.0,0.0,100);
			}
			else if(VentilyatorTime[i] == 6){
			    SetObjectRot(Ventilyator, 0.0,0.0,120);
			}
			else if(VentilyatorTime[i] == 7){
			    SetObjectRot(Ventilyator, 0.0,0.0,140);
			}
			else if(VentilyatorTime[i] == 8){
			    SetObjectRot(Ventilyator, 0.0,0.0,160);
			}
			else if(VentilyatorTime[i] == 9){
   			    SetObjectRot(Ventilyator, 0.0,0.0,180);
			}
			else if(VentilyatorTime[i] == 10){
			    SetObjectRot(Ventilyator, 0.0,0.0,200);
			}
			else if(VentilyatorTime[i] == 11){
			    SetObjectRot(Ventilyator, 0.0,0.0,220);
			}
			else if(VentilyatorTime[i] == 12){
			    SetObjectRot(Ventilyator, 0.0,0.0,240);
			}
			else if(VentilyatorTime[i] == 13){
			    SetObjectRot(Ventilyator, 0.0,0.0,260);
			}
			else if(VentilyatorTime[i] == 14){
   			    SetObjectRot(Ventilyator, 0.0,0.0,280);
			}
			else if(VentilyatorTime[i] == 15){
			    SetObjectRot(Ventilyator, 0.0,0.0,300);
			}
			else if(VentilyatorTime[i] == 16){
			    SetObjectRot(Ventilyator, 0.0,0.0,320);
			}
			else if(VentilyatorTime[i] == 17){
			    SetObjectRot(Ventilyator, 0.0,0.0,340);
			}
			else if(VentilyatorTime[i] == 18){
			    SetObjectRot(Ventilyator, 0.0,0.0,360);
			}
			else if(VentilyatorTime[i] == 19){
			    VentilyatorTime[i] = 1;
			}
		}
	}
	}
}
public Dvig(){
for(new i = 0; i < MAX_PLAYERS; i++){
    if(IsPlayerConnected(i)){
		if(MusicTime[i] < 1) MusicTime[i] = 0; 
		if(MusicTime[i] >= 1){
 			MusicTime[i] += 1;
			if(MusicTime[i] == 1){
   			    PlaySoundAll(i,1153, 1338.8295,-1415.9998,1112.6646);
			}
			else if(MusicTime[i] == 4){
			    PlaySoundAll(i,1153, 1338.8295,-1415.9998,1112.6646);
			    MusicTime[i] = 1;
			}
		}
	}
	}
}

public Timers(){
for(new i = 0; i < MAX_PLAYERS; i++){
    if(IsPlayerConnected(i)){
		if(Anim1[i] >= 1){
		    Anim1[i] += 1;
		    if(Anim1[i] == 3){
      			StopLoopingAnim(i);
      			Anim1[i] = 0;
			}
		}
		if(bhelp[i] >= 1){
			bhelp[i] += 1;
			if(bhelp[i] == 2){
				SetPlayerCameraPos(i, 1251.8632,-1346.7782,13.1616);
				SetPlayerCameraLookAt(i, 1273.8871,-1337.8119,14.1508);
				SendClientMessage(i, COLOR_GREEN, " |___________________________________________________| ");
				SendClientMessage(i, COLOR_YELLOW, " Баня находится в центре Лос-Сантоса ");
				SendClientMessage(i, COLOR_GREEN, " |___________________________________________________| ");
			}
		    else if(bhelp[i] == 8){
		        SetPlayerCameraPos(i, 1277.8969,-1337.5635,14.1508);
		        SetPlayerCameraLookAt(i, 1285.0305,-1337.6626,14.1508);
		        obj1 = CreatePlayerObject(i, 1318,1284.767,-1337.685,13.949,0.0,0.0,-360.000);
		        SendClientMessage(i, COLOR_YELLOW, " При заходе в баню Вы можете увидеть камин. ");
		        SendClientMessage(i, COLOR_YELLOW, " Чтобы зажечь нужно подойти к нему. (( /caminon & /caminoff )) ");
		        SendClientMessage(i, COLOR_GREEN, " |___________________________________________________| ");
			}
			else if(bhelp[i] == 18){
				DestroyPlayerObject(i, obj1);
                SetPlayerCameraPos(i, 1342.6216,-1411.2979,1112.6682);
		        SetPlayerCameraLookAt(i, 1338.8256,-1416.0271,1112.6646);
		        SendClientMessage(i, COLOR_YELLOW, " Это машинное отеделение. Здесь находится ");
		        SendClientMessage(i, COLOR_YELLOW, " Чтобы включить котёл подойдите к нему. (( /on & /off )) ");
		        SendClientMessage(i, COLOR_GREEN, " |___________________________________________________| ");
			}
			else if(bhelp[i] == 26){
   				SetPlayerCameraPos(i, 1241.1213,-1405.6625,1113.1080);
		        SetPlayerCameraLookAt(i, 1245.3810,-1406.2200,1113.1154);
		        SendClientMessage(i, COLOR_YELLOW, " Это бар. Чтобы открыть меню подойдите к барной стойке (( /bar )) ");
		        SendClientMessage(i, COLOR_GREEN, " |___________________________________________________| ");
			}
			else if(bhelp[i] == 34){
			    SetPlayerCameraPos(i, 1243.1685,-1280.8875,1113.7250);
		        SetPlayerCameraLookAt(i, 1241.2777,-1284.6022,1113.7250);
		        obj2 = CreatePlayerObject(i, 1318,1241.186,-1285.325,13.374,0.0,0.0,-101.250);
		        SendClientMessage(i, COLOR_YELLOW, " В этой комнате находится душ. Чтобы включить воду подойдите к крану. (( /dush & /dushoff )) ");
		        SendClientMessage(i, COLOR_GREEN, " |___________________________________________________| ");
			}
			else if(bhelp[i] == 42){
				DestroyPlayerObject(i, obj2);
			    SetPlayerCameraPos(i, 1203.7310,-1369.7072,1113.5028);
		        SetPlayerCameraLookAt(i, 1200.3221,-1374.0189,1113.5028);
		        SendClientMessage(i, COLOR_YELLOW, " Это кулер. Подойдите к нему, чтобы попить воды. (( /culer )) ");
		        SendClientMessage(i, COLOR_GREEN, " |___________________________________________________| ");
			}
			else if(bhelp[i] == 50){
			    bhelp[i] = 0;
			    SetCameraBehindPlayer(i);
			}
		}

	}
}
}
        
public CustomPickups(){
    new Float:oldposx, Float:oldposy, Float:oldposz;
	for(new i = 0; i < MAX_PLAYERS; i++){
		if(IsPlayerConnected(i)){
		GetPlayerPos(i, oldposx, oldposy, oldposz);
			if (PlayerToPoint(2.0, i, 1201.5577,-1380.5771,1113.5028)){
				GameTextForPlayer(i, "~w~use /enter to enter into ~n~~y~Steam-Room", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 2026.0839,-2488.0210,1113.6621)){
				GameTextForPlayer(i, "~w~use /exit to exit from ~n~~y~Steam-Room", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1203.0576,-1378.1368,1113.5028)){
				GameTextForPlayer(i, "~w~use /exit to enter into ~n~~y~Bar", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 2026.0839,-2488.0210,1113.6621)){
				GameTextForPlayer(i, "~w~use /exit to exit from ~n~~y~Steam-Room", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1240.7853,-1406.9570,1113.1080)){
				GameTextForPlayer(i, "~w~use /enter to enter into ~n~~y~Bar", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1277.8596,-1341.8712,14.1508)){
				GameTextForPlayer(i, "~w~use /enter to enter into ~n~~y~Engine Room", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1343.2898,-1411.4813,1112.6689)){
				GameTextForPlayer(i, "~w~use /exit to exit from ~n~~y~Engine Room", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 2026.0839,-2488.0210,1113.6621)){
				GameTextForPlayer(i, "~w~use /exit to exit from ~n~~y~Steam-Room", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 2026.0839,-2488.0210,1113.6621)){
				GameTextForPlayer(i, "~w~use /exit to exit from ~n~~y~Steam-Room", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1243.7854,-1278.2550,1113.7250)){
				GameTextForPlayer(i, "~w~use /enter to enter into ~n~~y~Toilet", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1199.9458,-1376.3235,1113.5028)){
				GameTextForPlayer(i, "~w~use /exit to exit from ~n~~y~Toilet", 5000, 5);
			}
   			else if(PlayerToPoint(2.0, i, 1200.1912,-1374.1790,1113.5028)){
				GameTextForPlayer(i, "~w~use /culer to ~g~drink", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1245.2161,-1406.1733,1113.1154)){
				GameTextForPlayer(i, "~w~use /bar to see menu", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1338.8295,-1415.9998,1112.6646)){
				GameTextForPlayer(i, "~w~use /on & /off", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1200.7101,-1370.7496,1113.5028)){
				GameTextForPlayer(i, "~w~use /vent & /ventoff", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1241.2308,-1284.8712,1113.7250)){
				GameTextForPlayer(i, "~w~use /dush & /dushoff", 5000, 5);
			}
			else if(PlayerToPoint(2.0, i, 1284.7249,-1337.3871,14.1508)){
				GameTextForPlayer(i, "~w~use /caminon & /caminoff", 5000, 5);
			}
		}
	}
		return 1;
}

public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5){
	if(IsPlayerConnected(playerid)){
		new Float:posx, Float:posy, Float:posz;
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		for(new i = 0; i < MAX_PLAYERS; i++){
			if(IsPlayerConnected(i)){
					GetPlayerPos(i, posx, posy, posz);
					tempposx = (oldposx -posx);
					tempposy = (oldposy -posy);
					tempposz = (oldposz -posz);
					if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))){
						SendClientMessage(i, col1, string);
					}
					else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))){
						SendClientMessage(i, col2, string);
					}
					else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))){
						SendClientMessage(i, col3, string);
					}
					else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))){
						SendClientMessage(i, col4, string);
					}
					else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))){
						SendClientMessage(i, col5, string);
					}
			}
		}
	}
	return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z){
    if(IsPlayerConnected(playerid)){
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))){
			return 1;
		}
	}
	return 0;
}

public PlaySoundAll(playerid, soundid, Float:psx ,Float:psy ,Float:psz){
	for(new i = 0; i <= MAX_PLAYERS; i++){
		if(IsPlayerConnected(i) == 1){
			PlayerPlaySound(i, soundid, psx, psy, psz);
		}
	}
}

OnePlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp){
	ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp){
    gPlayerUsingLoopingAnim[playerid] = 1;
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}
StopLoopingAnim(playerid){
	gPlayerUsingLoopingAnim[playerid] = 0;
    ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
	if(!gPlayerUsingLoopingAnim[playerid]) return;

	if(IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys)){
	    StopLoopingAnim(playerid);
    }
}
