
DCMD:ahelp ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new help [ 305 + 288 + 120 + 60 ] ;
	
	new to_help1 [] = "\
	/кик        \t\t   [/kick]       \t\t   Кикнуть игрока\n\
	/бан        \t\t   [/ban]        \t\t   Забанить игрока\n\
	/слап       \t\t   [/slap]       \t\t   Подкинуть игрока вверх\n\
	/ао         \t\t   [/ao]         \t\t   Общий чат (Анонс)\n\
	/пм         \t\t   [/pm]         \t\t   Сообщение игроку\n";
	strcat ( help, to_help1 ) ;
	
	new to_help2 [] = "\
	/тп         \t\t   [/tp]         \t\t   Телепорт меню\n\
	/кигроку    \t\t   [/toplayer]   \t\t   ТП к игроку\n\
	/ксебе      \t\t   [/tohim]      \t\t   ТП игрока к себе\n\
	/тпавто     \t\t   [/tpveh]      \t\t   ТП авто к себе\n\
	/аарест     \t\t   [/aarest]     \t\t   Арест игрока\n";
	strcat ( help, to_help2 ) ;
	
	new to_help3 [] = "\
	/перенести  \t\t   [/move]       \t\t   Перенести Дом/Бизнес\n\
	/аменю      \t\t   [/amenu]      \t\t   Админ меню\n";
	if ( PLAYER [ playerid ] [ ADMIN ] > 5 ) strcat ( help, to_help3 ) ;
	
	new to_help4 [] = "\
	/фменю      \t\t   [/fmenu]      \t\t   Фракционое меню\n";
	if ( PLAYER [ playerid ] [ ADMIN ] > 3 ) strcat ( help, to_help4 ) ;
	
	HelpDialog ( playerid, help ) ;
	
	return 1;
}

DCMD:amenu ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 6 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	ShowPlayerDialog ( playerid, DIALOG_ADMIN_MENU, DIALOG_STYLE_LIST, "{FFFFFF}Админ меню", "Назначить администратора\nСписок администрации", "Выбрать", "Отмена" ) ;
	
	return 1;
}

DCMD:fmenu ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 4 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new list [ 1000 ], to_list [ 100 ] ;
	
	for ( new fid = 0; fid < FractionCount ; fid++ )
	{
		if ( !FRACTION [ fid ] [ ID ] ) continue;
		echo ( to_list, "{%h}%s  {FFFFFF}[%s]\n", FRACTION [ fid ] [ Color ] >>> 8, FRACTION [ fid ] [ Name ], typeFraction [ FRACTION [ fid ] [ Type ] ] ) ;
		strcat ( list, to_list ) ;
	}
	
	ShowPlayerDialog ( playerid, DIALOG_FRAC_OPTIONS, DIALOG_STYLE_LIST, "{FFFFFF}Список фракций", list, "Выбрать", "Отмена" ) ;
	
	return 1;
}

DCMD:create ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 8 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;

	ShowDialog ( playerid, Show:AdminCreate, DIALOG_STYLE_LIST, "Создание", "Дом\nГараж\nБизнес", "Выбрать", "Отмена" ) ;
	
	return 1;
}

DCMD:move ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 6 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new type [ 24 ], id, Float:PPOS [ 4 ];
	
	GetPlayerPos ( playerid, PPOS [ 0 ], PPOS [ 1 ], PPOS [ 2 ] ) ;
	GetPlayerFacingAngle ( playerid, PPOS [ 3 ] ) ;
	
	if ( !sscanf ( params, "s[24]d", type, id ) ) 
	{
		if ( !strcmp ( type, "сбизнес", true ) ) 
		{
			new i = ReturnIndexSBusinesForID ( id ) ;
			
			if ( i == -1 ) return Send ( playerid, COLOR_GRAY, "Не верный ID СБизнеса!" ) ;
			
			SBUSINESS [ i ] [ Position ] [ 0 ] = PPOS [ 0 ];
			SBUSINESS [ i ] [ Position ] [ 1 ] = PPOS [ 1 ];
			SBUSINESS [ i ] [ Position ] [ 2 ] = PPOS [ 2 ];
			
			DeleteSbusinesItems ( i ) ;
			CreateSbusinesItems ( i ) ;
			
			new text [ 128 ] ;
			echo ( text, "С-Бизнес %s (#%d) перенесен!", SBUSINESS [ i ] [ Name ], SBUSINESS [ i ] [ ID ] ) ;
			Send ( playerid, COLOR_BLUE, text ) ;
			
		}
		
		else if ( !strcmp ( type, "дом", true ) ) 
		{
			new i = ReturnIndexHouseForID ( id ) ;
			
			if ( i == -1 ) return Send ( playerid, COLOR_GRAY, "Не верный ID Дома!" ) ;
			
			HOUSE [ i ] [ Position ] [ 0 ] = PPOS [ 0 ];
			HOUSE [ i ] [ Position ] [ 1 ] = PPOS [ 1 ];
			HOUSE [ i ] [ Position ] [ 2 ] = PPOS [ 2 ];
			HOUSE [ i ] [ Position ] [ 3 ] = PPOS [ 3 ];
			
			DeleteHouseItems ( i ) ;
			CreateHouseItems ( i ) ;
			
			new text [ 128 ] ;
			echo ( text, "Дом %s (#%d) перенесен!", HOUSE [ i ] [ Name ], HOUSE [ i ] [ ID ] ) ;
			Send ( playerid, COLOR_BLUE, text ) ;
			
		}
		else Send ( playerid, COLOR_GRAY, "Не верный параметр!" ) ;
	}
	else
	{
		Send ( playerid, COLOR_GRAY, "-------------------------------------" ) ;
		Send ( playerid, COLOR_GRAY, "Используй: /перенести [параметр] [id]" ) ;
		Send ( playerid, COLOR_GRAY, "Параметры: сбизнес, бизнес, дом" ) ;
		Send ( playerid, COLOR_GRAY, "-------------------------------------" ) ;
	}
	
	return 1;
}


DCMD:kick ( playerid, params [ ] )
{
	new AL = PLAYER [ playerid ] [ ADMIN ];
	
	if ( AL < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new plid, reason [ 64 ], string [ 128 ], text [ 256 ] ;
	
	if ( sscanf ( params, "ds[128]", plid, reason ) ) return Send ( playerid, COLOR_GRAY, "Используй: /кик [ид] [причина]" ) ;
	
	if ( !IsPlayerConnected ( plid ) || !IsLogged ( plid ) ) return Send ( playerid, COLOR_GRAY, "Игрок не авторизован!" ) ;
	
	AdminLog ( playerid, reason, "кикнул", -1, plid ) ;
	
	echo ( string, "[%s] %s[%d] кикнул %s. Причина: %s", AdminRanks [ AL - 1 ], PlayerName [ playerid ], playerid, PlayerName [ plid ], reason ) ;
	SendToAll ( COLOR_ADM, string ) ;
	
	new _time [ 5 ];
	gettime ( _time [ 0 ] , _time [ 1 ] ) ;
	getdate ( _time [ 2 ] , _time [ 3 ] , _time [ 4 ]  ) ;
	
	echo ( string, "%d.%d.%d %02d:%02d Тебя кикнули!", _time [ 4 ], _time [ 3 ], _time [ 2 ], _time [ 0 ], _time [ 1 ] ) ;
	
	echo ( text, "Причина: %s\n\nЕсли не согласен, сделай скринншот {FF0000}ВМЕСТЕ С ЭТИМ ОКНОМ \n{9CB6D6}И пиши в раздел обращений к администрации, на сайте сервера.", reason ) ;
	
	ShowPlayerDialog ( plid, 0, DIALOG_STYLE_MSGBOX, string, text, "ОК", "" ) ;
	KickEx ( plid ) ;
	
	return 1;
}


DCMD:ao ( playerid, params [ ] )
{
	new AL = PLAYER [ playerid ] [ ADMIN ], string [ 128 ];
	
	if ( AL < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	if ( sscanf ( params, "s[128]", string ) ) return Send ( playerid, COLOR_GRAY, "Используй: /ао [текст]" ) ;
	
	echo ( string, "[%s] %s[%d]: %s", AdminRanks [ AL -1 ], PlayerName [ playerid ] , playerid, string ) ;
	SendToAll ( 0x64AA82FF, string ) ;
	
	return 1;
}


DCMD:pm ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new string [ 128 ], text [ 128 ], pid ;
	
	if ( sscanf ( params, "us[128]", pid, string ) ) return Send ( playerid, COLOR_GRAY, "Используй: /пм [ид/ник] [текст]" ) ;
		
	if ( !IsPlayerConnected ( pid ) || !IsLogged ( pid ) ) return Send ( playerid, COLOR_GRAY, "Игрок не авторизован!" ) ;
	
	echo ( text, "ПМ от %s[%d]: %s", PlayerName [ playerid ] , playerid, string ) ;
	Send ( pid, 0xBEA032FF, text ) ;
	
	echo ( text, "ПМ к %s[%d]: %s", PlayerName [ pid ] , pid, string ) ;
	Send ( playerid, 0xBEA032FF, text ) ;
	
	return 1;
}


DCMD:tp ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new list [ 128 ], to_list [ 26 ] ;
	
	for ( new i; i < sizeof ( AdminTeleport ) ; i++ )
	{
		echo ( to_list, "%s\n", AdminTeleport [ i ] [ Name ] ) ;
		strcat ( list, to_list ) ;
	}
	
	ShowDialog ( playerid, Show:AdminTeleport, DIALOG_STYLE_LIST, "Меню ТП", list, "Выбрать", "Отмена" ) ;
	return 1;
}

Dialog:AdminTeleport ( playerid, response, listitem, inputtext[] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	if ( !response ) return 1;
	
	MySetPlayerPos ( playerid, AdminTeleport [ listitem ] [ Position ] [ 0 ], AdminTeleport [ listitem ] [ Position ] [ 1 ], AdminTeleport [ listitem ] [ Position ] [ 2 ], AdminTeleport [ listitem ] [ Position ] [ 3 ], AdminTeleport [ listitem ] [ Interior ], AdminTeleport [ listitem ] [ World ] ) ;
	
	new string [ 22 + 24 ] ;
	echo ( string, "Ты телепортировался к %s",  AdminTeleport [ listitem ] [ Name ] ) ;
	Send ( playerid, COLOR_GRAY, string ) ;
	
	return 1;
}


DCMD:toplayer ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new pid;
	
	if ( sscanf ( params, "u", pid ) ) return Send ( playerid, COLOR_GRAY, "Используй: /кигроку [ид/ник]" ) ;
	if ( ! IsPlayerConnected ( pid ) || !IsLogged ( pid ) ) return Send ( playerid, COLOR_GRAY, "Игрок не авторизован!" ) ;
	
	new Float:_Position [ 4 ] ;
	
	GetPlayerPos ( pid, _Position [ 0 ], _Position [ 1 ], _Position [ 2 ] ) ;
	GetPlayerFacingAngle ( pid, _Position [ 3 ] ) ;
	GetXYBehindPoint ( pid,  _Position [ 0 ], _Position [ 1 ], 2.0 ) ;
	
	MySetPlayerPos ( playerid, _Position [ 0 ], _Position [ 1 ], _Position [ 2 ], -_Position [ 3 ], GetPlayerInterior ( pid ), GetPlayerVirtualWorld ( pid ) ) ;
	new string [ 128 ] ;
	echo ( string, "Ты телепортировался к игроку %s[%d]", PlayerName [ pid ] , pid ) ;
	Send ( playerid, COLOR_GRAY, string ) ;
	
	return 1;
}


DCMD:tohim ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new pid ;
	
	if ( sscanf ( params, "u", pid ) )  return Send ( playerid, COLOR_GRAY, "Используй: /ксебе [ид/ник]" ) ;
	if ( ! IsPlayerConnected ( pid ) || !IsLogged ( pid ) ) return Send ( playerid, COLOR_GRAY, "Игрок не авторизован!" ) ;
	
	new Float:_Position [ 4 ] ;
	
	GetPlayerPos ( playerid, _Position [ 0 ] , _Position [ 1 ] , _Position [ 2 ]  ) ;
	GetPlayerFacingAngle ( playerid, _Position [ 3 ] ) ;
	GetXYBehindPoint ( playerid,  _Position [ 0 ] , _Position [ 1 ] , 2.0 ) ;
	
	MySetPlayerPos ( pid, _Position [ 0 ], _Position [ 1 ], _Position [ 2 ], -_Position [ 3 ], GetPlayerInterior ( playerid ), GetPlayerVirtualWorld ( playerid ) ) ;
	
	new string [ 128 ] ;
	
	echo ( string, "Ты телепортировал игрока %s[%d]", PlayerName [ pid ], pid ) ;
	Send ( playerid, COLOR_GRAY, string ) ;
	
	echo ( string, "Тебя телепортировал администратор %s[%d]", PlayerName [ playerid ], playerid ) ;
	Send ( pid, COLOR_GRAY, string ) ;
	
	return 1;
}


DCMD:tpveh ( playerid, params [ ] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new pid ;
	
	if ( sscanf ( params, "d", pid ) ) return Send ( playerid, COLOR_GRAY, "Используй: /тпавто [ид авто]" ) ;
	if ( !VEHICLE [ pid ] [ ID ] ) return Send ( playerid, COLOR_GRAY, "Неверный ИД авто!" ) ;
	
	if ( GetPlayerInterior ( playerid ) > 0 || GetPlayerVirtualWorld ( playerid ) > 0 ) return Send ( playerid, COLOR_GRAY, "Нельзя ТПшить в интерьер!" ) ;
	
	new Float:_Position [ 3 ] ;
	
	GetPlayerPos ( playerid, _Position [ 0 ] , _Position [ 1 ] , _Position [ 2 ]  ) ;
	GetXYBehindPoint ( playerid,  _Position [ 0 ] , _Position [ 1 ] , 4.0 ) ;
	
	SetVehiclePos ( pid, _Position [ 0 ], _Position [ 1 ], _Position [ 2 ] ) ;
	
	new string [ 128 ] ;
	
	echo ( string, "Ты телепортировал авто %s ( ID: %d )", VehicleName [ VEHICLE [ pid ] [ MODEL ] - 400 ], pid ) ;
	Send ( playerid, COLOR_GRAY, string ) ;
	
	return 1;
}


DCMD:ban ( playerid, params [ ] )
{
	new AL = PLAYER [ playerid ] [ ADMIN ] ;
	
	if ( AL < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new amount, pid, reason [ 48 ] ;
	
	if ( sscanf ( params, "uds[48]", pid, amount, reason ) ) return Send ( playerid, COLOR_GRAY, "Используй: /бан [ид/ник] [кол-во дней] [причина]" ) ;
	
	if ( ! IsPlayerConnected ( pid ) || !IsLogged ( pid ) ) return Send ( playerid, COLOR_GRAY, "Игрок не авторизован!" ) ;
	
	if ( PLAYER [ pid ] [ ADMIN ] > AL ) return Send ( playerid, COLOR_GRAY, "Ты не можешь забанить этого игрока!" ) ;
	
	if ( 356 < amount < 1 ) return Send ( playerid, COLOR_GRAY, "Не меньше 0 и не больше 356 дней!" ) ;
	
	BanLog ( playerid, reason, amount, pid ) ;
	AdminLog ( playerid, reason, "забанил", amount, pid ) ;
	
	new string [ 128 ] ;
	
	echo ( string, "[%s] %s[%d] забанил %s. Срок: %d дней. Причина: %s", AdminRanks [ AL - 1 ], PlayerName [ playerid ], playerid, PlayerName [ pid ], amount, reason ) ;
	SendToAll ( COLOR_ADM, string ) ;
	
	new _time [ 5 ] ;
	gettime ( _time [ 0 ], _time [ 1 ] ) ;
	getdate ( _time [ 2 ], _time [ 3 ], _time [ 4 ] ) ;
	
	echo ( string, "%d.%d.%d %02d:%02d Тебя забанили!", _time [ 4 ], _time [ 3 ], _time [ 2 ], _time [ 0 ], _time [ 1 ] ) ;
	
	new text [ 256 ] ;
	echo ( text, "Причина: %s\n\nЕсли не согласен, сделай скринншот {FF0000}ВМЕСТЕ С ЭТИМ ОКНОМ \n{9CB6D6}И пиши в раздел обращений к администрации, на сайте сервера.", reason ) ;
	
	ShowPlayerDialog ( pid, 0, DIALOG_STYLE_MSGBOX, string, text, "OK", "" ) ;
	
	KickEx ( pid ) ;
	
	return 1;
}


DCMD:slap ( playerid, params [ ] )
{
	new AL = PLAYER [ playerid ] [ ADMIN ] ;
	if ( AL < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new pid, reason [ 48 ];
	
	if ( sscanf ( params, "us[48]", pid, reason ) ) return Send ( playerid, COLOR_GRAY, "Используй: /слап [ид/ник] [причина]" ) ;
	if ( ! IsPlayerConnected ( pid ) || !IsLogged ( pid ) ) return Send ( playerid, COLOR_GRAY, "Игрок не авторизован!" ) ;
	
	new string [ 128 ] ;
	
	echo ( string, "[%s] %s[%d] слапнул %s. Причина: %s", AdminRanks [ AL - 1 ], PlayerName [ playerid ], playerid, PlayerName [ pid ], reason ) ;
	SendToAll ( COLOR_ADM, string ) ;
	
	new Float:_Position [ 3 ] ;
	
	GetPlayerPos ( pid, _Position [ 0 ], _Position [ 1 ], _Position [ 2 ] ) ;
	SetPlayerPos ( pid, _Position [ 0 ], _Position [ 1 ], _Position [ 2 ] + 5.0 ) ;
	
	PlayerPlaySound ( pid, 1130, 0.0, 0.0, 0.0 ) ;
	
	return 1;
}


DCMD:aarest ( playerid, params [ ] )
{
	new AL = PLAYER [ playerid ] [ ADMIN ] ;
	if ( AL < 1 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	new pid, amount, reason [ 48 ];
	
	if ( sscanf ( params, "uds[128]", pid, amount, reason ) ) return Send ( playerid, COLOR_GRAY, "Используй: /аарест [ид/ник] [кол-во минут] [причина]" ) ;
	
	if ( ! IsPlayerConnected ( pid ) || !IsLogged ( pid ) ) return Send ( playerid, COLOR_GRAY, "Игрок не авторизован!" ) ;
	
	if ( amount > 900 ) return Send ( playerid, COLOR_GRAY, "Не больше 900!" ) ;
	
	AdminLog ( playerid, reason, "посадил", amount, pid ) ;
	
	new string [ 128 ] ;
	
	if ( PLAYER [ pid ] [ JAIL ] != 1 && PLAYER [ pid ] [ JAIL_TIME ] != -1 )
	{
		echo ( string, "[%s] %s[%d] пересадил %s. Срок: с %d на %d минут. Причина: %s", AdminRanks [ AL - 1 ], PlayerName [ playerid ], playerid, PlayerName [ pid ], PLAYER [ pid ] [ JAIL_TIME ] / 60, amount, reason ) ;
	}
	else
	{
		echo ( string, "[%s] %s[%d] посадил %s. Срок: %d минут. Причина: %s", AdminRanks [ AL - 1 ], PlayerName [ playerid ], playerid, PlayerName [ pid ], amount, reason ) ;
	}
	
	SendToAll ( COLOR_ADM, string ) ;
	
	if ( PLAYER [ pid ] [ HOSPITAL ] != -1 && PLAYER [ pid ] [ HOSPITAL_TIME ] != -1 )
	{
		FreeHospitalBed ( pid ) ;
		PLAYER [ pid ] [ HOSPITAL ] = -1;
		PLAYER [ pid ] [ HOSPITAL_TIME ] = -1;
	}
	
	PLAYER [ pid ] [ JAIL ] = 0;
	PLAYER [ pid ] [ JAIL_TIME ] = amount * 60 ;
	MySetPlayerPos ( pid, 1000.0 + random ( 10 ), 1000.0 + random ( 10 ), 1000.5, 0.0, 0, 0 ) ;
	PlayerTextDrawShow ( pid, JailTimeDraw [ pid ] ) ;
	
	return 1;
}
	
