Advertisement
Brord

player_death.sqf

Feb 19th, 2015
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.79 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. 0.1 fadeSound 0;
  36.  
  37. player setVariable ["NORRN_unconscious", false, true];
  38. player setVariable ["unconsciousTime", 0, true];
  39. player setVariable ["USEC_isCardiac",false,true];
  40. player setVariable ["medForceUpdate",true,true];
  41. player setVariable ["startcombattimer", 0];
  42. r_player_unconscious = false;
  43. r_player_cardiac = false;
  44.  
  45. _array = _this;
  46. if (count _array > 0) then {
  47.     _source = _array select 0;
  48.     _method = _array select 1;
  49.     if ((!isNull _source) && (_source != player)) then {
  50.         _canHitFree = player getVariable ["freeTarget",false];
  51.         _isBandit = (player getVariable["humanity",0]) <= -2000;
  52.         _punishment = _canHitFree || _isBandit; //if u are bandit || start first - player will not recieve humanity drop
  53.         _humanityHit = 0;
  54.         if (!_punishment) then {
  55.             //i'm "not guilty" - kill me && be punished
  56.             _myKills = ((player getVariable ["humanKills",0]) / 30) * 1000;
  57.             _humanityHit = -(2000 - _myKills);
  58.             _kills = _source getVariable ["humanKills",0];
  59.             _source setVariable ["humanKills",(_kills + 1),true];
  60.             PVDZE_send = [_source,"Humanity",[_source,_humanityHit,300]];
  61.             publicVariableServer "PVDZE_send";
  62.         } else {
  63.             //i'm "guilty" - kill me as bandit
  64.             _killsV = _source getVariable ["banditKills",0];
  65.             _source setVariable ["banditKills",(_killsV + 1),true];
  66.         };
  67.     };
  68.     _body setVariable ["deathType",_method,true];
  69. };
  70.  
  71. terminate dayz_musicH;
  72. terminate dayz_slowCheck;
  73. terminate dayz_animalCheck;
  74. terminate dayz_monitor1;
  75. terminate dayz_medicalH;
  76. terminate dayz_gui;
  77.  
  78. r_player_dead = true;
  79.  
  80. "dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [4]; "dynamicBlur" ppEffectCommit 0.2;
  81.  
  82. "colorCorrections" ppEffectEnable true;
  83. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 0.01],  [1, 1, 1, 0.0]];
  84. "colorCorrections" ppEffectCommit 1;
  85.  
  86. //Player is Dead!
  87. 3 fadeSound 0;
  88. sleep 1;
  89.  
  90. dayz_originalPlayer enableSimulation true;
  91.  
  92. addSwitchableUnit dayz_originalPlayer;
  93. setPlayable dayz_originalPlayer;
  94. selectPlayer dayz_originalPlayer;
  95.  
  96. //_myGroup = group _body;
  97. //[_body] joinSilent dayz_firstGroup;
  98. //deleteGroup _myGroup;
  99.  
  100. 3 cutRsc ["default", "PLAIN",3];
  101. 4 cutRsc ["default", "PLAIN",3];
  102.  
  103. _body setVariable["combattimeout", 0, true];
  104.  
  105. //["dayzFlies",player] call broadcastRpcCallAll;
  106. sleep 2;
  107.  
  108. 1 cutRsc ["DeathScreen","BLACK OUT",3];
  109.  
  110. playMusic "dayz_track_death_1";
  111.  
  112. "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5;
  113. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1],  [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5;
  114.  
  115. sleep 2;
  116.  
  117. for  "_x" from 5 to 1 step -1 do {
  118.     titleText [format[localize "str_return_lobby", _x], "PLAIN DOWN", 1];
  119.     sleep 1;
  120. };
  121.  
  122. PVDZE_Server_Simulation = [_body, false];
  123. publicVariableServer "PVDZE_Server_Simulation";
  124.  
  125. endMission "END1";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement