Jump to content

[Tutorial] Prevent players building at bank zones without making them safezones


Recommended Posts

So it only occured to me, unless we make banks trader cities using the canbuild sensor players can still build there, I didn't like the idea of players building within 300m of banks but I also didn't like the fact it'd say you cannot build in a "city" I thought i'd make a small adjustment to display the correct reason

in your player_build.sqf add this (if you have multiple player_build.sqf's add it to each of them)

// No building in bank zones
if(!canbuildbank) then { _cancel = true; _reason = "Cannot build near a bank."; };

below

// No building in trader zones
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };

go into your mission.sqm (mission file side) and find your "class Sensors" section and add a new sensor for each bank you don't want players to build at like the examples below.
		class Item5
		{
			position[]={15007.018, -0.2819894, 18165.865}; 
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="DalnoBank";
			expCond="(player distance DalnoBank) < 300;";
			expActiv="TitleText["" "",""PLAIN DOWN""]; canbuildbank = false;";
			expDesactiv="TitleText["" "",""PLAIN DOWN""]; canbuildbank = true;";
			class Effects
			{
			};
		};
		class Item6
		{
			position[]={7935.1025, -0.2819894, 6717.6318}; 
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="NoviBank";
			expCond="(player distance NoviBank) < 300;";
			expActiv="TitleText["" "",""PLAIN DOWN""]; canbuildbank = false;";
			expDesactiv="TitleText["" "",""PLAIN DOWN""]; canbuildbank = true;";
			class Effects
			{
			};
		};
Dont forget to change your items count at the top or your new sensors won't be active.
	class Sensors
	{
		items=7; //<----- add 1 each time you add a new sensor
		class Item0
		{

			position[]={15309.663,-14.993002,9278.4912};
			a=100;
			b=100;
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonesabina";
			expCond="(player distance zonesabina) < 40;";
			expActiv="[""trader city Sabina"",true,""enter""] spawn player_traderCity;";
			expDesactiv="[""trader city Sabina"",true,""leave""] spawn player_traderCity;";
			class Effects
			{
			};
		};
you can easily change the distance you want to prevent people building from building near banks by editing the number in sensor like so.

		class Item5
		{
			position[]={15007.018, -0.2819894, 18165.865}; 
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="DalnoBank";
			expCond="(player distance DalnoBank) < 300;"; //<--- change 300 to the distance in meters to prevent building
			expActiv="TitleText["" "",""PLAIN DOWN""]; canbuildbank = false;";
			expDesactiv="TitleText["" "",""PLAIN DOWN""]; canbuildbank = true;";
			class Effects
			{
			};
		};

Lastly, in your variables.sqf add

canbuildbank = true;

just under

canbuild = true;

This isn't anything major and I expect you all have other options but to prevent making bank safezones or putting them in traders (both very bad idea's in my opinion) this was the solution I came up with for my servers :P

Heres a alternative solution posted by GZA just change "Laptop_EP1" to whatever the classname of the object you use as banks is 

 

You could do it without sensors which is less work. 

 

For example if you use Laptop as ATM add to player_build.sqf :
 

_atmNear = count (nearestObjects [player, ["Laptop_EP1"], 200]);
if(_atmNear > 0) then { _cancel = true; _reason = "Cannot build near a bank."; };

below:
 

// No building in trader zones
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };

 

Link to comment
Share on other sites

just replace your atm's with the server traders so then each trader is a banker no need for extra items/buildings on the map each atm has many plus no need for many map markers flooding your map by having 20 atm markers this also solves your building issue as traders are in trader zones = can not build in trader area ;) just a thought LINK:

Works very well you dont even need to add the extra bank trader you can use your normal traders.

Link to comment
Share on other sites

  • 2 weeks later...

just replace your atm's with the server traders so then each trader is a banker no need for extra items/buildings on the map each atm has many plus no need for many map markers flooding your map by having 20 atm markers this also solves your building issue as traders are in trader zones = can not build in trader area ;) just a thought LINK:

Works very well you dont even need to add the extra bank trader you can use your normal traders.

Thats a completely different thing to this, people will still be able to build at your banker unless you put them in the trader zones which IMO is a stupid idea as money will NEVER leave the trader meaning no risks to loosing it, bad economy if you ask me furthermore there is no need for 20 map markers at ATM's not everyone has 20 ATM's, my servers use only 1 or 2 no more keeping it clean and simple but MGM's thread its a useful alternative if you don't want map objects and would rather a "banker" rather than "banking object"

Link to comment
Share on other sites

You could do it without sensors which is less work. 

 

For example if you use Laptop as ATM add to player_build.sqf :

_atmNear = count (nearestObjects [player, ["Laptop_EP1"], 200]);
if(_atmNear > 0) then { _cancel = true; _reason = "Cannot build near a bank."; };

below:

// No building in trader zones
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };
Link to comment
Share on other sites

 

You could do it without sensors which is less work. 

 

For example if you use Laptop as ATM add to player_build.sqf :

_atmNear = count (nearestObjects [player, ["Laptop_EP1"], 200]);
if(_atmNear > 0) then { _cancel = true; _reason = "Cannot build near a bank."; };

below:

// No building in trader zones
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };

Thats probably a much better way to do it, I'll edit up my post and add your option there too :)

Link to comment
Share on other sites

  • 1 month later...

Could I somehow use this to enable building in trade cities? By Changing "canbuild = true;" to "canbuild = false;" or "if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };" to "if(!canbuild) then { _cancel = false; _reason = "Cannot build in a city."; };"

 

?

Link to comment
Share on other sites

  • 3 weeks later...

Could I somehow use this to enable building in trade cities? By Changing "canbuild = true;" to "canbuild = false;" or "if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };" to "if(!canbuild) then { _cancel = false; _reason = "Cannot build in a city."; };"

 

?

You could probably just remove the trader cities from the sensors in the mission.sqm. Most safe zones scripts allow you to manually set the safe zone coordinates, so you dont need to have them in the sensors as well.

Link to comment
Share on other sites

  • 2 weeks later...

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
  • Advertisement
  • Discord

×
×
  • Create New...