Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 KB | None | 0 0
  1. private ["_characterID","_minutes","_newObject","_playerID","_infected","_victim","_victimName","_killer","_killerName","_weapon","_distance","_message","_loc_message","_key","_death_record","_pic","_kill_txt"];
  2. //[unit, weapon, muzzle, mode, ammo, magazine, projectile]
  3. _characterID = _this select 0;
  4. _minutes = _this select 1;
  5. _newObject = _this select 2;
  6. _playerID = _this select 3;
  7. _infected = _this select 4;
  8. if (((count _this) >= 6) && {(typeName (_this select 5)) == "STRING"} && {(_this select 5) != ""}) then {
  9. _victimName = _this select 5;
  10. } else {
  11. _victimName = if (alive _newObject) then {name _newObject;} else {"";};
  12. };
  13. _victim = _newObject;
  14. _newObject setVariable ["bodyName", _victimName, true];
  15. _newObject setVariable ["bodyUID", _playerID, true];
  16. _newObject setVariable ["bodyGroup", (group _newObject), true];
  17.  
  18. sleep 3;
  19. _killer = _victim getVariable["AttackedBy", "nil"];
  20. _killerName = _victim getVariable["AttackedByName", "nil"];
  21.  
  22. // when a zombie kills a player _killer, _killerName && _weapon will be "nil"
  23. // we can use this to determine a zombie kill && send a customized message for that. right now no killmsg means it was a zombie.
  24. if ((typeName _killer) != "STRING") then
  25. {
  26. _weapon = _victim getVariable["AttackedByWeapon", "nil"];
  27. _distance = _victim getVariable["AttackedFromDistance", "nil"];
  28.  
  29. if ((owner _victim) == (owner _killer)) then
  30. {
  31. _message = format["%1 killed himself",_victimName];
  32. _loc_message = format["PKILL: %1 killed himself", _victimName];
  33. }
  34. else
  35. {
  36. _message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
  37. _loc_message = format["PKILL: %1 was killed by %2 with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance];
  38.  
  39. _pic = _victim getVariable["AttackedByWeaponImg", "nil"];
  40.  
  41. if ((gettext (configFile >> 'cfgWeapons' >> (currentWeapon _killer) >> 'displayName')) != "Throw") then {
  42. if (!isNil "_pic") then {
  43. _kill_txt = format ["<t align='left' size='0.6'>%1 </t>",_killerName,_pic,_victimName,(ceil _distance)];
  44. _kill_txt = _kill_txt + format ["<img size='0.7' align='left' image='%2'/>",_killerName,_pic,_victimName,(ceil _distance)];
  45. _kill_txt = _kill_txt + format ["<t align='left' size='0.6'> %3 </t>",_killerName,_pic,_victimName,(ceil _distance)];
  46. _kill_txt = _kill_txt + format ["<t align='left' size='0.6'>[%4m]</t>",_killerName,_pic,_victimName,(ceil _distance)];
  47.  
  48. customkillMessage = [_kill_txt];
  49. publicVariable "customkillMessage";
  50. };
  51. };
  52.  
  53. };
  54.  
  55. diag_log _loc_message;
  56.  
  57. if(DZE_DeathMsgGlobal) then {
  58. [nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
  59. };
  60. /* needs customRemoteMessage
  61. if(DZE_DeathMsgGlobal) then {
  62. customRemoteMessage = ['globalChat', _message, _killer];
  63. publicVariable "customRemoteMessage";
  64. };
  65. */
  66. if(DZE_DeathMsgSide) then {
  67. [nil, nil, rspawn, [_killer, _message], { (_this select 0) sideChat (_this select 1) }] call RE;
  68. };
  69. if(DZE_DeathMsgTitleText) then {
  70. [nil,nil,"per",rTITLETEXT,_message,"PLAIN DOWN"] call RE;
  71. };
  72.  
  73. // build array to store death messages to allow viewing at message board in trader citys.
  74. _death_record = [
  75. _victimName,
  76. _killerName,
  77. _weapon,
  78. _pic,
  79. _distance,
  80. ServerCurrentTime
  81. ];
  82. PlayerDeaths set [count PlayerDeaths,_death_record];
  83. PV_DeathBoard = PlayerDeaths;
  84. publicVariable "PV_DeathBoard";
  85.  
  86. // Cleanup
  87. _victim setVariable["AttackedBy", "nil", true];
  88. _victim setVariable["AttackedByName", "nil", true];
  89. _victim setVariable["AttackedByWeapon", "nil", true];
  90. _victim setVariable["AttackedFromDistance", "nil", true];
  91. };
  92.  
  93. // Might not be the best way...
  94. /*
  95. if (isnil "dayz_disco") then {
  96. dayz_disco = [];
  97. };
  98. */
  99.  
  100. // dayz_disco = dayz_disco - [_playerID];
  101. _newObject setVariable["processedDeath",diag_tickTime];
  102.  
  103. if (typeName _minutes == "STRING") then
  104. {
  105. _minutes = parseNumber _minutes;
  106. };
  107.  
  108. diag_log ("PDEATH: Player Died " + _playerID);
  109.  
  110. if (_characterID != "0") then
  111. {
  112. _key = format["CHILD:202:%1:%2:%3:",_characterID,_minutes,_infected];
  113. #ifdef DZE_SERVER_DEBUG_HIVE
  114. diag_log ("HIVE: WRITE: "+ str(_key));
  115. #endif
  116. _key call server_hiveWrite;
  117. }
  118. else
  119. {
  120. deleteVehicle _newObject;
  121. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement