Advertisement
LeventHAN

NoKillZone.Sqs

Jul 18th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.40 KB | None | 0 0
  1. ; No Kill Zone - v1.16
  2. ; (c)2016 By SuperChicken Productions - Atlanta GA., USA
  3. ; Edits by LeventHAN - leventhan.info
  4.  
  5.  
  6.  
  7. NoKillZone.Sqs Note that this is a SQS file not a SQF file
  8.  
  9.  
  10. ; 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
  11. ; 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'
  12.  
  13. ; run for every marker you have set
  14. ; example, for epoch you have 3:
  15. ; ["CentralSZ",500] exec "NoKillZone.Sqs";
  16. ; ["WesternSZ",500] exec "NoKillZone.Sqs";
  17. ; ["EasternSZ",500] exec "NoKillZone.Sqs";
  18.  
  19. ; Also could be:
  20. ; #1 - ["CentralSZ",500,"You Have Entered The Central Safe Zone","You Have Left The Central Safe Zone"] exec "NoKillZone.Sqs";
  21. ; #2 - ["CentralSZ",500,"You Have Entered The Central Safe Zone",""] exec "NoKillZone.Sqs";
  22. ; #3 - ["CentralSZ",500,"","You Have Left The Central Safe Zone"] exec "NoKillZone.Sqs";
  23. ; #4 - ["CentralSZ",500,"","You Have Left The Central Safe Zone"] exec "NoKillZone.Sqs"; - this would disable vechicle protection
  24. ; #5 - ["CentralSZ",500,"","You Have Left The Central Safe Zone",0] exec "NoKillZone.Sqs"; - this would disable vechicle protection
  25. ; #6 - ["CentralSZ",500,"","You Have Left The Central Safe Zone",1] exec "NoKillZone.Sqs"; - this would enable vechicle protection
  26.  
  27. ; TEXT-IN and TEXT-OUT are OPTIONAL - if not supplied, no hint will be shown for that section (in/out)
  28. ; 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!
  29. ; text may also use the '\n\ command to allow for multiple lines of text in hint!
  30.  
  31. ; PROTECTION (vechicle protection) is also OPTIONAL. if set to ZERO (0) or left out, it defaults to no protection.
  32. ; to enable protection, use a ONE (1) as a paramenter - see #6 above
  33.  
  34. ; marker name and text ALL must be in quotes!
  35.  
  36. ; marker name is the name you gave the marker in the editor - NOT 'text' field, rather the 'NAME' field
  37.  
  38. ; 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
  39.  
  40. ; for those that may not know, the INIT.Sqf and the "OnPlayerRespawn.Sqf" are where your 'Mission.SQM' reside! Not there? CREATE THEM! ;)
  41.  
  42.  
  43. ; 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!
  44.  
  45.  
  46. ; can be used in MP or SP!
  47.  
  48.  
  49. ; ********************************************************************************
  50.  
  51. ; make sure script only runs on clients
  52. if (isDedicated) then {goto "ExitHere"};
  53.  
  54.  
  55. #StartLoop
  56. ; set varis to be used by script
  57. _NKZver = "1.16"
  58. _getdistance = 0;
  59. _NKZflag=9;
  60. _vp="";
  61.  
  62. ; text in use flags
  63. _inflag = 9;
  64. _outflag = 9;
  65.  
  66. ; get params
  67. _NKZmarker = _this select 0;
  68. _NKZdistance = _this select 1;
  69. _NKZTextIn = _this select 2;
  70. _NKZTextOut = _this select 3;
  71. _NKZvech = _this select 4;
  72.  
  73.  
  74. ; checks to ensure both parameters (#1 & #2) have been set
  75. if ((isNil "_NKZmarker") or(isNil "_NKZdistance")) then {goto "ParaError"};
  76.  
  77.  
  78. ; checks to see if text exist, if not flag as such so no hint will show
  79.  
  80. ; checks for inside zone text
  81. if (isNil "_NKZTextIn") then {_inflag = 0};
  82. if (!isNil "_NKZTextIn") then {_inflag = 1};
  83.  
  84. ; checks for outside zone text
  85. if (isNil "_NKZTextOut") then {_outflag = 0};
  86. if (!isNil "_NKZTextOut") then {_outflag = 1};
  87.  
  88.  
  89. ; check for vechile protection here - if missing, set to 'off'
  90. if (isNil "_NKZvech") then {_NKZvech = 0};
  91. if (_NKZvech == 0) then {_vp="Vehicle Protection Is: *Off*"};
  92. if (_NKZvech == 1) then {_vp="Vehicle Protection Is: *On*"};
  93.  
  94. ; startup notice
  95. ;systemchat format ["No Kill Zone Script v%2 Active For '%1'",_NKZmarker, _NKZver];
  96. ;systemchat format ["--- %1 ---",_vp];
  97.  
  98. ; start the checking here
  99. #LoopHere
  100.  
  101. _objcoords = getMarkerPos _NKZmarker;
  102. _getdistance = player distance _objcoords;
  103.  
  104. if (_getdistance <= _NKZdistance) then {goto "InsideTheZone"};
  105. if (_getdistance > _NKZdistance) then {goto "OutsideTheZone"};
  106. goto "LoopHere";
  107.  
  108.  
  109. ; comes here if player is inside the set zone
  110. #InsideTheZone
  111. if (_NKZflag == 9) then {_NKZflag = 0};
  112. if (_NKZflag == 0) then {player allowdamage false};
  113. if ((_NKZflag == 0) && (_NKZvech == 1)) then {vehicle player allowdamage false};
  114. if ((_NKZflag == 0) && (_inflag == 1)) then {hint _NKZTextIn};
  115. _NKZflag = 1;
  116. goto "LoopHere";
  117.  
  118.  
  119. ; comes here if player is outside the set zone
  120. #OutsideTheZone
  121. if (_NKZflag == 9) then {goto "LoopHere"};
  122. if (_NKZflag == 1) then {player allowdamage true};
  123. if ((_NKZflag == 1) && (_NKZvech == 1)) then {vehicle player allowdamage true};
  124. if ((_NKZflag == 1) && (_outflag == 1)) then {hint _NKZTextOut};
  125. _NKZflag = 0;
  126. goto "LoopHere";
  127.  
  128. ; comes here if the params are not set
  129. #ParaError
  130. 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];
  131. goto "ExitHere";
  132.  
  133. ; master exit point
  134. #ExitHere
  135.  
  136. ; ********************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement