Adding Safe/NoFire zones Using EventHandler Function

Post Reply
AlexR
Site Admin
Posts: 7
Joined: Thu Apr 25, 2013 11:49 pm

Adding Safe/NoFire zones Using EventHandler Function

Post by AlexR » Wed Apr 13, 2016 7:10 am

Having trouble in certain trading areas, or just want to just your players a rest?

Add this simple script to add a safe zone.

Credit for this Script belongs to Bake and tweaked by Rarek.

Installation :

1.Create a File with the Name "safezone.sqf" :

/* GrenadeStop v0.8 for ArmA 3 Alpha by Bake (tweaked slightly by Rarek) DESCRIPTION: Stops players from throwing grenades in safety zones. CONFIGURATION: Edit the #defines below.*/#define SAFETY_ZONES [["Safe_Kav", 25]] // Syntax: [["marker1", radius1], ["marker2", radius2], ...]#define MESSAGE "Granaten sowie Schießen ist auf dem Marktplatz ausgeschaltet!" if (isDedicated) exitWith {}; waitUntil {!isNull player};switch (playerSide) do{ case west: {}; case civilian: { player addEventHandler ["Fired", { if ({(_this select 0) distance getMarkerPos (_x select 0) < _x select 1} count SAFETY_ZONES > 0) then { deleteVehicle (_this select 6); titleText [MESSAGE, "PLAIN", 3]; }; }]; };};
2.Create in the Arma3 Editor a Marker at the Position where the Safezone would be.

3. At the top of the Script you can see "#define SAFETY_ZONES" there can you add the Safezone´s Marker Names.(The Syntax is at the Back).

#define SAFETY_ZONES [["Safe_Kav", 25]] // Syntax: [["marker1", radius1], ["marker2", radius2], ...]
Also you can see "#define MESSAGE" this can you change to the Text do you would say to the Guy who fired.

#define MESSAGE "Granaten sowie Schießen ist auf dem Marktplatz ausgeschaltet!"
4.To active this Script you need to add something to the Mission.sqm Init.sqf :

[] execVM "safezone.sqf";
Like this but you must have the right Path

5. In this Version of the Script Cops(Bluefor) can fire in the Savezone. To Change this Copy this to the Case West:

player addEventHandler ["Fired", {if ({(_this select 0) distance getMarkerPos (_x select 0) < _x select 1} count SAFETY_ZONES > 0) then{deleteVehicle (_this select 6);titleText [MESSAGE, "PLAIN", 3];};}];

Please see here for extended forum help http://www.altisliferpg.com/topic/2241- ... -function/

Post Reply

Return to “Arma Series”