Guest User

fn_handleDamage.sqf

a guest
Feb 27th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 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. params [
  10. ["_unit",objNull,[objNull]],
  11. ["_part","",[""]],
  12. ["_damage",0,[0]],
  13. ["_source",objNull,[objNull]],
  14. ["_projectile","",[""]],
  15. ["_index",0,[0]]
  16. ];
  17.  
  18. if (!isNull _source && {_source != _unit}) then {
  19. if (side _source isEqualTo west) then {
  20. if (currentWeapon _source in ["hgun_P07_snds_F","arifle_SDAR_F"] && _projectile in ["B_9x21_Ball","B_556x45_dual"]) then {
  21. if (alive _unit) then {
  22. if (playerSide isEqualTo civilian && {!life_is_tazed}) then {
  23. private _distance = 35;
  24. if (_projectile isEqualTo "B_556x45_dual") then {_distance = 100};
  25. if (_unit distance _source < _distance) then {
  26. if !(isNull objectParent _unit) then {
  27. if (typeOf (vehicle _unit) isEqualTo "B_Quadbike_01_F") then {
  28. _unit action ["Eject",vehicle _unit];
  29. [_unit,_source] spawn life_fnc_tazed;
  30. };
  31. } else {
  32. [_unit,_source] spawn life_fnc_tazed;
  33. };
  34. };
  35. };
  36. _damage = if (_part isEqualTo "") then {
  37. damage _unit;
  38. } else {
  39. _unit getHit _part;
  40. };
  41. };
  42. };
  43. };
  44. };
  45.  
  46. //--- Crashed Vehicle
  47. if ( vehicle _unit isKindOf "Car" && { isNull _source } || { _source isEqualTo _unit } ) then {
  48.  
  49. //--- Seatbelt on
  50. if ( IRT_SeatBelt ) then {
  51.  
  52. //--- Divide Damage in Half
  53. _damage = _damage / 2;
  54.  
  55. //--- Take SeatBelt Off
  56. IRT_SeatBelt = false;
  57.  
  58. };
  59.  
  60. };
  61.  
  62. [] spawn life_fnc_hudUpdate;
  63. _damage;
Add Comment
Please, Sign In to add comment