Advertisement
Gnashes

.sqf Example

Jun 10th, 2015
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. /*
  2. File: fn_handleDamage.sqf
  3. Author: John "Paratus" VanderZwet & Skalicon
  4.  
  5. Description:
  6. Handles special damage events
  7. */
  8. private["_unit","_damage","_source","_projectile","_hitBox","_curWep","_driver","_luck","_doBreak"];
  9. _unit = _this select 0;
  10. _hitBox = _this select 1;
  11. _damage = _this select 2;
  12. _source = _this select 3;
  13. _projectile = _this select 4;
  14. _curWep = "";
  15. _curMag = "";
  16.  
  17. //diag_log format["%1, %2, %3, %4, %5, %6, %7", _unit, _hitBox, _damage, _source, _projectile, _unit getVariable["restrained",false],_unit getVariable["isCivRestrained",false]];
  18. if(isPlayer _source && _source isKindOf "Man") then {
  19. _curWep = currentWeapon _source;
  20. _curMag = currentMagazine _source;
  21. };
  22.  
  23. // Prison and court!
  24. if (life_is_arrested || !isNil "life_jury_active") then
  25. {
  26. _damage = 0;
  27. };
  28.  
  29. // Stun grenades
  30. if (_projectile in ["mini_Grenade"]) then{
  31. _damage = 0;
  32. [] spawn life_fnc_handleFlashbang;
  33. };
  34.  
  35. //rubber bullets or vehicle death
  36. if ((((_curMag in ["30Rnd_65x39_caseless_mag_Tracer","30Rnd_45ACP_Mag_SMG_01_Tracer_Green"]) || (_curWep in ["SMG_02_F","hgun_P07_F","hgun_P07_snds_F"])) && (_projectile in ["B_65x39_Caseless","B_9x21_Ball","B_45ACP_Ball"])) OR (side _source == west && "acc_pointer_IR" in (primaryWeaponItems _source))) then {
  37. if ((((getDammage _unit) + _damage) >= 0.90) || (_damage >= 0.95)) then {
  38. _damage = 0;
  39. [_source] spawn life_fnc_handleDowned;
  40. };
  41. };
  42.  
  43. /* //IR Laser non-lethal
  44. if(side _source == west && "acc_pointer_IR" in (primaryWeaponItems _source)) then
  45. {
  46. if ((((getDammage _unit) + _damage) >= 0.90) || (_damage >= 0.95)) then {
  47. _damage = 0;
  48. [_source] spawn life_fnc_handleDowned;
  49. };
  50. }; */
  51.  
  52. //laser tag'd!
  53. if (life_laser_inprogress) then
  54. {
  55. if (((((getDammage _unit) + _damage) >= 0.95) || (_damage >= 0.95)) && ((player getVariable ["laserTeam",0]) != (_source getVariable ["laserTeam",0]))) then
  56. {
  57. [_source] spawn life_fnc_handleTagged;
  58. };
  59. _damage = 0;
  60. };
  61.  
  62. if ((vehicle _source isKindOf "LandVehicle") && _source != _unit && driver (vehicle _source) == _source && vehicle _unit == _unit) then
  63. {
  64. if ((((getDammage _unit) + _damage) >= 0.95) || (_damage >= 0.95)) then {
  65. _damage = 0;
  66. if(alive (driver _source) && side (driver _source) != west && (time - life_last_vdm) > 5) then
  67. {
  68. life_last_vdm = time;
  69. serv_killed = [(driver _source),"187V"];
  70. publicVariableServer "serv_killed";
  71. };
  72. };
  73. };
  74.  
  75. if (_damage > 0.4 && (!isPlayer _source || (vehicle _source isKindOf "LandVehicle"))) then
  76. {
  77. if (_hitBox == "legs") then {
  78. _doBreak = true;
  79. if (47 in life_talents) then
  80. {
  81. _luck = floor (random 2);
  82. if (_luck == 0) exitWith {systemChat "Someone less hardy could have been seriously injured.";_doBreak = false;};
  83. };
  84. if (_doBreak) then { [true] spawn life_fnc_brokenLeg; };
  85. };
  86. };
  87.  
  88. if ((_unit getVariable ["restrained",false]) && !(_unit getVariable ["isCivRestrained",false]) && (isPlayer _source) && (vehicle _unit != vehicle _source) && !(_projectile in ["HandGrenade"])) then
  89. {
  90. _damage = 0;
  91. };
  92.  
  93. [] call life_fnc_hudUpdate;
  94. _damage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement