fnc_jammersServerPFH.sqf 802 B

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