Advertisement
Guest User

server_playerDied.sqf

a guest
Apr 25th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. private ["_characterID","_minutes","_newObject","_playerID","_infected","_victim","_victimName","_killer","_killerName","_weapon","_distance","_message","_loc_message","_key","_death_record"];
  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. _victimName = name _newObject;
  9.  
  10. _victim = _newObject;
  11. _newObject setVariable ["bodyName", _victimName, true];
  12.  
  13. _killer = _victim getVariable["AttackedBy", "nil"];
  14. _killerName = _victim getVariable["AttackedByName", "nil"];
  15.  
  16. // when a zombie kills a player _killer, _killerName and _weapon will be "nil"
  17. // we can use this to determine a zombie kill and send a customized message for that. right now no killmsg means it was a zombie.
  18. if (_killerName != "nil") then
  19. {
  20. _weapon = _victim getVariable["AttackedByWeapon", "nil"];
  21. _distance = _victim getVariable["AttackedFromDistance", "nil"];
  22.  
  23. if (_victimName == _killerName) then
  24. {
  25. _message = format["%1 killed himself",_victimName];
  26. _loc_message = format["PKILL: %1 killed himself", _victimName];
  27. }
  28. else
  29. {
  30. _message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
  31. _loc_message = format["PKILL: %1 was killed by %2 with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance];
  32. };
  33.  
  34. diag_log _loc_message;
  35.  
  36. if(DZE_DeathMsgGlobal) then {
  37. customRemoteMessage = ['globalChat', _message, _killer];
  38. publicVariable "customRemoteMessage";
  39. };
  40.  
  41. /* needs customRemoteMessage
  42. if(DZE_DeathMsgGlobal) then {
  43. customRemoteMessage = ['globalChat', _message, _killer];
  44. publicVariable "customRemoteMessage";
  45. };
  46. */
  47. if(DZE_DeathMsgSide) then {
  48. [nil, nil, rspawn, [_killer, _message], { (_this select 0) sideChat (_this select 1) }] call RE;
  49. };
  50. if(DZE_DeathMsgTitleText) then {
  51. [nil,nil,"per",rTITLETEXT,_message,"PLAIN DOWN"] call RE;
  52. };
  53.  
  54. // build array to store death messages to allow viewing at message board in trader citys.
  55. _death_record = [
  56. _victimName,
  57. _killerName,
  58. _weapon,
  59. _distance,
  60. ServerCurrentTime
  61. ];
  62. PlayerDeaths set [count PlayerDeaths,_death_record];
  63.  
  64. // Cleanup
  65. _victim setVariable["AttackedBy", "nil", true];
  66. _victim setVariable["AttackedByName", "nil", true];
  67. _victim setVariable["AttackedByWeapon", "nil", true];
  68. _victim setVariable["AttackedFromDistance", "nil", true];
  69. };
  70.  
  71. // Might not be the best way...
  72. /*
  73. if (isnil "dayz_disco") then {
  74. dayz_disco = [];
  75. };
  76. */
  77.  
  78. // dayz_disco = dayz_disco - [_playerID];
  79. _newObject setVariable["processedDeath",diag_tickTime];
  80.  
  81. if (typeName _minutes == "STRING") then
  82. {
  83. _minutes = parseNumber _minutes;
  84. };
  85.  
  86. diag_log ("PDEATH: Player Died " + _playerID);
  87.  
  88. if (_characterID != "0") then
  89. {
  90. _key = format["CHILD:202:%1:%2:%3:",_characterID,_minutes,_infected];
  91. #ifdef DZE_SERVER_DEBUG_HIVE
  92. diag_log ("HIVE: WRITE: "+ str(_key));
  93. #endif
  94. _key call server_hiveWrite;
  95. }
  96. else
  97. {
  98. deleteVehicle _newObject;
  99. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement