Advertisement
corbuhh

Chernarus Infi SafeZones

Apr 25th, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.87 KB | None | 0 0
  1. fnc_infiSTAR_SafeZone =
  2. {
  3. _infiSZ =
  4. [
  5. [[6325.6772,7807.7412],200,true]
  6. ,[[4063.4226,11664.19],200,true]
  7. ,[[11447.472,11364.504],200,true]
  8. ,[[1606.6443,7803.5156],150,true]
  9. ,[[12944.227,12766.889],150,true]
  10. ,[[12060.471,12638.533],350,true]
  11. ,[[4058.42,10792.62],20,false]
  12. ,[[13532.4,6356.52],60,false]
  13. ,[[13466.8,5439.51],60,false]
  14. ,[[7998.39,2899.04],60,false]
  15. ,[[4359.92,2259.39],60,false]
  16. ,[[3708.5974,5970.499],315,true]
  17. ];
  18. if (isServer) exitWith
  19. {
  20. _signs = true;
  21. {
  22. _center = _x select 0;
  23. _radius = _x select 1;
  24. _lSign = _x select 2;
  25. if (_signs && _lSign) then
  26. {
  27. for '_i' from 0 to 360 step (270 / _radius)*2 do
  28. {
  29. _location = [(_center select 0) + ((cos _i) * _radius), (_center select 1) + ((sin _i) * _radius),0];
  30. _dir = ((_center select 0) - (_location select 0)) atan2 ((_center select 1) - (_location select 1));
  31.  
  32. _object = createVehicle ['SignM_FARP_Winchester_EP1', _location, [], 0, 'CAN_COLLIDE'];
  33. _object setDir _dir;
  34. _object setVehicleInit 'this setObjectTexture [0, ''Addons\SafeZones\sign.paa''];';
  35. };
  36. };
  37. } forEach _infiSZ;
  38. };
  39. waitUntil { !isNil 'dayz_animalCheck' };
  40. if (isNil 'inSafezone') then {inSafezone = false;};
  41. [_infiSZ] spawn {
  42. _infiSZ = _this select 0;
  43. startSafeZone =
  44. {
  45. if (isNil 'outNow') then
  46. {
  47. hint 'You entered a Safe Zone!';
  48. taskHint ['You entered a Safe Zone!', [0,1,0,1], 'taskDone'];
  49. inNow = nil;
  50. outNow = true;
  51. };
  52. player_fired = { deleteVehicle (nearestObject [_this select 0,_this select 4]); };
  53. player_zombieCheck = {};
  54. fnc_usec_damageHandler = {};
  55. fnc_usec_unconscious = {};
  56. object_monitorGear = {};
  57. player removeAllEventHandlers 'handleDamage';
  58. player addEventHandler ['handleDamage', {false}];
  59. player allowDamage false;
  60. if (vehicle player != player) then
  61. {
  62. _vehObj = vehicle player;
  63. _vehObj removeAllEventHandlers 'Fired';
  64. _vehObj addEventHandler ['Fired', {_this call player_fired;}];
  65. };
  66. };
  67. endSafeZone =
  68. {
  69. if (isNil 'inNow') then
  70. {
  71. hint 'You left the Safe Zone!';
  72. taskHint ['You left the Safe Zone!', [1,0,0.1,1], 'taskFailed'];
  73. inNow = true;
  74. outNow = nil;
  75. };
  76. player_fired = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_fired.sqf';
  77. player_zombieCheck = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_zombieCheck.sqf';
  78. fnc_usec_damageHandler = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_damageHandler.sqf';
  79. fnc_usec_unconscious = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_unconscious.sqf';
  80. object_monitorGear = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\object_monitorGear.sqf';
  81. player allowDamage true;
  82. player removeAllEventHandlers 'HandleDamage';
  83. player addeventhandler ['HandleDamage',{_this call fnc_usec_damageHandler;} ];
  84. };
  85. while {1 == 1} do
  86. {
  87. _state = false;
  88. _obj = vehicle player;
  89. {
  90. _z = _x select 0;
  91. _r = _x select 1;
  92. if (_obj distance _z < _r) exitWith {_state = true;};
  93. } forEach _infiSZ;
  94. if (_state) then
  95. {
  96. inSafeZone = true;
  97. call startSafeZone;
  98.  
  99. {
  100. if (!isNull _x) then
  101. {
  102. if !(isPlayer _x) then
  103. {
  104. deletevehicle _x;
  105. };
  106. };
  107. } forEach (_obj nearEntities ['zZombie_Base',15]);
  108. }
  109. else
  110. {
  111. inSafeZone = false;
  112. };
  113. _plr = player;
  114. sleep 2;
  115. if (!(inSafeZone) || (_plr != player)) then
  116. {
  117. call endSafeZone;
  118. };
  119. };
  120. };
  121. [] spawn {
  122. while {1 == 1} do
  123. {
  124. if (inSafezone) then
  125. {
  126. _cnt = {isPlayer _x && _x != player} count (player nearEntities [['CAManBase'], 2]);
  127. if ((_cnt > 0) && (!isNull (findDisplay 106))) then
  128. {
  129. (findDisplay 106) closedisplay 0;
  130. _log = format['%1 You are not allowed to open Gear while near another player!',name player];
  131. cutText [_log,'PLAIN'];
  132. hint _log;
  133. };
  134. }
  135. else
  136. {
  137. sleep 2;
  138. };
  139. sleep 0.1;
  140. };
  141. };
  142. };
  143. [] spawn fnc_infiSTAR_SafeZone;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement