Suzej

Untitled

Apr 24th, 2019
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.97 KB | None | 0 0
  1. /**
  2. * ExileServer_object_player_event_onMpKilled
  3. *
  4. * Exile Mod
  5. * www.exilemod.com
  6. * © 2015 Exile Mod Team
  7. *
  8. * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  9. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  10. * 64Bit Conversion File Header (Extdb3) - Validatior
  11. */
  12.  
  13. private["_victim", "_killer", "_instigator", "_countDeath", "_countKill", "_killSummary", "_killingPlayer", "_killType", "_oldVictimRespect", "_newVictimRespect", "_oldKillerRespect", "_newKillerRespect", "_unknownReasons", "_systemChat", "_modifyVictimRespect", "_respectLoss", "_perks", "_minRespectTransfer", "_respectTransfer", "_perkNames", "_killerStatsNeedUpdate", "_newKillerFrags", "_victimStatsNeedUpdate", "_newVictimDeaths", "_victimPosition"];
  14. _victim = _this select 0;
  15. _killer = _this select 1;
  16. _instigator = _this select 2;
  17. if (!isServer || hasInterface || isNull _victim) exitWith {};
  18. _victim setVariable ["ExileDiedAt", time];
  19. if !(isPlayer _victim) exitWith {};
  20. _victim setVariable ["ExileIsDead", true];
  21. _victim setVariable ["ExileName", name _victim, true];
  22. _countDeath = false;
  23. _countKill = false;
  24. _killSummary = [];
  25. _killingPlayer = _killer call ExileServer_util_getFragKiller;
  26. _killType = [_victim, _killer, _killingPlayer, _instigator] call ExileServer_util_getFragType;
  27. _oldVictimRespect = _victim getVariable ["ExileScore", 0];
  28. _newVictimRespect = _oldVictimRespect;
  29. _oldKillerRespect = 0;
  30. _clientID = owner _killingPlayer;
  31. _clientID2 = owner _victim;
  32. if !(isNull _killingPlayer) then
  33. {
  34. _oldKillerRespect = _killingPlayer getVariable ["ExileScore", 0];
  35. };
  36. _newKillerRespect = _oldKillerRespect;
  37. switch (_killType) do
  38. {
  39. default
  40. {
  41. _unknownReasons =
  42. [
  43. "%1 died because... Arma.",
  44. "%1 died because the universe hates him.",
  45. "%1 died a mysterious death.",
  46. "%1 died and nobody knows why.",
  47. "%1 died because that's why.",
  48. "%1 died because %1 was very unlucky.",
  49. "%1 died due to Arma bugs and is probably very salty right now.",
  50. "%1 died an awkward death.",
  51. "%1 died. Yes, %1 is dead. Like really dead-dead."
  52. ];
  53. _countDeath = true;
  54. _systemChat = format [selectRandom _unknownReasons, name _victim];
  55. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["YouAreDead"]}}] remoteExecCall ["spawn",_clientID2,false];
  56. _newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "unlucky")));
  57. };
  58. case 1:
  59. {
  60. _countDeath = true;
  61. _modifyVictimRespect = true;
  62. _systemChat = format ["%1 commited suicide!", name _victim];
  63. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["Humililation","Denied","YouAreDead"]}}] remoteExecCall ["spawn",_clientID2,false];
  64.  
  65. _newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "suicide")));
  66. };
  67. case 2:
  68. {
  69. _countDeath = true;
  70. _countKill = false;
  71. _systemChat = format ["%1 died while playing Russian Roulette!", name _victim];
  72. _newVictimRespect = _oldVictimRespect;
  73. _victim call ExileServer_system_russianRoulette_event_onPlayerDied;
  74. };
  75. case 3:
  76. {
  77. _countDeath = true;
  78. _countKill = false;
  79. _systemChat = format ["%1 crashed to death!", name _victim];
  80. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["Humililation","Denied","YouAreDead"]}}] remoteExecCall ["spawn",_clientID2,false];
  81. _newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "crash")));
  82. };
  83. case 4:
  84. {
  85. _countDeath = true;
  86. _countKill = false;
  87. _systemChat = format ["%1 was killed by an NPC!", name _victim];
  88. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["Humililation","Denied"]}}] remoteExecCall ["spawn",_clientID2,false];
  89. _newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "npc")));
  90. };
  91. case 5:
  92. {
  93. _countDeath = false;
  94. _countKill = false;
  95. _systemChat = format ["%1 was team-killed by %2!", name _victim, name _killingPlayer];
  96. _respectLoss = round ((abs _oldKillerRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "friendyFire")));
  97. _newKillerRespect = _oldKillerRespect - _respectLoss;
  98. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["YouAreDead"]}}] remoteExecCall ["spawn",_clientID2,false];
  99. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["excellent","TeamKiller"]}}] remoteExecCall ["spawn",_clientID,false];
  100. _killSummary pushBack ["FRIENDLY FIRE", -1 * _respectLoss];
  101. };
  102. case 6:
  103. {
  104. _countDeath = false;
  105. _countKill = false;
  106. _systemChat = format ["%1 was killed by %2! (BAMBI SLAYER)", name _victim, name _killingPlayer];
  107. _respectLoss = round ((abs _oldKillerRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "bambiKill")));
  108. _newKillerRespect = _oldKillerRespect - _respectLoss;
  109. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["YouAreDead"]}}] remoteExecCall ["spawn",_clientID2,false];
  110. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["Perfect","excellent","WickedSick","Impresive"]}}] remoteExecCall ["spawn",_clientID,false];
  111. _killSummary pushBack ["BAMBI SLAYER", -1 * _respectLoss];
  112. };
  113. case 7:
  114. {
  115. _countDeath = true;
  116. _countKill = true;
  117. _perks = [_victim, _killer, _killingPlayer] call ExileServer_util_getFragPerks;
  118. _minRespectTransfer = getNumber (configFile >> "CfgSettings" >> "Respect" >> "minRespectTransfer");
  119. _respectTransfer = round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "frag")));
  120. if (_respectTransfer < _minRespectTransfer) then
  121. {
  122. _respectTransfer = _minRespectTransfer;
  123. };
  124. _newVictimRespect = _oldVictimRespect - _respectTransfer;
  125. _newKillerRespect = _oldKillerRespect + _respectTransfer;
  126. _killSummary pushBack ["ENEMY FRAGGED", _respectTransfer];
  127. if (_perks isEqualTo []) then
  128. {
  129. _systemChat = format ["%1 was killed by %2!", name _victim, name _killingPlayer];
  130. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["YouAreDead"]}}] remoteExecCall ["spawn",_clientID2,false];
  131. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["excellent","ComboWhore","GodLike","Holyshiet","Impresive","Lucakill","Monsterkill","Perfect"]}}] remoteExecCall ["spawn",_clientID,false];
  132. }
  133. else
  134. {
  135. _perkNames = [];
  136. {
  137. _perkNames pushBack (_x select 0);
  138. _killSummary pushBack _x;
  139. _newKillerRespect = _newKillerRespect + (_x select 1);
  140. }
  141. forEach _perks;
  142. _systemChat = format ["%1 was killed by %2! (%3)", name _victim, name _killingPlayer, _perkNames joinString ", "];
  143. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["YouAreDead"]}}] remoteExecCall ["spawn",_clientID2,false];
  144. ["",{if (QuakeSoundSystem) then {playSound selectRandom ["excellent","ComboWhore","GodLike","Holyshiet","Impresive","Lucakill","Monsterkill","Perfect"]}}] remoteExecCall ["spawn",_clientID,false];
  145. };
  146. };
  147. };
  148. if !(isNull _killingPlayer) then
  149. {
  150. if !(_killSummary isEqualTo []) then
  151. {
  152. [_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
  153. };
  154. };
  155. if !(isNull _killingPlayer) then
  156. {
  157. _killerStatsNeedUpdate = false;
  158. if (_countKill) then
  159. {
  160. _newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
  161. _newKillerFrags = _newKillerFrags + 1;
  162. _killerStatsNeedUpdate = true;
  163. _killingPlayer setVariable ["ExileKills", _newKillerFrags];
  164. format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
  165. };
  166. if !(_newKillerRespect isEqualTo _oldKillerRespect) then
  167. {
  168. _killingPlayer setVariable ["ExileScore", _newKillerRespect];
  169. _killerStatsNeedUpdate = true;
  170. format["setAccountScore:%1:%2", _newKillerRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
  171. };
  172. if (_killerStatsNeedUpdate) then
  173. {
  174. _killingPlayer call ExileServer_object_player_sendStatsUpdate;
  175. };
  176. };
  177. _victimStatsNeedUpdate = false;
  178. if (_countDeath) then
  179. {
  180. _newVictimDeaths = _victim getVariable ["ExileDeaths", 0];
  181. _newVictimDeaths = _newVictimDeaths + 1;
  182. _victim setVariable ["ExileDeaths", _newVictimDeaths];
  183. _victimStatsNeedUpdate = true;
  184. format["addAccountDeath:%1", getPlayerUID _victim] call ExileServer_system_database_query_fireAndForget;
  185. };
  186. if !(_newVictimRespect isEqualTo _oldVictimRespect) then
  187. {
  188. _victim setVariable ["ExileScore", _newVictimRespect];
  189. _victimStatsNeedUpdate = true;
  190. format["setAccountScore:%1:%2", _newVictimRespect, getPlayerUID _victim] call ExileServer_system_database_query_fireAndForget;
  191. };
  192. if (_victimStatsNeedUpdate) then
  193. {
  194. _victim call ExileServer_object_player_sendStatsUpdate;
  195. };
  196. if ((vehicle _victim) isEqualTo _victim) then
  197. {
  198. if !(underwater _victim) then
  199. {
  200. if !(_victim call ExileClient_util_world_isInTraderZone) then
  201. {
  202. _victim call ExileServer_object_flies_spawn;
  203. };
  204. };
  205. };
  206. if !(_systemChat isEqualTo "") then
  207. {
  208. if ((getNumber (configFile >> "CfgSettings" >> "KillFeed" >> "showKillFeed")) isEqualTo 1) then
  209. {
  210. ["systemChatRequest", [_systemChat]] call ExileServer_system_network_send_broadcast;
  211. };
  212. };
  213. if !(_systemChat isEqualTo "") then
  214. {
  215. if ((getNumber (configFile >> "CfgSettings" >> "Logging" >> "deathLogging")) isEqualTo 1) then
  216. {
  217. "extDB3" callExtension format["1:DEATH:%1", _systemChat];
  218. };
  219. };
  220. _victimPosition = getPos _victim;
  221. format["insertPlayerHistory:%1:%2:%3:%4:%5", getPlayerUID _victim, name _victim, _victimPosition select 0, _victimPosition select 1, _victimPosition select 2] call ExileServer_system_database_query_fireAndForget;
  222. format["deletePlayer:%1", _victim getVariable ["ExileDatabaseId", -1]] call ExileServer_system_database_query_fireAndForget;
  223. true
Add Comment
Please, Sign In to add comment