Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. #include <macro.h>
  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. private["_unit","_damage","_source","_projectile","_part","_curWep","_killerInVehicle"];
  10. _unit = SEL(_this,0);
  11. _part = SEL(_this,1);
  12. _damage = SEL(_this,2);
  13. _source = SEL(_this,3);
  14. _projectile = SEL(_this,4);
  15. _killerInVehicle = vehicle _source;
  16. //allowedvehicles[] = {"DAR_MaxxPro_M2","B_G_Offroad_01_armed_F","rhsusf_M1083A1P2_B_M2_d_fmtv_usarmy","EWK_m1151_m240_deployment","EWK_m1151_m2_deployment_Jtac","EWK_m1151_m2_deployment_Bumper","EWK_M998A2_sov_M2","DAR_MaxxProDeploy","DAR_MaxxProDXM","rhsusf_M1083A1P2_B_M2_d_fmtv_usarmy","B_APC_Wheeled_01_cannon_","B_APC_Tracked_01_rcws_F","B_APC_Tracked_01_CRV_F","B_MRAP_01_hmg_F","B_MRAP_01_gmg_F","RHS_M2A3_BUSKIII","rhsusf_m1a1aim_tuski_d","rhs_prp3_vdv","rhs_btr80_msv","rhs_t80b"};
  17.  
  18. //Handle the tazer first (Top-Priority).
  19. if(!isNull _source) then {
  20. if(_source != _unit) then {
  21. _curWep = currentWeapon _source;
  22. if(_projectile in ["DDOPP_B_Taser","B_9x21_Ball","B_556x45_dual"] && _curWep in ["DDOPP_X26","hgun_P07_snds_F","arifle_SDAR_F"]) then {
  23. if(side _source == west && playerSide != west) then {
  24. private["_distance","_isVehicle","_isQuad"];
  25. _distance = if(_projectile == "B_556x45_dual") then {100} else {35};
  26. _isVehicle = if(vehicle player != player) then {true} else {false};
  27. _isQuad = if(_isVehicle) then {if(typeOf (vehicle player) == "B_Quadbike_01_F") then {true} else {false}} else {false};
  28.  
  29. _damage = false;
  30. if(_unit distance _source < _distance) then {
  31. if(!life_istazed && !(_unit GVAR ["restrained",false])) then {
  32. if(_isVehicle && _isQuad) then {
  33. player action ["Eject",vehicle player];
  34. [_unit,_source] spawn life_fnc_tazed;
  35. } else {
  36. [_unit,_source] spawn life_fnc_tazed;
  37. };
  38. };
  39. };
  40. };
  41.  
  42. //Temp fix for super tasers on cops.
  43. if(playerSide == west && side _source == west) then {
  44. _damage = false;
  45. };
  46. };
  47. //diag_log format["_killerInVehicle %1",_killerInVehicle];
  48. if(_killerInVehicle isKindOf "Car" OR _killerInVehicle isKindOf "Truck") exitWith {
  49. _damage = 0.7;
  50. [[player,"AmovPercMstpSnonWnonDnon_AmovPercMstpSrasWrflDnon",true],"life_fnc_animSync",true,false] call life_fnc_MP;
  51. player switchMove "AmovPercMstpSnonWnonDnon_AmovPercMstpSrasWrflDnon";
  52. player playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSrasWrflDnon";
  53. //[[1,"STR_ISTR_Bolt_vdm1",true,[name _source]],"life_fnc_broadcast",player,false] call life_fnc_MP;
  54. };
  55. //Rubber bullets
  56. if(_projectile in ["B_9x21_Ball"] && _curWep in ["SMG_02_F","SMG_02_ACO_F","SMG_02_ARCO_pointg_F"]) then {
  57. //copied from taser source
  58. if(side _source == west && playerSide != west) then {
  59. private["_distance","_isVehicle","_isQuad"];
  60. _isVehicle = if(vehicle player != player) then {true} else {false};
  61. _damage = false;
  62. _damageHandle = false;
  63. if(_unit distance _source < _distance) then {
  64. if(!life_istazed && !(_unit GVAR ["restrained",false])) then {
  65. if(_isVehicle && _isQuad) then {
  66. player action ["Eject",vehicle player];
  67. [_unit,_source] spawn life_fnc_knockedOut;
  68. } else {
  69. [_unit,_source] spawn life_fnc_knockedOut;
  70. };
  71. };
  72. };
  73. if(!(_isVehicle && !life_istazed)) then {
  74. //Copy a knocking out function instead of using the tazing function on the server
  75. [player,"Rubber Bullet",true] spawn life_fnc_knockedOut;
  76. };
  77. };
  78.  
  79. //Change _damagae = true to false if you do not want cops to kill eachother with these. _damagaHandle is being used also so they take no damage aswell.
  80. if(playerSide == west && side _source == west) then {
  81. _damage = false;
  82. _damageHandle = false;
  83. };
  84. };
  85. };
  86. };
  87.  
  88. [] call life_fnc_hudUpdate;
  89. _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement