Jump to content

Recommended Posts

I'm trying to implement a "No Fire Zone" script into a mission I'm working on and it doesn't seem to work. I found it on BI forums and it looked simple enough to use, name the marker, set the size of the zone, boom. Looked easy enough, but for some reason it isn't working. 

/*
    GrenadeStop v0.8 for ArmA 3 Alpha by Bake (tweaked slightly by Rarek)
    
    DESCRIPTION:
    Stops players from throwing grenades in safety zones.
    
    INSTALLATION:
    Move grenadeStop.sqf to your mission's folder. Then add the
    following line to your init.sqf file (create one if necessary):
    execVM "grenadeStop.sqf";
    
    CONFIGURATION:
    Edit the #defines below.
*/

#define SAFETY_ZONES    [["respawn_west", 75]] // Syntax: [["marker1", radius1], ["marker2", radius2], ...]
#define MESSAGE "Placing / Throwing items and firing at base is STRICTLY PROHIBITED!"
#define MORTAR_MESSAGE    "No point you putting that up, we're fresh out of ammo for those things."
#define AA_MESSAGE    "All AA missiles are disabled!"

if (isServer) exitWith {};
waitUntil {!isNull player};

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];
    };
    
    if (_this select 5 == "RPG32_AA_F") then
    {
        deleteVehicle (_this select 6);
        titleText [AA_MESSAGE, "PLAIN", 3];
    };
}];

player addEventHandler ["WeaponAssembled", {
    deleteVehicle _this select 1;
    titleText [MORTAR_MESSAGE, "PLAIN", 3];
}];

That's what I'm using. If I missed something or there are better ways I'm all ears.

  • Like 2

Share this post


Link to post
Share on other sites

i found this in a mission by [GR]GEORGE F.

 

; No Kill Zone - v1.16
; (c)2016 By SuperChicken Productions - Atlanta GA., USA

 

NoKillZone.Sqs Note that this is a SQS file not a SQF file


; usage = [MARKER,DISTANCE,TEXT-IN,TEXT-OUT,PROTECTION] exec "NoKillZone.Sqs"; - MARKER = a marker that is the CENTER of the zone - DISTANCE = how from out from the MARKER to 'protect' - TEXT-IN = text to show via HINT if inside zone - TEXT-OUT = text to show via HINT if outside zone - PROTECTION = if players vehicle is also protected
; example:  ["CentralSZ",500,"You Have Entered The Central Safe Zone!","You Have Left The Central Safe Zone!",0] exec "NoKillZone.Sqs"; - this would protect any player and not his vehicle within 500m of the marker called 'CentralSZ'

; run for every marker you have set
; example, for epoch you have 3:
; ["CentralSZ",500] exec "NoKillZone.Sqs";
; ["WesternSZ",500] exec "NoKillZone.Sqs";
; ["EasternSZ",500] exec "NoKillZone.Sqs";

; Also could be:
; #1 - ["CentralSZ",500,"You Have Entered The Central Safe Zone","You Have Left The Central Safe Zone"] exec "NoKillZone.Sqs";
; #2 - ["CentralSZ",500,"You Have Entered The Central Safe Zone",""] exec "NoKillZone.Sqs";
; #3 - ["CentralSZ",500,"","You Have Left The Central Safe Zone"] exec "NoKillZone.Sqs";
; #4 - ["CentralSZ",500,"","You Have Left The Central Safe Zone"] exec "NoKillZone.Sqs"; - this would disable vechicle protection
; #5 - ["CentralSZ",500,"","You Have Left The Central Safe Zone",0] exec "NoKillZone.Sqs"; - this would disable vechicle protection
; #6 - ["CentralSZ",500,"","You Have Left The Central Safe Zone",1] exec "NoKillZone.Sqs"; - this would enable vechicle protection

; TEXT-IN and TEXT-OUT are OPTIONAL - if not supplied, no hint will be shown for that section (in/out)
; if you wished to use ONLY 'OUT' text and NO 'IN' text, you MUST include a empty quote for the 'IN' entry - see #3 above!  Missing quote(s) = fails to run!
; text may also use the '\n\ command to allow for multiple lines of text in hint!

; PROTECTION (vechicle protection) is also OPTIONAL.  if set to ZERO (0) or left out, it defaults to no protection.
; to enable protection, use a ONE (1) as a paramenter - see #6 above

; marker name and text ALL must be in quotes! 

; marker name is the name you gave the marker in the editor - NOT 'text' field, rather the 'NAME' field

; put script call into your server "INIT.Sqf" file to be run at startup and in the "OnPlayerRespawn.Sqf" file so that it may start again at respawn

; for those that may not know, the INIT.Sqf and the "OnPlayerRespawn.Sqf" are where your 'Mission.SQM' reside!  Not there?  CREATE THEM!  ;)


; this runs 100% on the client and NOT on the server!  ZERO performence hit on the server side and ZERO interference with most other scrips in use!


; can be used in MP or SP!


; ********************************************************************************

; make sure script only runs on clients
if (isDedicated) then {goto "ExitHere"};


#StartLoop
; set varis to be used by script
_NKZver = "1.16"
_getdistance = 0;
_NKZflag=9;
_vp="";

; text in use flags
_inflag = 9;
_outflag = 9;

; get params
_NKZmarker = _this select 0;
_NKZdistance = _this select 1;
_NKZTextIn = _this select 2;
_NKZTextOut = _this select 3;
_NKZvech = _this select 4;


; checks to ensure both parameters (#1 & #2) have been set
if ((isNil "_NKZmarker") or(isNil "_NKZdistance")) then {goto "ParaError"};


; checks to see if text exist, if not flag as such so no hint will show

; checks for inside zone text
if (isNil "_NKZTextIn") then {_inflag = 0};
if (!isNil "_NKZTextIn") then {_inflag = 1};

; checks for outside zone text
if (isNil "_NKZTextOut") then {_outflag = 0};
if (!isNil "_NKZTextOut") then {_outflag = 1};


; check for vechile protection here - if missing, set to 'off'
if (isNil "_NKZvech") then {_NKZvech = 0};
if (_NKZvech == 0) then {_vp="Vehicle Protection Is:  *Off*"};
if (_NKZvech == 1) then {_vp="Vehicle Protection Is:  *On*"};

; startup notice
;systemchat format ["No Kill Zone Script v%2 Active For '%1'",_NKZmarker, _NKZver];
;systemchat format ["---  %1  ---",_vp];

; start the checking here
#LoopHere

_objcoords = getMarkerPos _NKZmarker;
_getdistance = player distance _objcoords;

if (_getdistance <= _NKZdistance) then {goto "InsideTheZone"};
if (_getdistance > _NKZdistance) then {goto "OutsideTheZone"};
goto "LoopHere";


; comes here if player is inside the set zone
#InsideTheZone
if (_NKZflag == 9) then {_NKZflag = 0};
if (_NKZflag == 0) then {player allowdamage false};
if ((_NKZflag == 0) && (_NKZvech == 1)) then {vehicle player allowdamage false};
if ((_NKZflag == 0) && (_inflag == 1)) then {hint _NKZTextIn};
_NKZflag = 1;
goto "LoopHere";


; comes here if player is outside the set zone
#OutsideTheZone
if (_NKZflag == 9) then {goto "LoopHere"};
if (_NKZflag == 1) then {player allowdamage true};
if ((_NKZflag == 1) && (_NKZvech == 1)) then {vehicle player allowdamage true};
if ((_NKZflag == 1) && (_outflag == 1)) then {hint _NKZTextOut};
_NKZflag = 0;
goto "LoopHere";

; comes here if the params are not set
#ParaError
hint format ["You Did Not Use Correct Parameters!\n\n\nMarker Name:  %1\n\nDistance:  %2\n\nPlease Correct And Try Again!\n",_NKZmarker, _NKZdistance];
goto "ExitHere";

; master exit point
#ExitHere

; ********************************************************************************
 

[GR]GEORGE F. was using it to make safety around traders in his mission. He executed it at the bottom of the init.sqf with 

["Trader1",400,"You Have Entered a Trader Safe Zone!","You Have Left The Safe Zone!",1] exec "scripts\NoKillZone.Sqs";
 

 

I  havent tried to use this yet as my missions rely on you stopping hostiles from getting near trader zones. If you let a trader die then thats on you.

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, Chuc said:

i found this in a mission by [GR]GEORGE F.

 

; No Kill Zone - v1.16
; (c)2016 By SuperChicken Productions - Atlanta GA., USA

 

NoKillZone.Sqs Note that this is a SQS file not a SQF file

 

Hello there Chuc & KmdrFarsight  !

 

On 14/5/2018 at 1:48 PM, GEORGE FLOROS GR said:

When you  are pasting codes , it's better to do this using the   <>  code button like:


this call { _radiusLights = 3000; 

and if it's that big , you can use a spoiler and then the code .

 

I 'm using this also in a mission as @Chuc said and it's working good !

No Kill Zone Script

by SuperChicken Productions

http://www.armaholic.com/page.php?id=30691

 

On 18/3/2018 at 8:02 AM, KmdrFarsight said:

GrenadeStop v0.8

 

The Grenade script is also good but if i remember the ai are able to kill you with this one.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×