SHARE
TWEET

Untitled

a guest Mar 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. //Handle the tazer first (Top-Priority).
  19. if (!isNull _source) then {
  20.     if (_source != _unit) then {
  21.         if (currentWeapon _source in ["hgun_P07_snds_F","arifle_SDAR_F"] && _projectile in ["B_9x21_Ball","B_556x45_dual"]) then {
  22.             if (side _source isEqualTo west && playerSide isEqualTo civilian) then {
  23.                 _damage = 0;
  24.                 if (alive player && !life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
  25.                     private ["_distance"];
  26.                     _distance = 35;
  27.                     if (_projectile == "B_556x45_dual") then {_distance = 100;};
  28.                     if (_unit distance _source < _distance) then {
  29.                         if !(isNull objectParent player) then {
  30.                             if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
  31.                                 player action ["Eject",vehicle player];
  32.                                 [_unit,_source] spawn life_fnc_tazed;
  33.                             };
  34.                         } else {
  35.                             [_unit,_source] spawn life_fnc_tazed;
  36.                         };
  37.                     };
  38.                 };
  39.             };
  40.  
  41.             //Temp fix for super tasers on cops.
  42.             if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
  43.                 _damage = 0;
  44.             };
  45.         };
  46.     };
  47. };
  48.  
  49. if(vehicle _source isKindOf "LandVehicle") then {
  50.         if(_source != _unit AND {alive _unit} AND {isPlayer _source}) then {
  51.             _damage = 0.001;
  52.         };
  53.     };
  54.  
  55.         if ((isPlayer _source) && (vehicle _source != _source)) then {
  56.             if(_part == "body" && (player getVariable["limit",true]) && (side _source == civilian)) then {
  57.                 player setVariable ["limit",false];
  58.                     [_source] spawn {
  59.                     _driver = _this select 0;
  60.                     [0,format["%1 just ran over %2!", name _driver, name player]] remoteExec ["life_fnc_broadcast",0];
  61.                 sleep(10);
  62.                 player setVariable ["limit",true];
  63.             };
  64.         };             
  65.         _damage = getDammage player;
  66.     };
  67.  
  68.     if ((vehicle _unit) isKindOf "Car" && (isNull _source || _source isEqualTo _unit)) then
  69.     {
  70.     _damage = if (life_seatbelt) then { _damage / 2 } else { _damage};
  71. };
  72.  
  73. [] spawn life_fnc_hudUpdate;
  74. _damage;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top