Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "..\..\script_macros.hpp"
- /*
- File: fn_handleDamage.sqf
- Author: Bryan "Tonic" Boardwine
- Description:
- Handles damage, specifically for handling the 'tazer' pistol and nothing else.
- */
- SAFETY_ZONES = getArray(missionConfigFile >> "Life_Settings" >> "safety_zones");
- params [
- ["_unit",objNull,[objNull]],
- ["_part","",[""]],
- ["_damage",0,[0]],
- ["_source",objNull,[objNull]],
- ["_projectile","",[""]],
- ["_index",0,[0]]
- ];
- //FAV REVIVE TEST
- if ((vehicle _unit == _unit) && (!isNull _source) && (_source != vehicle _source)) then
- {
- _damage = 0.3;
- {
- if((_x distance player) < 50) then {_player pushBack _x;};
- } foreach playableUnits;
- [[player,"amovppnemstpsraswrfldnon"],"life_fnc_animSync",_player,false] spawn life_fnc_MP;
- } else {
- if(!(_projectile in ["B_9x21_Ball","B_556x45_dual"] && currentWeapon _source in ["hgun_P07_snds_F","arifle_SDAR_F"])) then {
- _isUnconscious = _unit getVariable "FAR_isUnconscious";
- if(_part in ["hands","legs"] && _damage > 2.5) then {
- player setVariable ["brokenBone",true,true];
- player say3D "breakBone";
- };
- if (alive _unit && _damage >= 0.9 && _isUnconscious == 0 && _part in ["","head","body"]) then
- {
- if(_part in ["head",""] && (isNil "_source" || isNull _source)) exitWith {_damage = 0.7;};
- _unit setDamage 0;
- _unit allowDamage false;
- _damage = 0.75;
- [_unit, _source] spawn FAR_Player_Unconscious;
- };
- };
- };
- //Handle the tazer first (Top-Priority).
- if (!isNull _source) then {
- if (_source != _unit) then {
- 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 {
- if (((side _source isEqualTo west) || (side _source isEqualTo independent)) && playerSide isEqualTo civilian) then {
- _damage = 0;
- if (alive player && !life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
- private ["_distance"];
- _distance = 35;
- if (_projectile == "B_556x45_dual") then {_distance = 100;};
- if (_unit distance _source < _distance) then {
- if !(isNull objectParent player) then {
- if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
- player action ["Eject",vehicle player];
- [_unit,_source] spawn life_fnc_tazed;
- };
- } else {
- [_unit,_source] spawn life_fnc_tazed;
- };
- };
- };
- };
- //Temp fix for super tasers on cops.
- if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
- _damage = 0;
- };
- };
- };
- };
- //Safezone
- if ({player distance getMarkerPos (_x select 0) < (_x select 1)} count SAFETY_ZONES > 0) then { _damage = 0 };
- //CarKill
- if (vehicle _unit == _unit) then
- {
- if (!( _source isKindOf "Air" OR _source isKindOf "Car" OR _source isKindOf "Boat")) then
- {
- if ((vehicle _source) isKindOf "Air" OR (vehicle _source) isKindOf "Car" OR (vehicle _source) isKindOf "Boat") then
- {
- _damage = 0.001;
- [[player,"amovppnemstpsraswrfldnon"],"life_fnc_animSync",true,false] spawn life_fnc_MP;
- };
- };
- };
- if ((vehicle _unit) isKindOf "Car" && (isNull _source || _source isEqualTo _unit)) then
- {
- _damage = if (life_seatbelt) then { _damage / 2 } else { _damage};
- };
- [] spawn life_fnc_hudUpdate;
- _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement