fnc_jammersServerPFH.sqf 819 B

1234567891011121314151617181920212223242526272829
  1. params["_args", "_handle"];
  2. if(!isServer) exitWith {
  3. diag_log "Exiting Jammer Server PFH :: Not Server";
  4. [_handle] call CBA_fnc_removePerFrameHandler;
  5. };
  6. private _jammers = missionNamespace getVariable ["rd501_jammers",[]];
  7. {
  8. _x params["_jammer", "_radius", "_strength", "_jipId", "_active"];
  9. if(_jammer isEqualTo objNull || !(alive _jammer)) then {
  10. diag_log format["Removing Jammer %1",_jammer];
  11. _jammers set [_foreachIndex, []];
  12. if(_jipId != -1) then {
  13. [_jipId] call CBA_fnc_removeGlobalEventJIP;
  14. };
  15. };
  16. } forEach _jammers;
  17. _jammers = _jammers - [[]];
  18. missionNamespace setVariable ["rd501_jammers", _jammers, true];
  19. if(count _jammers == 0) exitWith {
  20. diag_log "Exiting Jammer Server PFH";
  21. ["rd501_clearAllJammers", []] call CBA_fnc_globalEvent;
  22. [_handle] call CBA_fnc_removePerFrameHandler;
  23. };