Advertisement
MGT

buildingreplacement.sqf

MGT
Jan 16th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 8.77 KB | None | 0 0
  1. //place this file in mission root, then in init.sqf add #include "buildingReplacement.sqf";
  2. /*
  3. buildingreplacement.sqf
  4. */
  5. FFA_CLOSEHOUSE = ["Land_A_GeneralStore_01a","Land_HouseV_2L","Land_HouseV_3I3","Land_HouseV_3I1","Land_HouseV_3I4","Land_HouseV_3I2","Land_HouseV_1L1","Land_houseV_2T1","Land_houseV_2T2","Land_HouseV_1T","Land_HouseV2_03B","Land_HouseV2_03","Land_HouseV2_01A","Land_HouseV2_01B","Land_HouseV2_02_Interier","Land_HouseV2_04_interier","Land_HouseV2_05","Land_Church_02","Land_Church_02a","Land_Church_01","Land_Ind_SawMill","Land_HouseV_1I2","Land_HouseV_1I1","Land_SignB_Pub_CZ3","Land_Shed_W4","Land_HouseV_1I3","Land_HouseV_1L2","Land_Misc_WaterStation","Land_Farm_WTower","Land_HouseV_2I","Land_Mil_Barracks_L","Land_Mil_Barracks","Land_Mil_House","Land_A_Office02","Land_Tec","Land_Shed_W02","Land_Shed_W03","Land_SignB_Pub_RU3","Land_Sign_Bar_RU","Land_SignB_PostOffice","Land_Mil_Guardhouse","Land_Komin","Land_SignB_Gov","Land_SignB_GovSign","Land_SignB_Pub_RU1"];
  6. _godModeBuildings = false;
  7. if (isServer) then
  8. {
  9.     _dmdDeleteThis=[["Land_SignB_Pub_CZ3[]","Land_SignB_Pub_RU3[]","Land_Sign_Bar_RU[]","Land_SignB_PostOffice[]","Land_Tec[]","Land_SignB_Gov[]","Land_SignB_GovSign[]","Land_SignB_Pub_RU1[]"],[""]];
  10.     _dmdRep0001=[["Land_HouseV_1I2"],["Land_i_Stone_Shed_V3_F"]];
  11.     _dmdRep0002=[["Land_Ind_SawMill"],["Land_ReservoirTank_V1_F"]];
  12.     _dmdRep0003=[["Land_HouseV_1I1"],["Land_i_House_Small_02_V1_F"]];
  13.     _dmdRep0005=[["Land_Shed_W4"],["Land_Slum_House03_F"]];
  14.     _dmdRep0006=[["Land_HouseV_1I3"],["Land_i_House_Small_03_V1_dam_f"]];
  15.     _dmdRep0006=[["Land_HouseV_1I3"],["Land_i_House_Small_03_V1_F"]];
  16.     _dmdRep0007=[["Land_HouseV_1L2"],["Land_i_House_Big_02_V1_F"]];
  17.     _dmdRep0008=[["Land_Misc_WaterStation"],["Land_ReservoirTank_V1_F"]];
  18.     _dmdRep0009=[["Land_Farm_WTower"],["Land_R_Minaret"]];
  19.     _dmdRep0010=[["Land_HouseV_2I"],["Land_i_House_Big_01_V3_F"]];
  20.     _dmdRep0011=[["Land_Mil_Barracks_L"],["Land_Cargo_HQ_V1_F"]];
  21.     _dmdRep0012=[["Land_Mil_Barracks"],["Land_Unfinished_building_01_F"]];
  22.     _dmdRep0013=[["Land_Mil_House"],["Land_MilOffices_V1_F"]];
  23.     _dmdRep0014=[["Land_A_Office02"],["Land_Offices_01_V1_F"]];
  24.     _dmdRep0016=[["Land_Shed_W02"],["Land_Slum_House01_F"]];
  25.     _dmdRep0017=[["Land_Shed_W03"],["Land_cargo_house_slum_F"]];
  26.     _dmdRep0018=[["Land_HouseV_3I3"],["Land_i_Shop_01_V1_F"]];
  27.     _dmdRep0019=[["Land_HouseV_3I1"],["Land_i_Shop_01_V2_F"]];
  28.     _dmdRep0020=[["Land_HouseV_3I4"],["Land_i_Shop_02_V1_F"]];
  29.     _dmdRep0021=[["Land_HouseV_3I2"],["Land_i_Shop_02_V3_F"]];
  30.     _dmdRep0022=[["Land_HouseV_1L1"],["Land_i_Stone_HouseBig_V2_F"]];  
  31.     _dmdRep0023=[["Land_houseV_2T1"],["Land_i_Stone_HouseBig_V3_F"]];
  32.     _dmdRep0024=[["Land_houseV_2T2"],["Land_i_Stone_HouseSmall_V1_F"]];
  33.     _dmdRep0025=[["Land_HouseV_1T"],["Land_i_Stone_HouseSmall_V1_F"]]; 
  34.     _dmdRep0026=[["Land_HouseV_2L"],["Land_i_Stone_Shed_V1_dam_F"]];   
  35.     _dmdRep0027=[["Land_HouseV2_03B"],["Land_i_Stone_HouseSmall_V3_F"]];
  36.     _dmdRep0028=[["Land_HouseV2_01A"],["Land_d_House_Big_02_V1_F"]];
  37.     _dmdRep0029=[["Land_HouseV2_01B"],["Land_i_House_Small_01_V3_F"]]; 
  38.     _dmdRep0030=[["Land_HouseV2_03"],["Land_i_House_Big_01_V3_F"]];
  39.     _dmdRep0031=[["Land_HouseV2_02_Interier"],["Land_i_House_Big_02_V2_dam_F"]];
  40.     _dmdRep0032=[["Land_HouseV2_04_interier"],["Land_i_Shop_01_V3_dam_F"]];
  41.     _dmdRep0033=[["Land_HouseV2_05"],["Land_u_Shop_01_V1_F"]]; 
  42.     _dmdRep0034=[["Land_Church_02","Land_Church_02a","Land_Church_01"],["Land_Chapel_V1_F"]];
  43.     _dmdRep0035=[["Land_Mil_Guardhouse"],["Land_Cargo_Tower_V1_No5_F"]];
  44.     _dmdRep0036=[["Land_Komin"],["Land_ReservoirTower_F"]];
  45.     _dmdRep0037=[["Land_A_GeneralStore_01a"],["Land_A_GeneralStore_01"]];  
  46.     _FFA_LHOUSEV=[];
  47.     _FFA_HOUSES=[];
  48.     if (worldName == "chernarus") then  {
  49.         _FFA_LHOUSEV=nearestObjects [getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"),["house"],15000];
  50.         for "_i" from 0 to (count _FFA_LHOUSEV)-1 do
  51.         {
  52.             _housev=_FFA_LHOUSEV select _i;
  53.             if ((typeof _housev) in FFA_CLOSEHOUSE) then
  54.             {
  55.                 _FFA_HOUSES set [count _FFA_HOUSES,_housev];
  56.             };
  57.         };     
  58.         for "_i" from 0 to (count _FFA_HOUSES)-1 do
  59.         {
  60.             _nBuilding =_FFA_HOUSES select _i;
  61.             _dirVector = vectorDir _nBuilding;
  62.             _objVector = vectorUp _nBuilding;
  63.             _pos = ASLtoATL getPosASL _nBuilding;
  64.             _nBuilding hideObject true;
  65.             deleteVehicle _nBuilding;          
  66.             _type="";
  67.             call{
  68.                 if ((typeof _nBuilding) in (_dmdDeleteThis select 0)) exitwith {_type="";};
  69.                
  70.                 if ((typeof _nBuilding) in (_dmdRep0001 select 0)) exitwith {_type=(_dmdRep0001 select 1) select 0;};
  71.                 if ((typeof _nBuilding) in (_dmdRep0002 select 0)) exitwith {_type=(_dmdRep0002 select 1) select 0;};
  72.                 if ((typeof _nBuilding) in (_dmdRep0003 select 0)) exitwith {_type=(_dmdRep0003 select 1) select 0;};
  73.                 if ((typeof _nBuilding) in (_dmdRep0005 select 0)) exitwith {_type=(_dmdRep0005 select 1) select 0;};
  74.                 if ((typeof _nBuilding) in (_dmdRep0006 select 0)) exitwith {_type=(_dmdRep0006 select 1) select 0;};
  75.                 if ((typeof _nBuilding) in (_dmdRep0007 select 0)) exitwith {_type=(_dmdRep0007 select 1) select 0;};
  76.                 if ((typeof _nBuilding) in (_dmdRep0008 select 0)) exitwith {_type=(_dmdRep0008 select 1) select 0;};
  77.                 if ((typeof _nBuilding) in (_dmdRep0009 select 0)) exitwith {_type=(_dmdRep0009 select 1) select 0;};
  78.                 if ((typeof _nBuilding) in (_dmdRep0010 select 0)) exitwith {_type=(_dmdRep0010 select 1) select 0;};
  79.                 if ((typeof _nBuilding) in (_dmdRep0011 select 0)) exitwith {_type=(_dmdRep0011 select 1) select 0;};
  80.                 if ((typeof _nBuilding) in (_dmdRep0012 select 0)) exitwith {_type=(_dmdRep0012 select 1) select 0;};
  81.                 if ((typeof _nBuilding) in (_dmdRep0013 select 0)) exitwith {_type=(_dmdRep0013 select 1) select 0;};
  82.                 if ((typeof _nBuilding) in (_dmdRep0014 select 0)) exitwith {_type=(_dmdRep0014 select 1) select 0;};
  83.                 if ((typeof _nBuilding) in (_dmdRep0016 select 0)) exitwith {_type=(_dmdRep0016 select 1) select 0;};
  84.                 if ((typeof _nBuilding) in (_dmdRep0017 select 0)) exitwith {_type=(_dmdRep0017 select 1) select 0;};
  85.                 if ((typeof _nBuilding) in (_dmdRep0018 select 0)) exitwith {_type=(_dmdRep0018 select 1) select 0;};
  86.                 if ((typeof _nBuilding) in (_dmdRep0019 select 0)) exitwith {_type=(_dmdRep0019 select 1) select 0;};
  87.                 if ((typeof _nBuilding) in (_dmdRep0020 select 0)) exitwith {_type=(_dmdRep0020 select 1) select 0;};
  88.                 if ((typeof _nBuilding) in (_dmdRep0021 select 0)) exitwith {_type=(_dmdRep0021 select 1) select 0;};
  89.                 if ((typeof _nBuilding) in (_dmdRep0022 select 0)) exitwith {_type=(_dmdRep0022 select 1) select 0;};              
  90.                 if ((typeof _nBuilding) in (_dmdRep0023 select 0)) exitwith {_type=(_dmdRep0023 select 1) select 0;};
  91.                 if ((typeof _nBuilding) in (_dmdRep0024 select 0)) exitwith {_type=(_dmdRep0024 select 1) select 0;};              
  92.                 if ((typeof _nBuilding) in (_dmdRep0025 select 0)) exitwith {_type=(_dmdRep0025 select 1) select 0;};              
  93.                 if ((typeof _nBuilding) in (_dmdRep0026 select 0)) exitwith {_type=(_dmdRep0026 select 1) select 0;};              
  94.                 if ((typeof _nBuilding) in (_dmdRep0027 select 0)) exitwith {_type=(_dmdRep0027 select 1) select 0;};
  95.                 if ((typeof _nBuilding) in (_dmdRep0028 select 0)) exitwith {_type=(_dmdRep0028 select 1) select 0;};
  96.                 if ((typeof _nBuilding) in (_dmdRep0029 select 0)) exitwith {_type=(_dmdRep0029 select 1) select 0;};
  97.                 if ((typeof _nBuilding) in (_dmdRep0030 select 0)) exitwith {_type=(_dmdRep0030 select 1) select 0;};
  98.                 if ((typeof _nBuilding) in (_dmdRep0031 select 0)) exitwith {_type=(_dmdRep0031 select 1) select 0;};
  99.                 if ((typeof _nBuilding) in (_dmdRep0032 select 0)) exitwith {_type=(_dmdRep0032 select 1) select 0;};
  100.                 if ((typeof _nBuilding) in (_dmdRep0033 select 0)) exitwith {_type=(_dmdRep0033 select 1) select 0;};              
  101.                 if ((typeof _nBuilding) in (_dmdRep0034 select 0)) exitwith {_type=(_dmdRep0034 select 1) select 0;};
  102.                 if ((typeof _nBuilding) in (_dmdRep0035 select 0)) exitwith {_type=(_dmdRep0035 select 1) select 0;};
  103.                 if ((typeof _nBuilding) in (_dmdRep0036 select 0)) exitwith {_type=(_dmdRep0036 select 1) select 0;};
  104.                 if ((typeof _nBuilding) in (_dmdRep0037 select 0)) exitwith {_type=(_dmdRep0037 select 1) select 0;};
  105.             };
  106.             _house = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
  107.             _house setVectorDirAndUp [ _dirVector, _objVector];
  108.            
  109.             if (_godModeBuildings) then {_house addEventHandler ["HandleDamage", {false}];};
  110.         };
  111.     };
  112. };
  113. if(!isServer || local player)then
  114. {
  115.     waitUntil{(player==player)};
  116.     waitUntil{alive player};
  117.     waitUntil{local player};
  118.     if (worldName == "chernarus") then
  119.     {
  120.         _FFA_CHOUSEV=[];
  121.         _FFA_CHOUSEV=nearestObjects [getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"),["house"],15000];
  122.         for "_i" from 0 to (count _FFA_CHOUSEV)-1 do
  123.         {
  124.             _housev=_FFA_CHOUSEV select _i;
  125.             if ((typeof _housev) in FFA_CLOSEHOUSE) then
  126.             {
  127.                 _housev hideObject true;
  128.                 deleteVehicle _housev;
  129.             };
  130.         };
  131.     };
  132. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement