Advertisement
Guest User

player_death.sqf

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