fnc_jammersServerPFH.sqf 682 B

1234567891011121314151617181920212223242526
  1. params["_args", "_handle"];
  2. if(!isServer) exitWith {
  3. [_handle] call CBA_fnc_removePerFrameHandler;
  4. };
  5. _jammers = missionNamespace getVariable ["rd501_jammers",[]];
  6. _toRemoveIndexes = [];
  7. {
  8. _x params["_jammer", "_radius", "_strength"];
  9. _jipId = _jammer getVariable ["rd501_jammer_jipId", -1];
  10. if!(alive _jammer) then { _toRemoveIndexes append [[_foreachIndex, _jipId]]};
  11. } forEach _jammers;
  12. {
  13. _x params["_index", "_jipId"];
  14. _jammers deleteAt _index;
  15. [_jipId] call CBA_fnc_removeGlobalEventJIP;
  16. } forEach _toRemoveIndexes;
  17. missionNamespace setVariable ["rd501_jammers", _jammers, true];
  18. if(count _jammers == 0) exitWith {
  19. [_handle] call CBA_fnc_removePerFrameHandler;
  20. };