[Release] Restrict building near defined areas

Discussion in 'Script/Addon releases' started by BigEgg, Jun 14, 2016.

  1. BigEgg

    BigEgg New Member

    Joined:
    May 31, 2015
    Messages:
    4
    Likes Received:
    1
    I released this on the Epoch forums a while back and figured I would post it here too!

    So you currently have a rule that states you can not build within a certain distance of Military barracks etc..... Although making it a rule is easy, making it impossible is almost easier. No deleting bases or having to constantly be on the look out.

    You will need:

    Notepad++ (or a software of your choice)

    init.sqf

    player_build.sqf (can be found in your snap build folder)

    Instructions:

    Step one:

    Open up your init.sqf and add this to the very bottom:

    Code:
    ServerIllegalRadius = 500;
    
    ServerNoBuildList = [ "Land_Mil_ControlTower",
    "Land_SS_hangar",
    "Land_Mil_Barracks_i",
    "Land_Mil_Barracks",
    "Land_budova4_in",
    "HeliHEmpty" ];
    
    Step two:

    At the top of player_build.sqf add these to the end of the Private line:

    Code:
    "_posrad","_cntrad"
    
    Step three:

    Find this line in player_build.sqf:

    Code:
    if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };
    
    Under it add:

    (Updated code thanks to Gr8)
    Code:
    _posrad = [player] call FNC_GetPos;
    _cntrad = count (nearestObjects [_posrad, ServerNoBuildList, ServerIllegalRadius]);
    if (_cntrad > 0) then {
    _cancel = true;
    _reason = format["- Building is restricted %1m near Trader Cities and Millitary Loot Areas", ServerIllegalRadius];
    };
    
    Hope it helps :)
     
    FallingSheep likes this.

Share This Page