jam_sandwich.sqf 774 B

1234567891011121314151617181920212223242526272829303132333435
  1. params[
  2. ["_jammer",objNull ,[player]]
  3. ];
  4. if(isNull _jammer) exitWith {
  5. };
  6. if (!hasInterface) exitwith {};
  7. waituntil {!isnull player};
  8. _rad = param [1, 1000, [0]];
  9. _strength = param [2, 400, [0]] - 1;
  10. while {alive _jammer} do
  11. {
  12. _dist = player distance _jammer;
  13. _distPercent = _dist / _rad;
  14. _interference = 1;
  15. if (_dist < _rad) then {
  16. _interference = _strength - (_distPercent * _strength) + 1;
  17. };
  18. player setVariable ["tf_receivingDistanceMultiplicator", _interference];
  19. player setVariable ["tf_transmittingDistanceMultiplicator", _interference];
  20. };
  21. {
  22. player setVariable ["tf_receivingDistanceMultiplicator", 1];
  23. player setVariable ["tf_transmittingDistanceMultiplicator", 1];
  24. }forEach units group player;