Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 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. SAFETY_ZONES = getArray(missionConfigFile >> "Life_Settings" >> "safety_zones");
  10.  
  11. params [
  12. ["_unit",objNull,[objNull]],
  13. ["_part","",[""]],
  14. ["_damage",0,[0]],
  15. ["_source",objNull,[objNull]],
  16. ["_projectile","",[""]],
  17. ["_index",0,[0]]
  18. ];
  19.  
  20. //FAV REVIVE TEST
  21. if ((vehicle _unit == _unit) && (!isNull _source) && (_source != vehicle _source)) then
  22. {
  23. _damage = 0.3;
  24. {
  25. if((_x distance player) < 50) then {_player pushBack _x;};
  26. } foreach playableUnits;
  27. [[player,"amovppnemstpsraswrfldnon"],"life_fnc_animSync",_player,false] spawn life_fnc_MP;
  28. } else {
  29. if(!(_projectile in ["B_9x21_Ball","B_556x45_dual"] && currentWeapon _source in ["hgun_P07_snds_F","arifle_SDAR_F"])) then {
  30. _isUnconscious = _unit getVariable "FAR_isUnconscious";
  31. if(_part in ["hands","legs"] && _damage > 2.5) then {
  32. player setVariable ["brokenBone",true,true];
  33. player say3D "breakBone";
  34. };
  35. if (alive _unit && _damage >= 0.9 && _isUnconscious == 0 && _part in ["","head","body"]) then
  36. {
  37. if(_part in ["head",""] && (isNil "_source" || isNull _source)) exitWith {_damage = 0.7;};
  38. _unit setDamage 0;
  39. _unit allowDamage false;
  40. _damage = 0.75;
  41.  
  42. [_unit, _source] spawn FAR_Player_Unconscious;
  43. };
  44. };
  45. };
  46.  
  47. //Handle the tazer first (Top-Priority).
  48. if (!isNull _source) then {
  49. if (_source != _unit) then {
  50. if (currentWeapon _source in ["hgun_P07_snds_F","arifle_SDAR_F","arifle_Mk20C_plain_F"] && _projectile in ["B_9x21_Ball","B_556x45_dual","B_556x45_Ball"]) then {
  51. if (((side _source isEqualTo west) || (side _source isEqualTo independent)) && playerSide isEqualTo civilian) then {
  52. _damage = 0;
  53. if (alive player && !life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
  54. private ["_distance"];
  55. _distance = 35;
  56. if (_projectile == "B_556x45_dual") then {_distance = 100;};
  57. if (_unit distance _source < _distance) then {
  58. if !(isNull objectParent player) then {
  59. if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
  60. player action ["Eject",vehicle player];
  61. [_unit,_source] spawn life_fnc_tazed;
  62. };
  63. } else {
  64. [_unit,_source] spawn life_fnc_tazed;
  65. };
  66. };
  67. };
  68. };
  69.  
  70. //Temp fix for super tasers on cops.
  71. if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
  72. _damage = 0;
  73. };
  74. };
  75. };
  76. };
  77.  
  78. //Safezone
  79. if ({player distance getMarkerPos (_x select 0) < (_x select 1)} count SAFETY_ZONES > 0) then { _damage = 0 };
  80.  
  81. //CarKill
  82. if (vehicle _unit == _unit) then
  83. {
  84. if (!( _source isKindOf "Air" OR _source isKindOf "Car" OR _source isKindOf "Boat")) then
  85. {
  86. if ((vehicle _source) isKindOf "Air" OR (vehicle _source) isKindOf "Car" OR (vehicle _source) isKindOf "Boat") then
  87. {
  88. _damage = 0.001;
  89. [[player,"amovppnemstpsraswrfldnon"],"life_fnc_animSync",true,false] spawn life_fnc_MP;
  90. };
  91. };
  92. };
  93.  
  94. if ((vehicle _unit) isKindOf "Car" && (isNull _source || _source isEqualTo _unit)) then
  95. {
  96. _damage = if (life_seatbelt) then { _damage / 2 } else { _damage};
  97. };
  98.  
  99. [] spawn life_fnc_hudUpdate;
  100. _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement