Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. // initialize triggers on server
  2. {
  3.     if (_x isKindOf "EmptyDetector") then {_trgs = _trgs + [_x]}
  4. } forEach synchronizedObjects _logic;
  5.  
  6. _logic setVariable ["triggers", _trgs, TRUE];
  7.  
  8. // Trigger Check
  9. _trgs = [];
  10.  
  11. {
  12.     if (triggerActivated _x) then {_trgs = _trgs + [_x]};
  13. } forEach (_logic getVariable "triggers");
  14.  
  15. {
  16.     _who = _x;
  17.     if (local _who && alive _who && time > ((_who getVariable "BIS_zoneRest_timeout") + 2) && (if (_inverse) then {{vehicle _who in list _x} count _trgs > 0} else {{vehicle _who in list _x} count _trgs == 0}) && !(_who getVariable "BIS_deserter") && (if (_airExcluded && vehicle _who isKindOf "Air") then {FALSE} else {TRUE})) then {
  18.         if (isPlayer _x) then {_x call _effectWarning};
  19.         _x setVariable ["BIS_deserter", TRUE];
  20.         [_x, _warningTime, _inverse, _trgs, _effectPunishment, _airExcluded] spawn {
  21.             _deserter = _this select 0;
  22.             _warningTime = _this select 1;
  23.             _inverse = _this select 2;
  24.             _trgs = _this select 3;
  25.             _effectPunishment = _this select 4;
  26.             _airExcluded = _this select 5;
  27.             _t = time;
  28.             while {time < _t + _warningTime && (if (_inverse) then {{vehicle _deserter in list _x} count _trgs > 0} else {{vehicle _deserter in list _x} count _trgs == 0}) && (if (_airExcluded && vehicle _deserter isKindOf "Air") then {FALSE} else {TRUE})} do {
  29.                 sleep 1
  30.             };
  31.             if (time >= _t + _warningTime) then {_deserter call _effectPunishment} else {_deserter setVariable ["BIS_deserter", FALSE]};
  32.         };
  33.     };            
  34. } forEach (_logic getVariable "BIS_ZR_unitsList");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement