Advertisement
Brord

player_death.sqf

Feb 19th, 2015
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. private ["_display","_body","_playerID","_array","_source","_method","_canHitFree","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup"];
  2. disableSerialization;
  3. if (deathHandled) exitWith {};
  4. deathHandled = true;
  5. if ((alive player) && {isNil {dayz_playerName}}) then {
  6. dayz_playerName = name player;
  7. };
  8. //Prevent client freezes
  9. _display = findDisplay 49;
  10. if(!isNull _display) then {_display closeDisplay 0;};
  11. if (dialog) then {closeDialog 0;};
  12. if (visibleMap) then {openMap false;};
  13.  
  14. _body = player;
  15. _playerID = [player] call FNC_GetPlayerUID;
  16.  
  17. disableUserInput true;
  18. //add weapon on back to player...
  19. //if (dayz_onBack != "") then {
  20. // _body addWeapon dayz_onBack;
  21. //};
  22.  
  23. _infected = 0;
  24. if (r_player_infected && DZE_PlayerZed) then {
  25. _infected = 1;
  26. };
  27. PVDZE_plr_Died = [dayz_characterID,0,_body,_playerID,_infected, dayz_playerName];
  28. publicVariableServer "PVDZE_plr_Died";
  29.  
  30. _id = [player,20,true,getPosATL player] call player_alertZombies;
  31.  
  32. sleep 0.5;
  33.  
  34. player setDamage 1;
  35. player setVariable ["NORRN_unconscious", false, true];
  36. player setVariable ["unconsciousTime", 0, true];
  37. player setVariable ["USEC_isCardiac",false,true];
  38. player setVariable ["medForceUpdate",true,true];
  39. player setVariable ["startcombattimer", 0];
  40. r_player_unconscious = false;
  41. r_player_cardiac = false;
  42.  
  43. _array = _this;
  44. if (count _array > 0) then {
  45. _source = _array select 0;
  46. _method = _array select 1;
  47. if ((!isNull _source) && (_source != player)) then {
  48. _canHitFree = player getVariable ["freeTarget",false];
  49. _isBandit = (player getVariable["humanity",0]) <= -2000;
  50. _punishment = _canHitFree || _isBandit; //if u are bandit || start first - player will not recieve humanity drop
  51. _humanityHit = 0;
  52. if (!_punishment) then {
  53. //i'm "not guilty" - kill me && be punished
  54. _myKills = ((player getVariable ["humanKills",0]) / 30) * 1000;
  55. _humanityHit = -(2000 - _myKills);
  56. _kills = _source getVariable ["humanKills",0];
  57. _source setVariable ["humanKills",(_kills + 1),true];
  58. PVDZE_send = [_source,"Humanity",[_source,_humanityHit,300]];
  59. publicVariableServer "PVDZE_send";
  60. } else {
  61. //i'm "guilty" - kill me as bandit
  62. _killsV = _source getVariable ["banditKills",0];
  63. _source setVariable ["banditKills",(_killsV + 1),true];
  64. };
  65. };
  66. _body setVariable ["deathType",_method,true];
  67. };
  68.  
  69. terminate dayz_musicH;
  70. terminate dayz_slowCheck;
  71. terminate dayz_animalCheck;
  72. terminate dayz_monitor1;
  73. terminate dayz_medicalH;
  74. terminate dayz_gui;
  75.  
  76. r_player_dead = true;
  77.  
  78. "dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [4]; "dynamicBlur" ppEffectCommit 0.2;
  79.  
  80. "colorCorrections" ppEffectEnable true;
  81. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 0.01], [1, 1, 1, 0.0]];
  82. "colorCorrections" ppEffectCommit 1;
  83.  
  84. //Player is Dead!
  85. sleep 1;
  86.  
  87. dayz_originalPlayer enableSimulation true;
  88.  
  89. addSwitchableUnit dayz_originalPlayer;
  90. setPlayable dayz_originalPlayer;
  91. selectPlayer dayz_originalPlayer;
  92.  
  93. //_myGroup = group _body;
  94. //[_body] joinSilent dayz_firstGroup;
  95. //deleteGroup _myGroup;
  96.  
  97. 3 cutRsc ["default", "PLAIN",3];
  98. 4 cutRsc ["default", "PLAIN",3];
  99.  
  100. _body setVariable["combattimeout", 0, true];
  101.  
  102. sleep 2;
  103.  
  104. 100 cutRsc ["DeathScr","BLACK OUT",3];
  105.  
  106. playSound "deathscreen";
  107.  
  108. "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5;
  109. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1], [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5;
  110.  
  111. sleep 2;
  112.  
  113. for "_x" from 5 to 1 step -1 do {
  114. titleText [format[localize "str_return_lobby", _x], "PLAIN DOWN", 1];
  115. sleep 1;
  116. };
  117.  
  118. PVDZE_Server_Simulation = [_body, false];
  119. publicVariableServer "PVDZE_Server_Simulation";
  120.  
  121. endMission "END1";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement