
Dialog:AdminCreate ( playerid, response, listitem, inputtext[] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 8 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	if ( !response ) return 1;
	
	if ( GetPlayerInterior ( playerid ) != 0 || GetPlayerVirtualWorld ( playerid ) != 0 )
		return SendClientMessage ( playerid, COLOR_GRAY, "Нельзя создавать в помещении!" ) ;
	
	switch ( listitem )
	{
		case 0: 
		{
			new hid = ReturnFreeIndexHouse ( ) ;
			if ( hid == -1 ) return Send ( playerid, COLOR_GRAY, "Превышен лимит созданых домов!" ) ;
			
			SetPVarFloat ( playerid, "POS_X", PLAYER [ playerid ] [ POSITION ] [ 0 ] ) ;
			SetPVarFloat ( playerid, "POS_Y", PLAYER [ playerid ] [ POSITION ] [ 1 ] ) ;
			SetPVarFloat ( playerid, "POS_Z", PLAYER [ playerid ] [ POSITION ] [ 2 ] ) ;
			SetPVarFloat ( playerid, "POS_A", PLAYER [ playerid ] [ POSITION ] [ 3 ] ) ;
			SetPVarInt ( playerid, "ActiveInterior", 0 ) ;
			SetPVarInt ( playerid, "Chouse", 1 ) ;
			
			SendClientMessage ( playerid, COLOR_BLUE, "Переключение интерьера ~k~~VEHICLE_TURRETLEFT~ и ~k~~VEHICLE_TURRETRIGHT~." ) ;
			SendClientMessage ( playerid, COLOR_BLUE, "Выбор интерьера ENTER" ) ;
			
			new hint = GetPVarInt ( playerid, "ActiveInterior" ) ;
			MySetPlayerPos ( playerid, HouseInt [ hint ] [ Position ] [ 0 ] , HouseInt [ hint ] [ Position ] [ 1 ], HouseInt [ hint ] [ Position ] [ 2 ], HouseInt [ hint ] [ Position ] [ 3 ], HouseInt [ hint ] [ Int ], playerid ) ;
		}
		
	}
	
	return 1;
}

Dialog:HouseCreate ( playerid, response, listitem, inputtext[] )
{
	if ( PLAYER [ playerid ] [ ADMIN ] < 8 ) return Send ( playerid, COLOR_GRAY, "Недостаточно прав!" ) ;
	
	if ( !response )
	{
		DeletePVar ( playerid, "POS_X" ) ;
		DeletePVar ( playerid, "POS_Y" ) ;
		DeletePVar ( playerid, "POS_Z" ) ;
		DeletePVar ( playerid, "POS_A" ) ;
		DeletePVar ( playerid, "ActiveInterior" ) ;
		DeletePVar ( playerid, "Chouse" ) ;
	}
	else
	{
		new hid = ReturnFreeIndexHouse ( ) ;
		if ( hid == -1 ) return Send ( playerid, COLOR_GRAY, "Превышен лимит созданых домов!" ) ;
		
		new price = strval ( inputtext ) ;
		
		if ( price < 1 )
			return ShowDialog ( playerid, Show:HouseCreate, DIALOG_STYLE_INPUT, "Цена дома", "Введи цену дома.\n{FF0000}Не меньше 1 доллара", "Создать", "Отмена" ) ;
		
		CreateHouse ( playerid, price, hid, GetPVarInt ( playerid, "ActiveInterior" ) ) ;
		
		DeletePVar ( playerid, "POS_X" ) ;
		DeletePVar ( playerid, "POS_Y" ) ;
		DeletePVar ( playerid, "POS_Z" ) ;
		DeletePVar ( playerid, "POS_A" ) ;
		DeletePVar ( playerid, "ActiveInterior" ) ;
		DeletePVar ( playerid, "Chouse" ) ;
	}
	return 1;
}