Sign in to follow this  
Followers 0
DivineHoliness

Stop building near and in towns

17 posts in this topic

I would like to stop the creation of territories near or in cities and towns.

It should be pretty simple, by adding an additional call in the ExileServer_object_construction_network_buildTerritoryRequest checking player location vs nearest village, city or city capital. I'm just looking for the correct way I should go about doing this.

Share this post


Link to post
Share on other sites
Advertisement

ExileClient_object_item_construct.sqf

Spoiler

/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_itemClassName","_cantBuildNear"];
_itemClassName = _this select 0;
if( isClass(configFile >> "CfgMagazines" >> _itemClassName >> "Interactions" >> "Constructing") ) then
{
	if (findDisplay 602 != displayNull) then
	{
		(findDisplay 602) closeDisplay 2; 
	};
	try 
	{
		if !((vehicle player) isEqualTo player) then { throw "ConstructionVehicleWarning"; };
		if ((getPosATL player) call ExileClient_util_world_isTraderZoneNearby) then { throw "ConstructionTraderZoneWarning"; };
		if ((getPosATL player) call ExileClient_util_world_isSpawnZoneNearby) then { throw "ConstructionSpawnZoneWarning"; };

		//Stops Building In Towns
		_cnt = count nearestLocations [getPosATL player, ["NameVillage","NameCity","NameCityCapital"], 400];
		if (_cnt > 0 ) then { throw "ConstructionAbortedInformation"; };		
		
		/* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
		_cantBuildNear = [
			"Land_Dome_Big_F",
			"Land_Dome_Small_F",
			"Land_Barracks_ruins_F",
			"Land_i_Barracks_V1_F",
			"Land_i_Barracks_V1_dam_F",
			"Land_i_Barracks_V2_F",
			"Land_i_Barracks_V2_dam_F",
			"Land_u_Barracks_V2_F",
			"Land_Hospital_main_F",
			"Land_Hospital_side1_F",
			"Land_Hospital_side2_F",
			"Land_MilOffices_V1_F",
			"Land_TentHangar_V1_F",
			"Land_Hangar_F",
			"Land_Airport_Tower_F",
			"Land_Cargo_House_V1_F",
			"Land_Cargo_House_V3_F",
			"Land_Cargo_HQ_V1_F",
			"Land_Cargo_HQ_V2_F",
			"Land_Cargo_HQ_V3_F",
			"Land_Cargo_Patrol_V1_F",
			"Land_Cargo_Patrol_V2_F",
			"Land_Cargo_Tower_V1_F",
			"Land_Cargo_Tower_V1_No1_F",
			"Land_Cargo_Tower_V1_No2_F",
			"Land_Cargo_Tower_V1_No3_F",
			"Land_Cargo_Tower_V1_No4_F",
			"Land_Cargo_Tower_V1_No5_F",
			"Land_Cargo_Tower_V1_No6_F",
			"Land_Cargo_Tower_V1_No7_F",
			"Land_Cargo_Tower_V2_F",
			"Land_Cargo_Tower_V3_F",
			"Land_Radar_F"
		];
		_cantBuildDist = 100;
		if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0) then { throw "ConstructionAbortedInformation"; };
		
		/* PREVENT BUILDING NEAR KEY MILITARY AND INDUSTRIAL LOCATIONS */
//		if ((player distance [23802.7, 16133.9, 0]) < 1500) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [3073.84,13177.1,0]) < 250) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [12813.08, 16672.213, 0]) < 500) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [20941.604, 19236.865, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [6178.40, 16245.77, 0]) < 250) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [14347.18, 18940.27, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [18310.604, 15548.075, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [16083.555, 16992.264, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [17432.287, 13148.771, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [23581.842, 21099.982, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
		
		/* PREVENT BUILDING ON ROADS */
		if (isOnRoad getPosATL player) then { throw "ConstructionAbortedInformation"; }; 		

		if(_itemClassName isEqualTo "Exile_Item_Flag") then { throw "FLAG"; };
		[_itemClassName] call ExileClient_construction_beginNewObject;
	}
	catch 
	{
		if(_exception isEqualTo "FLAG")then
		{
			call ExileClient_gui_setupTerritoryDialog_show;
		}
		else
		{
			if(_exception isEqualTo "ConstructionAbortedInformation")then{
				[_exception,"Building Permit Denied"] call ExileClient_gui_notification_event_addNotification;
			}else{
				[_exception] call ExileClient_gui_notification_event_addNotification;
			};
		};	
	};
};
true
 

ExileClient_util_world_IsInTerritory.sqf

Spoiler

/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_position","_result","_maxRange","_flags","_distance","_radius"];
_position = _this;
_result = false;
_maxRange = getArray(missionConfigFile >> "CfgTerritories" >> "prices");
_maxRange = (_maxRange select ((count _maxRange) - 1)) select 1;
_maxRange = 15;
_flags = _position nearObjects ["Exile_Construction_Flag_Static", _maxRange * 2];
if !(_flags isEqualTo []) then
{
	{
		_distance = (getPosATL _x) distance2D _position;
		_radius = _x getVariable ["ExileTerritorySize", 0];
		if (_distance <= _radius) exitWith 
		{
			_result = true;
		};
	}	
	forEach _flags;
};
_result

config.cpp

Spoiler

class CfgExileCustomCode
{
 ExileClient_object_item_construct = "fixes\ExileClient_object_item_construct.sqf";
 ExileClient_util_world_isTerritoryNearby = "fixes\ExileClient_util_world_IsInTerritory.sqf";
};

Works fine

Edited by Scorpi
2 people like this

Share this post


Link to post
Share on other sites
4 hours ago, Scorpi said:

ExileClient_object_item_construct.sqf

  Reveal hidden contents


/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_itemClassName","_cantBuildNear"];
_itemClassName = _this select 0;
if( isClass(configFile >> "CfgMagazines" >> _itemClassName >> "Interactions" >> "Constructing") ) then
{
	if (findDisplay 602 != displayNull) then
	{
		(findDisplay 602) closeDisplay 2; 
	};
	try 
	{
		if !((vehicle player) isEqualTo player) then { throw "ConstructionVehicleWarning"; };
		if ((getPosATL player) call ExileClient_util_world_isTraderZoneNearby) then { throw "ConstructionTraderZoneWarning"; };
		if ((getPosATL player) call ExileClient_util_world_isSpawnZoneNearby) then { throw "ConstructionSpawnZoneWarning"; };

		//Stops Building In Towns
		_cnt = count nearestLocations [getPosATL player, ["NameVillage","NameCity","NameCityCapital"], 400];
		if (_cnt > 0 ) then { throw "ConstructionAbortedInformation"; };		
		
		/* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
		_cantBuildNear = [
			"Land_Dome_Big_F",
			"Land_Dome_Small_F",
			"Land_Barracks_ruins_F",
			"Land_i_Barracks_V1_F",
			"Land_i_Barracks_V1_dam_F",
			"Land_i_Barracks_V2_F",
			"Land_i_Barracks_V2_dam_F",
			"Land_u_Barracks_V2_F",
			"Land_Hospital_main_F",
			"Land_Hospital_side1_F",
			"Land_Hospital_side2_F",
			"Land_MilOffices_V1_F",
			"Land_TentHangar_V1_F",
			"Land_Hangar_F",
			"Land_Airport_Tower_F",
			"Land_Cargo_House_V1_F",
			"Land_Cargo_House_V3_F",
			"Land_Cargo_HQ_V1_F",
			"Land_Cargo_HQ_V2_F",
			"Land_Cargo_HQ_V3_F",
			"Land_Cargo_Patrol_V1_F",
			"Land_Cargo_Patrol_V2_F",
			"Land_Cargo_Tower_V1_F",
			"Land_Cargo_Tower_V1_No1_F",
			"Land_Cargo_Tower_V1_No2_F",
			"Land_Cargo_Tower_V1_No3_F",
			"Land_Cargo_Tower_V1_No4_F",
			"Land_Cargo_Tower_V1_No5_F",
			"Land_Cargo_Tower_V1_No6_F",
			"Land_Cargo_Tower_V1_No7_F",
			"Land_Cargo_Tower_V2_F",
			"Land_Cargo_Tower_V3_F",
			"Land_Radar_F"
		];
		_cantBuildDist = 100;
		if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0) then { throw "ConstructionAbortedInformation"; };
		
		/* PREVENT BUILDING NEAR KEY MILITARY AND INDUSTRIAL LOCATIONS */
//		if ((player distance [23802.7, 16133.9, 0]) < 1500) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [3073.84,13177.1,0]) < 250) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [12813.08, 16672.213, 0]) < 500) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [20941.604, 19236.865, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [6178.40, 16245.77, 0]) < 250) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [14347.18, 18940.27, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [18310.604, 15548.075, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [16083.555, 16992.264, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [17432.287, 13148.771, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
		if ((player distance [23581.842, 21099.982, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
		
		/* PREVENT BUILDING ON ROADS */
		if (isOnRoad getPosATL player) then { throw "ConstructionAbortedInformation"; }; 		

		if(_itemClassName isEqualTo "Exile_Item_Flag") then { throw "FLAG"; };
		[_itemClassName] call ExileClient_construction_beginNewObject;
	}
	catch 
	{
		if(_exception isEqualTo "FLAG")then
		{
			call ExileClient_gui_setupTerritoryDialog_show;
		}
		else
		{
			if(_exception isEqualTo "ConstructionAbortedInformation")then{
				[_exception,"Building Permit Denied"] call ExileClient_gui_notification_event_addNotification;
			}else{
				[_exception] call ExileClient_gui_notification_event_addNotification;
			};
		};	
	};
};
true


 

ExileClient_util_world_IsInTerritory.sqf

  Reveal hidden contents


/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_position","_result","_maxRange","_flags","_distance","_radius"];
_position = _this;
_result = false;
_maxRange = getArray(missionConfigFile >> "CfgTerritories" >> "prices");
_maxRange = (_maxRange select ((count _maxRange) - 1)) select 1;
_maxRange = 15;
_flags = _position nearObjects ["Exile_Construction_Flag_Static", _maxRange * 2];
if !(_flags isEqualTo []) then
{
	{
		_distance = (getPosATL _x) distance2D _position;
		_radius = _x getVariable ["ExileTerritorySize", 0];
		if (_distance <= _radius) exitWith 
		{
			_result = true;
		};
	}	
	forEach _flags;
};
_result

config.cpp

  Reveal hidden contents

class CfgExileCustomCode
{
 ExileClient_object_item_construct = "fixes\ExileClient_object_item_construct.sqf";
 ExileClient_util_world_isTerritoryNearby = "fixes\ExileClient_util_world_IsInTerritory.sqf";
};

Works fine

This doesn't take into account the new variables introduced in 0.9.4

1 person likes this

Share this post


Link to post
Share on other sites
3 hours ago, CEN said:

This doesn't take into account the new variables introduced in 0.9.4

any idea who to fix that plz :)

 

Share this post


Link to post
Share on other sites
		/* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
		_cantBuildNear = [
			"Land_Amphitheater_F",
			"Land_Castle_01_wall_02_F",
			"Land_Castle_01_wall_03_F",
			"Land_Castle_01_wall_04_F",
			"Land_Castle_01_wall_05_F",
			"Land_Castle_01_wall_06_F",
			"Land_Castle_01_wall_07_F",
			"Land_Castle_01_wall_08_F",
			"Land_Castle_01_wall_09_F",
			"Land_Castle_01_wall_10_F",
			"Land_Castle_01_wall_11_F",
			"Land_Castle_01_wall_12_F",
			"Land_Castle_01_wall_13_F",
			"Land_Castle_01_wall_14_F",
			"Land_Castle_01_wall_15_F",
			"Land_Castle_01_wall_16_F",
			"Land_Castle_01_house_ruin_F",
			"Land_Castle_01_church_a_ruin_F",
			"Land_Castle_01_church_b_ruin_F",
			"Land_Castle_01_church_ruin_F",
			"Land_Castle_01_tower_F",
			"Land_Castle_01_tower_ruins_F",
			"Land_Church_01_V1_F",
			"Land_Hospital_side1_F",
			"Land_Hospital_side2_F",
			"Land_LightHouse_ruins_F",
			"Land_Lighthouse_small_F",
			"Land_WIP_F",
			"Land_u_Addon_01_V1_F",
			"Land_Addon_01_V1_ruins_F",
			"Land_u_Addon_01_V1_dam_F",
			"Land_d_Addon_02_V1_F",
			"Land_Addon_02_V1_ruins_F",
			"Land_u_Addon_02_V1_F",
			"Land_i_Addon_02_V1_F",
			"Land_i_Addon_03_V1_F",
			"Land_i_Addon_03mid_V1_F",
			"Land_i_Garage_V1_F",
			"Land_Garage_V1_ruins_F",
			"Land_i_Garage_V2_F",
			"Land_i_Garage_V2_dam_F",
			"Land_Metal_Shed_ruins_F",
			"Land_Metal_Shed_F",
			"Land_House_Big_01_V1_ruins_F",
			"Land_i_House_Big_01_V1_F",
			"Land_i_House_Big_01_V1_dam_F",
			"Land_i_House_Big_01_V2_F",
			"Land_i_House_Big_01_V2_dam_F",
			"Land_i_House_Big_01_V3_F",
			"Land_i_House_Big_01_V3_dam_F",
			"Land_u_House_Big_01_V1_F",
			"Land_u_House_Big_01_V1_dam_F",
			"Land_d_House_Big_01_V1_F",
			"Land_House_Big_02_V1_ruins_F",
			"Land_i_House_Big_02_V1_F",
			"Land_i_House_Big_02_V1_dam_F",
			"Land_i_House_Big_02_V2_F",
			"Land_i_House_Big_02_V2_dam_F",
			"Land_i_House_Big_02_V3_F",
			"Land_i_House_Big_02_V3_dam_F",
			"Land_u_House_Big_02_V1_F",
			"Land_u_House_Big_02_V1_dam_F",
			"Land_d_House_Big_02_V1_F",
			"Land_i_Shop_01_V2_F",
			"Land_i_Shop_01_V1_dam_F",
			"Land_i_Shop_01_V3_F",
			"Land_i_Shop_01_V3_dam_F",
			"Land_u_Shop_01_V1_F",
			"Land_u_Shop_01_V1_dam_F",
			"Land_d_Shop_01_V1_F",
			"Land_i_Shop_02_V1_F",
			"Land_i_Shop_02_V1_dam_F",
			"Land_i_Shop_02_V2_F",
			"Land_i_Shop_02_V2_dam_F",
			"Land_i_Shop_02_V3_F",
			"Land_i_Shop_02_V3_dam_F",
			"Land_u_Shop_02_V1_F",
			"Land_u_Shop_02_V1_dam_F",
			"Land_d_Shop_02_V1_F",
			"Land_House_Small_01_V1_ruins_F",
			"Land_i_House_Small_01_V1_F",
			"Land_i_House_Small_01_V1_dam_F",
			"Land_i_House_Small_01_V2_F",
			"Land_i_House_Small_01_V2_dam_F",
			"Land_i_House_Small_01_V3_F",
			"Land_i_House_Small_01_V3_dam_F",
			"Land_u_House_Small_01_V1_F",
			"Land_u_House_Small_01_V1_dam_F",
			"Land_d_House_Small_01_V1_F",
			"Land_House_Small_02_V1_ruins_F",
			"Land_i_House_Small_02_V1_F",
			"Land_i_House_Small_02_V1_dam_F",
			"Land_i_House_Small_02_V2_F",
			"Land_i_House_Small_02_V2_dam_F",
			"Land_i_House_Small_02_V3_F",
			"Land_i_House_Small_02_V3_dam_F",
			"Land_u_House_Small_02_V1_F",
			"Land_u_House_Small_02_V1_dam_F",
			"Land_d_House_Small_02_V1_F",
			"Land_House_Small_03_V1_ruins_F",
			"Land_i_House_Small_03_V1_F",
			"Land_i_House_Small_03_V1_dam_F",
			"Land_cargo_house_slum_F",
//			"Land_Slum_House01_F",
//			"Land_Slum_House02_F",
//			"Land_Slum_House03_ruins_F",
			"Land_i_Stone_HouseBig_V1_F",
			"Land_i_Stone_HouseBig_V1_dam_F",
			"Land_i_Stone_HouseBig_V2_F",
			"Land_i_Stone_HouseBig_V2_dam_F",
			"Land_d_Stone_HouseBig_V1_F",
			"Land_i_Stone_HouseBig_V3_dam_F",
			"Land_Stone_Shed_V1_ruins_F",
			"Land_i_Stone_Shed_V1_F",
			"Land_i_Stone_Shed_V1_dam_F",
			"Land_d_Stone_Shed_V1_F",
			"Land_i_Stone_HouseSmall_V1_F",
			"Land_i_Stone_HouseSmall_V1_dam_F",
			"Land_i_Stone_HouseSmall_V2_F",
			"Land_i_Stone_HouseSmall_V2_dam_F",
			"Land_i_Stone_HouseSmall_V3_F",
			"Land_i_Stone_HouseSmall_V3_dam_F",
			"Land_d_Stone_HouseSmall_V1_F",
			"Land_Unfinished_Building_01_ruins_F",
			"Land_Unfinished_Building_01_F",
			"Land_Unfinished_Building_02_ruins_F",
			"Land_Unfinished_Building_02_F",
			"Land_Airport_right_F",
			"Land_Airport_Tower_F",
			"Land_Hangar_F",
			"Land_cmp_Shed_F",
			"Land_cmp_Shed_dam_F",
			"Land_cmp_Tower_ruins_F",
			"Land_cmp_Tower_F",
			"Land_dp_bigTank_F",
			"Land_dp_mainFactory_F",
			"Land_dp_smallFactory_F",
			"Land_dp_smallTank_F",
			"Land_Factory_Main_F",
			"Land_FuelStation_Build_F",
			"Land_FuelStation_Shed_F",
			"Land_fs_roof_F",
			"Land_ReservoirTank_Airport_F",
			"Land_ReservoirTank_Rust_F",
			"Land_ReservoirTank_V1_ruins_F",
			"Land_ReservoirTank_V1_F",
			"Land_ReservoirTower_F",
			"Land_Shed_Small_F",
			"Land_i_Shed_Ind_F",
			"Land_u_Shed_Ind_F",
			"Land_spp_Tower_F",
			"Land_spp_Tower_dam_F",
			"Land_spp_Transformer_F",
			"Land_d_Windmill01_F",
			"Land_Dome_Big_F",
			"Land_Dome_Small_F",
			"Land_Research_house_V1_F",
			"Land_Mil_WallBig_4m_F",
			"Land_Kiosk_gyros_F",
			"Land_Kiosk_blueking_F",
			"Land_Kiosk_redburger_F",
			"Land_GH_Gazebo_F",
			"Land_GH_House_1_F",
			"Land_GH_House_ruins_F",
			"Land_GH_MainBuilding_entry_F",
			"Land_GH_MainBuilding_left_F",
			"Land_GH_MainBuilding_right_F",
			"Land_Stadium_p4_F",
			"Land_Stadium_p5_F",
			"Land_Stadium_p6_F",
			"Land_Stadium_p7_F",
			"Land_Stadium_p8_F",
			"Land_Stadium_p9_F",
			//---------N4P------------
			"Land_Dome_Big_F",
			"Land_Dome_Small_F",
			"Land_Barracks_ruins_F",
			"Land_i_Barracks_V1_F",
			"Land_i_Barracks_V1_dam_F",
			"Land_i_Barracks_V2_F",
			"Land_i_Barracks_V2_dam_F",
			"Land_u_Barracks_V2_F",
			"Land_Hospital_main_F",
			"Land_Hospital_side1_F",
			"Land_Hospital_side2_F",
			"Land_MilOffices_V1_F",
			"Land_TentHangar_V1_F",
			"Land_Hangar_F",
			"Land_Airport_Tower_F",
			"Land_Cargo_House_V1_F",
			"Land_Cargo_House_V3_F",
			"Land_Cargo_HQ_V1_F",
			"Land_Cargo_HQ_V2_F",
			"Land_Cargo_HQ_V3_F",
			"Land_Cargo_Patrol_V1_F",
			"Land_Cargo_Patrol_V2_F",
			"Land_Cargo_Tower_V1_F",
			"Land_Cargo_Tower_V1_No1_F",
			"Land_Cargo_Tower_V1_No2_F",
			"Land_Cargo_Tower_V1_No3_F",
			"Land_Cargo_Tower_V1_No4_F",
			"Land_Cargo_Tower_V1_No5_F",
			"Land_Cargo_Tower_V1_No6_F",
			"Land_Cargo_Tower_V1_No7_F",
			"Land_Cargo_Tower_V2_F",
			"Land_Cargo_Tower_V3_F",
			"Land_Radar_F"
			
		];

 

Share this post


Link to post
Share on other sites

I have no Problem!

1.png

ExileClient_object_item_construct.sqf

Spoiler
/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_itemClassName","_cantBuildNear"];
_itemClassName = _this select 0;
if( isClass(configFile >> "CfgMagazines" >> _itemClassName >> "Interactions" >> "Constructing") ) then
{
 if (findDisplay 602 != displayNull) then
 {
  (findDisplay 602) closeDisplay 2;
 };
 try
 {
  if !((vehicle player) isEqualTo player) then { throw "ConstructionVehicleWarning"; };
  //Stops Building In Towns
  _cnt = count nearestLocations [getPosATL player, ["NameCity","NameCityCapital"], 250];
  if (_cnt > 0 ) then { throw "ConstructionAbortedInformation"; };
  
  /* PREVENT BUILDING NEAR CERTAIN TYPES OF BUILDING */
  _cantBuildNear = [
   "Land_Ss_hangar",
   "Land_Mil_ControlTower",
   "Land_Mil_Barracks_i",
   "Land_Army_hut2_int",
   "Land_Army_hut_int",
   "Land_Army_hut3_long_int",
   "Land_Budova4_in",
   "Land_Fort_Watchtower",
   "Land_fortified_nest_big",
   "Land_Army_hut_storrage",
   "Land_House_K_7_EP1",
   "Land_Church_03",
   "Land_House_C_5_EP1",
   "Land_Posed",
   "Land_ibr_FuelStation_Build",
   "Land_Kulna",
   "Land_Garaz_mala",
   "Land_House_C_12_EP1",
   "Land_Ind_Garage01",
   "Land_A_Office01_EP1",
   "Land_A_Office01",
   "Land_Shed_wooden",
   "Land_Afbarabizna",
   "Land_Dum_olez_istan1",
   "Land_Hut02",
   "Land_Hut01",
   "Land_Sara_Domek_sedy",
   "Land_Sara_domek_zluty",
   "Land_a_stationhouse",
   "Land_A_Stationhouse_ep1",
   "Land_Majak2",
   "Land_House_L_3_EP1",
   "Land_House_L_4_EP1",
   "Land_House_L_1_EP1",
   "Land_House_C_1_v2_EP1",
   "Land_House_C_9_EP1",
   "Land_House_C_10_EP1",
   "Land_House_K_6_EP1",
   "Land_House_C_5_V2_EP1",
   "Land_House_C_11_EP1",
   "Land_ibrPanelak2",
   "Land_ibrPanelak",
   "Land_ibrPanelak3",
   "Land_Dum_istan3_hromada2",
   "Land_House_C_3_EP1",
   "Land_House_K_8_EP1",
   "Land_A_Villa_EP1",
   "Land_HouseV2_02_Interier",
   "Land_House_K_3_EP1",
   "Land_House_C_5_V3_EP1",
   "Land_House_K_1_EP1",
   "Land_House_L_8_EP1",
   "Land_House_L_6_EP1",
   "Land_Dum_mesto_in",
   "Land_House_C_2_EP1",
   "Land_A_GeneralStore_01a",
   "Land_HouseB_Tenement",
   "Land_Hangar_2",
   "Land_Hlidac_budka",
   "Land_Ind_Pec_03b",
   "Land_Ind_Workshop01_02",
   "Land_Ind_Workshop01_01",
   "Land_Ind_Workshop01_04",
   "Land_A_BuildingWIP",
   "Land_Barn_Metal",
   "Land_Shed_Ind02",
   "Land_Misc_Cargo1Bo",
   "Land_Nav_Boathouse",
   "Land_Stodola_old_open",
   "Land_Farm_Cowshed_c",
   "Land_Farm_Cowshed_b",
   "Land_Farm_Cowshed_a",
   "Land_Tovarna1",
   "Land_Ind_Oil_Tower_EP1",
   "Land_Ind_TankBig",
   "Land_Ind_Vysypka",
   "Land_House_C_4_EP1",
   "Land_Dum_istan3_pumpa",
   "Land_ibrhotel",
   "Land_Tovarna2"
  ];
  _cantBuildDist = 100;
  if ({typeOf _x in _cantBuildNear} count nearestObjects[player, _cantBuildNear, _cantBuildDist] > 0) then { throw "ConstructionAbortedInformation"; };
  
  /* PREVENT BUILDING NEAR KEY MILITARY AND INDUSTRIAL LOCATIONS */
//  if ((player distance [23802.7, 16133.9, 0]) < 1500) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [3073.84,13177.1,0]) < 250) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [12813.08, 16672.213, 0]) < 500) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [20941.604, 19236.865, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [6178.40, 16245.77, 0]) < 250) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [14347.18, 18940.27, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [18310.604, 15548.075, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [16083.555, 16992.264, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [17432.287, 13148.771, 0]) < 150) then { throw "ConstructionAbortedInformation"; };
  if ((player distance [23581.842, 21099.982, 0]) < 200) then { throw "ConstructionAbortedInformation"; };
  
  /* PREVENT BUILDING ON ROADS */
  if (isOnRoad getPosATL player) then { throw "ConstructionAbortedInformation"; };   
 
  if(_itemClassName isEqualTo "Exile_Item_Flag") then { throw "FLAG"; };
  [_itemClassName] call ExileClient_construction_beginNewObject;
 }
 catch
 {
  if(_exception isEqualTo "FLAG")then
  {
   call ExileClient_gui_setupTerritoryDialog_show;
  }
  else
  {
   if(_exception isEqualTo "ConstructionAbortedInformation")then{
    [_exception,"Building Permit Denied"] call ExileClient_gui_notification_event_addNotification;
   }else{
    [_exception] call ExileClient_gui_notification_event_addNotification;
   };
  }; 
 };
};
true

 

Edited by Scorpi

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.