Advertisement
Guest User

fn_handleDamage.sqf

a guest
May 17th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_handleDamage.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Handles damage, specifically for handling the 'tazer' pistol and nothing else.
  8. */
  9. private["_unit","_damage","_source","_projectile","_part","_curWep"];
  10. _unit = _this select 0;
  11. _part = _this select 1;
  12. _damage = _this select 2;
  13. _source = _this select 3;
  14. _projectile = _this select 4;
  15.  
  16. //Handle the tazer first (Top-Priority).
  17. if (!isNull _source) then {
  18. if (_source != _unit) then {
  19. if (_unit getVariable["Revive",false]) exitWith {};
  20. _curWep = currentWeapon _source;
  21. if (_projectile in ["26_cartridge"] && _curWep in ["Taser_26"]) then {
  22. if (side _source isEqualTo west && playerSide isEqualTo civilian) then {
  23. private["_distance"];
  24. _distance = if (_projectile == "26_cartridge") then {100} else {35};
  25. _damage = false;
  26. if (_unit distance _source < _distance) then {
  27. if (!life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
  28. if (vehicle player != player) then {
  29. if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
  30. player action ["Eject",vehicle player];
  31. [_unit,_source] spawn life_fnc_tazed;
  32. };
  33. } else {
  34. [_unit,_source] spawn life_fnc_tazed;
  35. };
  36. };
  37. };
  38. };
  39.  
  40. //Temp fix for super tasers on cops.
  41. if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
  42. _damage = false;
  43. };
  44. };
  45. };
  46. };
  47.  
  48. if ((vehicle _unit) isKindOf "Car" && (isNull _source || _source isEqualTo _unit)) then
  49. {
  50. _damage = if (life_seatbelt) then { _damage / 2 } else { _damage};
  51. };
  52.  
  53. if(vehicle _source isKindOf "LandVehicle") then {
  54. if(_source != _unit AND {alive _unit} AND {isPlayer _source}) then {
  55. _damage = 0;
  56. };
  57. };
  58.  
  59. [] spawn life_fnc_hudUpdate;
  60. _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement