Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. /*
  2. File: fn_handleDamage.sqf
  3. Author: Bryan "Tonic" Boardwine
  4.  
  5. Description:
  6. Handles damage, specifically for handling the 'tazer' pistol and nothing else.
  7. */
  8. private["_unit","_damage","_source","_projectile","_part","_curWep","_vehSpeed","_isVehicle"];
  9. _unit = _this select 0;
  10. _part = _this select 1;
  11. _damage = _this select 2;
  12. _source = _this select 3;
  13. _projectile = _this select 4;
  14. _vehSpeed = speed _unit;
  15.  
  16. //Internal Debugging.
  17. if(!isNil "TON_Debug") then {
  18. systemChat format["PART: %1 || DAMAGE: %2 || SOURCE: %3 || PROJECTILE: %4 || FRAME: %5",_part,_damage,_source,_projectile,diag_frameno];
  19. };
  20.  
  21. //Handle the tazer first (Top-Priority).
  22. if(!isNull _source) then {
  23. if(_source != _unit) then {
  24. _curWep = currentWeapon _source;
  25. if(_projectile in ["B_9x21_Ball","B_556x45_dual"] && _curWep in ["hgun_P07_snds_F","arifle_SDAR_F"]) then {
  26. if(side _source == west && playerSide != west) then {
  27. private["_distance","_isVehicle","_isQuad"];
  28. _distance = if(_projectile == "B_556x45_dual") then {100} else {35};
  29. _isVehicle = if(vehicle player != player) then {true} else {false};
  30. _isQuad = if(_isVehicle) then {if(typeOf (vehicle player) == "B_Quadbike_01_F") then {true} else {false}} else {false};
  31.  
  32. _damage = false;
  33. if(_unit distance _source < _distance) then {
  34. if(!life_istazed && !(_unit getVariable["restrained",false])) then {
  35. if(_isVehicle && _isQuad) then {
  36. player action ["Eject",vehicle player];
  37. [_unit,_source] spawn life_fnc_tazed;
  38. } else {
  39. [_unit,_source] spawn life_fnc_tazed;
  40. };
  41. };
  42. };
  43. };
  44.  
  45. //Temp fix for super tasers on cops.
  46. if(playerSide == west && side _source == west) then {
  47. _damage = false;
  48. };
  49. };
  50. };
  51.  
  52. // VDM check
  53. _isVehicle = if(vehicle _source != _source) then {true} else {false};
  54. _vehSpeed = speed _source;
  55. if((_isVehicle) && (_vehSpeed < 35)) then {_damage = false;}
  56. if(side _source != west && _source != _unit) then
  57. {
  58. [[getPlayerUID _source,_source getVariable["realname",name _source],"187V"],"life_fnc_wantedAdd",false,false] spawn life_fnc_MP;
  59. [[0,format["%1 was just run over by %2. You are now Wanted",_unit getVariable["realname",name _unit],_source getVariable["realname",name _source]]],"life_fnc_broadcast",true,false] spawn life_fnc_MP;
  60. };
  61. };
  62.  
  63. [] call life_fnc_hudUpdate;
  64. _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement