Jump to content
Friendly

Extended Safezone Script - Working!

Recommended Posts

Hey guys, I am still a noob at scripting. Here is a code revamped a little from the Arma 2 Epoch Community to try and help out anyone having problems with extending safezones.

 

-----> I am no longer providing support for this script please get all questions/answers from the community! Peace  B) <-----

 

Video Tutorial thanks to subzerogaming :

https://youtu.be/zbWSwdw0QF4

 

NOTE: Only Works with Infistar Antihack as Epochs Antihack Reverts Allow Damage

 

To allow this to work you must change the follow to false below in your run.sqf that was provided to you by infistar!

/*  revert allowDamage   */ _RAD = false; /* true or false */ /* if you have safezones using "player allowDamage false;" or similar.. set _RAD = false; */
/*  HandleDamage check   */ _HDC = false; /* true or false */ /* *experimental + Epoch only* - probably publicVariableServer spam but no more godmode hackers. */
/*  Revert HandleDamage  */ _RHD = false; /* true or false */ /* Needs to be  false  for Paintball script */
/*  Use EH_Fired check   */ _EHF = false; /* true or false */ /* Some mods revert the EventHandlers by default and can cause problems with this check. Tested on Epoch and AltisLife.  */

Next go to your init.sqf (note: If you do not already have one just create a blank init.sqf file and put the following)

Paste the following code into it.

[] execVM "scripts\safezone.sqf";

If you do not already have a scripts folder then create one or rename the path in the init to wherever you want it to be placed, but for this example we will just use the scripts folder.

Inside of the scripts folder create a new file called safezone.sqf and paste the following into it.

if (isNil "inSafezone") then {
    inSafezone = false;
};
while {
    true
}
do {
    private["_safeZoneDamageEH", "_safeZoneFiredEH"];
    waitUntil {
        inSafeZone
    };
    player allowDamage false;
_safeZoneDamageEH = player addEventhandler["HandleDamage",{false}];
    _safeZoneFiredEH = player addEventHandler ["Fired", {
   deleteVehicle (_this select 6);
systemChat ("You can not fire your weapon in a safe zone.");
    }];
    waitUntil {
        !inSafeZone
    };
    player allowDamage true;
    player removeEventhandler["HandleDamage", _safeZoneDamageEH];
    player removeEventHandler["Fired", _safeZoneFiredEH];
}; 

Next go into your mission.sqm and replace

class Markers
	{
		items = 9;
		class Item0
		{
			position[] = {14939.934,0.053499073,15083.272};
			name = "center";
			type = "Empty";
		};
		class Item1
		{
			position[] = {23600.639,3.19,18000.72};
			name = "respawn_east";
			type = "Empty";
		};
		class Item2
		{
			position[] = {23600.611,3.19,18000.768};
			name = "respawn_west";
			type = "Empty";
		};
	};
}; 

With

class Markers
	{
		items = 9;
		class Item0
		{
			position[] = {14939.934,0.053499073,15083.272};
			name = "center";
			type = "Empty";
		};
		class Item1
		{
			position[] = {23600.639,3.19,18000.72};
			name = "respawn_east";
			type = "Empty";
		};
		class Item2
		{
			position[] = {23600.611,3.19,18000.768};
			name = "respawn_west";
			type = "Empty";
		};
		class Item3
		{
			position[]={6181.6841,83.907509,16876.732};
			name="westsafezone";
			text="Safe Zone";
			type="mil_warning";
			colorName="ColorRed";
		};
		class Item4
		{
			position[]={13334.093,2.2350941,14517.924};
			name="centralspawn";
			markerType="ELLIPSE";
			type="Empty";
			colorName="ColorGreen";
			fillName="Grid";
			a=250;
			b=250;
		};
		class Item5
		{
			position[]={13326.247,2.2928343,14546.686};
			name="centralsafezone";
			text="Safe Zone";
			type="mil_warning";
			colorName="ColorRed";
		};
		class Item6
		{
			position[]={18464.313,23.351175,14263.799};
			name="eastspawn";
			markerType="ELLIPSE";
			type="Empty";
			colorName="ColorGreen";
			fillName="Grid";
			a=250;
			b=250;
		};
		class Item7
		{
			position[]={18461.789,24.769226,14300.033};
			name="eastsafezone";
			text="Safe Zone";
			type="mil_warning";
			colorName="ColorRed";
		};
		class Item8
		{
			position[]={6195.4927,89.220779,16839.254};
			name="westspawn";
			markerType="ELLIPSE";
			type="Empty";
			colorName="ColorGreen";
			fillName="Grid";
			a=250;
			b=250;
		};
	};
	class Sensors
	{
		items=3;
		class Item0
		{
			position[]={18461.789,24.769226,14300.033};
			a=250;
			b=250;
			activationBy="ANY";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="eastsafezone";
			expCond = "(player distance eastsafezone) < 250;";
			expActiv="hint ""You have entered A Safe Zone! Do not fire in the Safe Zones."";  inSafeZone = true;";
			expDesactiv="hint ""You are leaving the Safe Zone!""; inSafeZone = false;";
			class Effects
			{
			};
		};
		class Item1
		{
			position[]={6181.6841,83.907509,16876.732};
			a=250;
			b=250;
			activationBy="ANY";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="westsafezone";
			expCond = "(player distance westsafezone) < 250;";
			expActiv="hint ""You have entered A Safe Zone! Do not fire in the Safe Zones.""; inSafeZone = true;";
			expDesactiv="hint ""You are leaving the Safe Zone!""; inSafeZone = false;";
			class Effects
			{
			};
		};
		class Item2
		{
			position[]={13326.247,2.2928343,14546.686};
			a=250;
			b=250;
			activationBy="ANY";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="centralsafezone";
			expCond = "(player distance centralsafezone) < 250;";
			expActiv="hint ""You have entered A Safe Zone! Do not fire in the Safe Zones.""; inSafeZone = true;";
			expDesactiv="hint ""You are leaving the Safe Zone!""; inSafeZone = false;";
			class Effects
			{
			};
		};
	};
};

  

This should work for all maps, but you will have to change the coordinates of the markers if it is anything but default altis.

 

Battleye:

 

Scripts.txt

 

line 20 or under allowDamage add

!"player allowDamage false;" !"player allowDamage true;"

line 58 or under 7 removeEventHandler add

!"player removeEventhandler["HandleDamage", _safeZoneDamageEH];"

No Longer being updated/responded to as I only play the game now  B)

Share this post


Link to post
Share on other sites

Why do that  I do mine all in the mission.sqf 

 

 Example below 

 

class Sensors
{
items=3;
class Item0
{
position[]={10190.044,25.138008,12419.594};
a=150;
b=150;
angle=-130.966;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
text="CSpawn";
name="CTrader";
expCond="(vehicle player) in thislist;";
expActiv="titleText [""You Are Now Entering A Save Zone"", ""PLAIN DOWN"", 3]; player allowDamage false; player addEventHandler [""HandleDamage"",{false}];";
expDesactiv="titleText [""You Are Now Leaving A Save Zone"", ""PLAIN DOWN"", 3]; player allowDamage true; player addEventHandler [""HandleDamage"",{true}];";
class Effects
{
};

Share this post


Link to post
Share on other sites

 

Why do that  I do mine all in the mission.sqf 

 

 Example below 

 

class Sensors
{
items=3;
class Item0
{
position[]={10190.044,25.138008,12419.594};
a=150;
b=150;
angle=-130.966;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
text="CSpawn";
name="CTrader";
expCond="(vehicle player) in thislist;";
expActiv="titleText [""You Are Now Entering A Save Zone"", ""PLAIN DOWN"", 3]; player allowDamage false; player addEventHandler [""HandleDamage"",{false}];";
expDesactiv="titleText [""You Are Now Leaving A Save Zone"", ""PLAIN DOWN"", 3]; player allowDamage true; player addEventHandler [""HandleDamage"",{true}];";
class Effects
{
};

 

this one deletes bullets when they are shot. I just prefer to keep it all in one file and then be called to. Just my personal thoughts. As well as when a player shoots it warns them that they cannot shoot in a safezone. I made the bullets delete because of people shooting from in the safezone out and killing people.

Share this post


Link to post
Share on other sites

this is how my safe zones work with Protection Zone

 

 

b_560_95_1.png

 

example

	private ["_objects"];
_objects = [


    ["ProtectionZone_Invisible_F",[23710.1, 16250.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23710.1, 16225.1, 0.01]], 	
    ["ProtectionZone_Invisible_F",[23710.1, 16200.1, 0.01]],	
    ["ProtectionZone_Invisible_F",[23685.1, 16250.1, 0.01]],
    ["ProtectionZone_Invisible_F",[23685.1, 16225.1, 0.01]],
    ["ProtectionZone_Invisible_F",[23685.1, 16200.1, 0.01]],	
    ["ProtectionZone_Invisible_F",[23660.1, 16250.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23660.1, 16225.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23660.1, 16200.1, 0.01]] 
	
];

{
	private ["_obj"];
	_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
	_obj setvectorup [0,0,1];	
	_obj setPosATL (_x select 1);
} foreach _objects;	

Share this post


Link to post
Share on other sites

ya the code definately is up for some adjustment. If anyone has tips or already a better safezone script made pls post. This one works perfect from what I can tell so that people don't shoot vehicles or shoot people in the safezone. But I am still a noob when it comes to scripting and it probably has some downsides.

Share this post


Link to post
Share on other sites

The only problem is that the most common antihacks clean up event handlers on normal players and its a pain in the ahole to work around.

The best alternative is the Protection Zone objects.

 

The problem is you can still be ran over in the zone. 

Share this post


Link to post
Share on other sites

Everything loaded fine I see no errors or problems but the code does not execute?  No messages and no invuln to bullets.  Any chance infistar is blocking this somehow?  It always seems to be Infistar is the problem for anything I try to add in.

 

infistart not blocking safe zone

Share this post


Link to post
Share on other sites

Everything loaded fine I see no errors or problems but the code does not execute?  No messages and no invuln to bullets.  Any chance infistar is blocking this somehow?  It always seems to be Infistar is the problem for anything I try to add in.

can you send me your mission.sqm in a pastebin? That is probably the problem, at least it is going to be the most common... Also are you running this on Altis?

Share this post


Link to post
Share on other sites

Everything loaded fine I see no errors or problems but the code does not execute?  No messages and no invuln to bullets.  Any chance infistar is blocking this somehow?  It always seems to be Infistar is the problem for anything I try to add in.

 

Like brunz said... Antihacks clean up Eventhandlers such as this one on normal players and infistar will clean this up. But one way to test if it loaded up is to login as infistar admin and see if it works... It should work for you, just not a normal player.

Share this post


Link to post
Share on other sites

Like brunz said... Antihacks clean up Eventhandlers such as this one on normal players and infistar will clean this up. But one way to test if it loaded up is to login as infistar admin and see if it works... It should work for you, just not a normal player.

 

So how do you tell Infistar to leave this code alone and let it execute?

Share this post


Link to post
Share on other sites

can you send me your mission.sqm in a pastebin? That is probably the problem, at least it is going to be the most common... Also are you running this on Altis?

 

Yeah Altis - will get it going again and test and send you the resulting mission.sqm pretty sure Infistar is blocking this though.

Share this post


Link to post
Share on other sites

 

example

	private ["_objects"];
_objects = [


    ["ProtectionZone_Invisible_F",[23710.1, 16250.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23710.1, 16225.1, 0.01]], 	
    ["ProtectionZone_Invisible_F",[23710.1, 16200.1, 0.01]],	
    ["ProtectionZone_Invisible_F",[23685.1, 16250.1, 0.01]],
    ["ProtectionZone_Invisible_F",[23685.1, 16225.1, 0.01]],
    ["ProtectionZone_Invisible_F",[23685.1, 16200.1, 0.01]],	
    ["ProtectionZone_Invisible_F",[23660.1, 16250.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23660.1, 16225.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23660.1, 16200.1, 0.01]] 
	
];

{
	private ["_obj"];
	_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
	_obj setvectorup [0,0,1];	
	_obj setPosATL (_x select 1);
} foreach _objects;	

I'd like to try a protection zone.  Would you be willing to do a full write up on how to accomplish this?

 

Init.sqm change?

Add a script?

Change the mission.sqm?

Share this post


Link to post
Share on other sites

I'd like to try a protection zone.  Would you be willing to do a full write up on how to accomplish this?

 

Init.sqm change?

Add a script?

Change the mission.sqm?

example:

 

make file SafeZone.sqf

Add code inside:

	private ["_objects"];
_objects = [
 
 
    ["ProtectionZone_Invisible_F",[23710.1, 16250.1, 0.01]], //safe zone cords with 25m radius
    ["ProtectionZone_Invisible_F",[23710.1, 16225.1, 0.01]], 	
    ["ProtectionZone_Invisible_F",[23710.1, 16200.1, 0.01]],	
    ["ProtectionZone_Invisible_F",[23685.1, 16250.1, 0.01]],
    ["ProtectionZone_Invisible_F",[23685.1, 16225.1, 0.01]],
    ["ProtectionZone_Invisible_F",[23685.1, 16200.1, 0.01]],	
    ["ProtectionZone_Invisible_F",[23660.1, 16250.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23660.1, 16225.1, 0.01]], 
    ["ProtectionZone_Invisible_F",[23660.1, 16200.1, 0.01]] 
	
];
 
{
	private ["_obj"];
	_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
	_obj setvectorup [0,0,1];	
	_obj setPosATL (_x select 1);
} foreach _objects;	

run it from init.sqf  

[] execVM "SafeZone.sqf";

Share this post


Link to post
Share on other sites
26.02.2015 20:02:24: AsReMix (192.168.42.46:2304) 90fa8809ddeb57348c44b43b2410f7e5 - #57 "Until {
!inSafeZone
};
player allowDamage true;
player removeEventhandler["HandleDamage", _safeZoneDamageEH];
player removeEvent"

Share this post


Link to post
Share on other sites
26.02.2015 20:02:24: AsReMix (192.168.42.46:2304) 90fa8809ddeb57348c44b43b2410f7e5 - #57 "Until {
!inSafeZone
};
player allowDamage true;
player removeEventhandler["HandleDamage", _safeZoneDamageEH];
player removeEvent"

in scripts.txt line 58 add !"player removeEventhandler["HandleDamage", _safeZoneDamageEH];"

Share this post


Link to post
Share on other sites

in scripts.txt line 58 add !"player removeEventhandler["HandleDamage", _safeZoneDamageEH];"

 

Are you claiming the AH cleanup of event handlers can be solved by adding exceptions in the scripts.txt ?

 

I had to add a slew of BE exceptions just to get a safezone to run, it still only worked for admins.

 

I'd want handle damage and 'fired' to be added/removed without issue on players.

Share this post


Link to post
Share on other sites

Are you claiming the AH cleanup of event handlers can be solved by adding exceptions in the scripts.txt ?

 

I had to add a slew of BE exceptions just to get a safezone to run, it still only worked for admins.

 

I'd want handle damage and 'fired' to be added/removed without issue on players.

I kinda gave up after I figured out that the two antihacks messed up the event handlers. I have no idea of what I should do to work around it. And no, battleye is 100% seperate from the antihacks when it comes to that.

Share this post


Link to post
Share on other sites

Here is how to make it serverside.

Download pbo file here https://www.dropbox.com/s/5m4qg1ucch116f6/Safe_Zone.pbo?dl=0

Unpack Safe_Zone.pbo and add your safe zone cords inside file init.sqf 

Pack it back to pbo and add to @epochhive\addons

Run it from MPMission init.sqf 

 

[] execVM "\q\addons\Safe_Zone\init.sqf";

 

There is no need any be filters

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By Sp4rkY
      Title:                 SPK_ESVP
      Author:            Sp4rkY (Github)
      Description:   Extended Safezones with Vehicle Protection for Arma 3 Epoch
      Version:           0.9
      Required:        Arma 3 1.66+ / Epoch 0.4+
      Credits:            IT07 (Thx for many brain) (Github)
                                |V.I.P.| CH!LL3R (Thx for thoughts & testing!)

      DOWNLOAD & INSTALL INSTRUCTIONS:
      >>> >> > CLICK ME < << <<<
      Edit by EpochMod - 2019-11-08:
      There came some issues up with the Arma 1.96 update.
      Unfortunately @Sp4rkY currently seems to be not active here, so we have added a pull request for his GitHub files.
      So if you want to use this addon, check / add this changes:
      https://github.com/SPKcoding/A3_Epoch_ESVP/pull/2/files

      FEATURES:
      * Fully customizable
      * Works with all maps
      * Works for players and vehicles
      * No more `"ProtectionZone_Invisible_F"` is needed (usually found in map config in a3_epoch_server_settings.pbo)
      * Fired bullets will automatically be deleted in safezones
      * (optional) Teleport players out of safezones after restart
      * (optional) Teleport players away from the parking place (if used) after restart
      * Protection from idiots trying to drive over other players (including traders)
      * Check vehicle ownership of bought vehicles
      * (optional) Teleport vehicles out of safezones at server restart to:
          - (optional) a given distance from the respective safezone
          - (optional) a static parking place (you can use your own map addition and define as many parking lots you want)
      * (optional) Restricted vehicle´s access in safezones (only the owner(s) can enter the vehicle)
      * (optional) Restricted vehicle´s gear-access in safezones (only the owner(s) can access the vehicle´s inventory)
      * (optional) Protection for lifted vehicle´s
          - If using this feature, there will be also a check for the owner, so stealing is not possible
      * (optional) Unlock teleported vehicles
      * 2 ways of info messages (depends on if vehicle protection is used or not)
      * (optional) Vehicle Access Menu:
          - "Refresh" button to update the player-list while menu is open
          - "Registered" listing to see which players are added to your vehicle
          - "Clear" button to remove the added players
      * (optional) restrict access to driver seat for primary vehicle owner
      * slingload check for bought vehicles (you can not steal cars or ships)
      * (optional) info messages for prohibited lifting
      * (optional) Prevent spawning of antagonists (UAV, Sappers, Snakes, Cultists) in safezones
      * (optional) Allow/disallow to chop/sledge/chainsaw anything in safezones
      * (optional) Feature to set map markers directly from this script (no need to define them anywhere else)
      * If using the "vehicle teleporting WITHOUT Parking Place" - function:
          - the vehicles get teleported to a random position within the given radius out of the safezones
      * If using the "vehicle teleporting WITH Parking Place" - function, it will works like this:
          - server restarts, vehicles in safezones will be teleported to a parking place
          - vehicles which are present at the parking place are getting teleported to a random location on the map, new vehicles (in safezones) are ported to the parking place
      * If the respective safezone contains water, ships are treated like this:
          - if ships are located at water surface, they gets teleported close to the safezone´s shore at given radius
          - if ships are located at terrain surface because of lifting or simliar, they gets ported random at the maps shore
      * If not using "vehicle teleporting" - function, remaining vehicles in safezones are indestructible after restart
      * Debug option for better determine errors (client & server)
       
      Enjoy this stuff and have fun!
      cheers
    • By Bloodthirsty
      Hey I just need some files for this server, any and all you guys can come up with and think it deserve post that shit in chat rn. I want to see some crazy ideas and additions if you got em :) Lets see what you guys can come up with

    • By nova
      This is a new version of a safezone script and an a.i/a.i vehicle remover. To be used in conjunction with the 1061 safezone script. So say your safe zone is being bombarded with roaming a.i and you are tired of going to safe zones to delete them this will do it automatically when you go within 350 meters of an roaming a.i while in a safezone. The distance is customizable. The new safezone script allows you to receive god mode for 20 secs after you leave the safe zone IF you have stayed in the safezone long enough. This will avoid players from touching the safe zone and taking off for a way to avoid combat from other players. All credits go to @juandayz for this. Uploaded with his permission. 
       
      1- into mpmission\your instance\scripts\  create a new folder called "safezone"
      2-into this folder create this sqf:
      safezone_ai_remover.sqf
       
      3-open your init.sqf
       
      4-Now if ure using DZAI:
       
      5-If ure using DZMS then do the same:
       
      6-If you are using some kind of other script that spawns enemy ai vehicles then add the same variable.. for example:
       
    • By juandayz
      I JUST LEAVE THIS ONE CUZ I KNOW YOU GUYS GONNA NEED IT..
       
      The very old safezone script by infistar... i was using it in 1.0.5.1  and made some changes to use in 1.6.
      Instructions:
          1. Copy paste the code of below into a file called 16_safezone.sqf - save the file.
          2. Paste this 16_safezone.sqf into mpmissioms\instance_11.chernarus\custom\
          3. Open your init.sqf
          4. At the very bottom of the file add this line:  [] execVM "custom\16_safezone.sqf";
          5. Save the init.sqf and restart your server.
          6-WARNING!!! if ure using some kind of mod that allow vehicles with GodMode out of safezones..  then you will need in 16_safezone.sqf change the path for veh_handleDam.sqf by the path that youre using your custom veh_handleDam.sqf
      this line:  fnc_veh_handleDam = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\veh_handleDam.sqf';
          16_safezone.sqf
       
      OPTIONAL:
      @BetterDeadThanZed here you got.
      REMOVE LOOT FROM TRADER CITIES AND PLOT POLES. (should removes zeds from trader places and poles too)
       
       
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...