fnc_jammersServerPFH.sqf 749 B

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