Advertisement
Guest User

Untitled

a guest
Nov 18th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.24 KB | None | 0 0
  1. /**
  2.  * Exile Mod
  3.  * www.exilemod.com
  4.  * © 2015 Exile Mod Team
  5.  *
  6.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  7.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  8.  */
  9.  
  10. private["_victim","_killer","_addDeathStat","_addKillStat","_killerRespectPoints","_fragAttributes","_player","_vehicleRole","_vehicle","_lastKillAt","_killStack","_distance","_distanceBonus","_overallRespectChange","_newKillerScore","_killMessage","_newKillerFrags","_newVictimDeaths"];
  11. if (!isServer || hasInterface) exitWith {};
  12. _victim = _this select 0;
  13. _killer = _this select 1;
  14. if( isNull _victim ) exitWith {};
  15. _victim setVariable ["ExileDiedAt", time];
  16. if !(isPlayer _victim) exitWith {};
  17. format["killPlayer:%1", _victim getVariable ["ExileDatabaseId", -1]] call ExileServer_system_database_query_fireAndForget;
  18. _victim setVariable ["ExileIsDead", true];
  19. _addDeathStat = true;
  20. _addKillStat = true;
  21. _killerRespectPoints = [];
  22. _fragAttributes = [];
  23. if (_victim isEqualTo _killer) then
  24. {
  25.     ["systemChatRequest", [format["%1 commited suicide!", (name _victim)]]] call ExileServer_object_player_event_killFeed;
  26. }
  27. else
  28. {
  29.     if (vehicle _victim isEqualTo _killer) then
  30.     {
  31.         ["systemChatRequest", [format["%1 crashed to death!", (name _victim)]]] call ExileServer_object_player_event_killfeed;
  32.     }
  33.     else
  34.     {
  35.         if (isNull _killer) then
  36.         {
  37.             ["systemChatRequest", [format["%1 died for an unknown reason!", (name _victim)]]] call ExileServer_object_player_event_killfeed;
  38.         }
  39.         else
  40.         {
  41.             _player = objNull;
  42.             if (isPlayer _killer) then
  43.             {
  44.                 if ((typeOf _killer) isEqualTo "Exile_Unit_Player") then
  45.                 {
  46.                     _player = _killer; 
  47.                 }
  48.                 else
  49.                 {
  50.                     _uid = getPlayerUID _killer;
  51.                     {
  52.                         if ((getPlayerUID _x) isEqualTo _uid) exitWith
  53.                         {
  54.                             _player = _x;
  55.                         };
  56.                     }
  57.                     forEach allPlayers;
  58.                 };
  59.             }
  60.             else
  61.             {
  62.                 if (isUAVConnected _killer) then
  63.                 {
  64.                     _player = (UAVControl _killer) select 0;
  65.                 };
  66.             };
  67.             if !(isNull _player) then
  68.             {
  69.                 _killer = _player;
  70.                 if (_victim getVariable["ExileIsBambi", false]) then
  71.                 {
  72.                     _addKillStat = false;
  73.                     _addDeathStat = false;
  74.                     _fragAttributes pushBack "Bambi Slayer";
  75.                     _killerRespectPoints pushBack ["BAMBI SLAYER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "bambi"))];
  76.                 }
  77.                 else
  78.                 {
  79.                     if ((vehicle _killer) isEqualTo _killer) then
  80.                     {
  81.                         if ((currentWeapon _killer) isEqualTo "Exile_Melee_Axe") then
  82.                         {
  83.                             _fragAttributes pushBack "Humiliation";
  84.                             _killerRespectPoints pushBack ["HUMILIATION", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "humiliation"))];
  85.                         }
  86.                         else
  87.                         {
  88.                             _killerRespectPoints pushBack ["ENEMY FRAGGED", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "standard"))];
  89.                         };
  90.                     }
  91.                     else
  92.                     {
  93.                         _vehicleRole = assignedVehicleRole _killer;
  94.                         switch (toLower (_vehicleRole select 0)) do
  95.                         {
  96.                             case "driver":
  97.                             {
  98.                                 _vehicle = vehicle _killer;
  99.                                 switch (true) do
  100.                                 {
  101.                                     case (_vehicle isKindOf "ParachuteBase"):
  102.                                     {
  103.                                         _fragAttributes pushBack "Chute > Chopper";
  104.                                         _killerRespectPoints pushBack ["CHUTE > CHOPPER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "chuteGreaterChopper"))];
  105.                                     };
  106.                                     case (_vehicle isKindOf "Air"):
  107.                                     {
  108.                                         _fragAttributes pushBack "Big Bird";
  109.                                         _killerRespectPoints pushBack ["BIG BIRD", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "bigBird"))];
  110.                                     };
  111.                                     default
  112.                                     {
  113.                                         _fragAttributes pushBack "Road Kill";
  114.                                         _killerRespectPoints pushBack ["ROAD KILL", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "roadKill"))];
  115.                                     };
  116.                                 };
  117.                             };
  118.                             case "turret":
  119.                             {
  120.                                 if ((currentWeapon _killer) isKindOf "StaticWeapon") then
  121.                                 {
  122.                                     _fragAttributes pushBack "Let it Rain";
  123.                                     _killerRespectPoints pushBack ["LET IT RAIN", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "letItRain"))];
  124.                                 }
  125.                                 else
  126.                                 {
  127.                                     _fragAttributes pushBack "Mad Passenger";
  128.                                     _killerRespectPoints pushBack ["MAD PASSENGER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "passenger"))];
  129.                                 };
  130.                             };
  131.                             default
  132.                             {
  133.                                 _fragAttributes pushBack "Mad Passenger";
  134.                                 _killerRespectPoints pushBack ["MAD PASSENGER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "passenger"))];
  135.                             };                         
  136.                         };
  137.                     };
  138.                 };
  139.                 if (_addKillStat) then
  140.                 {
  141.                     _lastKillAt = _killer getVariable["ExileLastKillAt", 0];
  142.                     _killStack = _killer getVariable["ExileKillStack", 0];
  143.                     _killStack = _killStack + 1;
  144.                     if (isNil "ExileServerHadFirstBlood") then
  145.                     {
  146.                         ExileServerHadFirstBlood = true;
  147.                         _fragAttributes pushBack "First Blood";
  148.                         _killerRespectPoints pushBack ["FIRST BLOOD", getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "firstBlood")];
  149.                     }
  150.                     else
  151.                     {
  152.                         if (time - _lastKillAt < (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "killStreakTimeout"))) then
  153.                         {
  154.                             _fragAttributes pushBack (format ["%1x Kill Streak", _killStack]);
  155.                             _killerRespectPoints pushBack [(format ["%1x KILL STREAK", _killStack]), _killStack * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "killStreak"))];
  156.                         }
  157.                         else
  158.                         {
  159.                             _killStack = 1;
  160.                         };
  161.                     };
  162.                     _killer setVariable["ExileKillStack", _killStack];
  163.                     _killer setVariable ["ExileLastKillAt", time];
  164.                     _distance = floor(_victim distance _killer);
  165.                     _fragAttributes pushBack (format ["%1m Distance", _distance]);
  166.                     _distanceBonus = (floor (_distance / 100)) * getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "per100mDistance");
  167.                     if (_distanceBonus > 0) then
  168.                     {
  169.                         _killerRespectPoints pushBack [(format ["%1m RANGE BONUS", _distance]), _distanceBonus];
  170.                     };
  171.                     //MOD by Patrix87
  172.                     if (_distance < 25) then
  173.                     {
  174.                         _killerRespectPoints pushBack [(format ["%1m CLOSE QUARTER BONUS", _distance]), 100];
  175.                     };
  176.                     //End of mod
  177.                 };
  178.                 _overallRespectChange = 0;
  179.                 {
  180.                     _overallRespectChange = _overallRespectChange + (_x select 1);
  181.                 }
  182.                 forEach _killerRespectPoints;
  183.                 _newKillerScore = _killer getVariable ["ExileScore", 0];
  184.                 _newKillerScore = _newKillerScore + _overallRespectChange;
  185.                 _killer setVariable ["ExileScore", _newKillerScore];
  186.                 format["setAccountScore:%1:%2", _newKillerScore,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
  187.                 _killMessage = format ["%1 was killed by %2", (name _victim), (name _killer)];
  188.                 if !(count _fragAttributes isEqualTo 0) then
  189.                 {
  190.                     _killMessage = _killMessage + " (" + (_fragAttributes joinString ", ") + ")";
  191.                 };
  192.                 ["systemChatRequest", [_killMessage]] call ExileServer_object_player_event_killfeed;
  193.                 if (_addKillStat isEqualTo true) then
  194.                 {
  195.                     _newKillerFrags = _killer getVariable ["ExileKills", 0];
  196.                     _newKillerFrags = _newKillerFrags + 1;
  197.                     _killer setVariable ["ExileKills", _newKillerFrags];
  198.                     format["addAccountKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget;
  199.                 };
  200.                 [_killer, "showFragRequest", [_killerRespectPoints]] call ExileServer_system_network_send_to;
  201.                 _killer call ExileServer_object_player_sendStatsUpdate;
  202.             }
  203.             else
  204.             {
  205.                 ["systemChatRequest", [format["%1 was killed by an NPC! (%2m Distance)", (name _victim), floor(_victim distance _killer)]]] call ExileServer_object_player_event_killfeed;
  206.             };
  207.         };
  208.     };
  209. };
  210. if (_addDeathStat isEqualTo true) then
  211. {
  212.     _newVictimDeaths = _victim getVariable ["ExileDeaths", 0];
  213.     _newVictimDeaths = _newVictimDeaths + 1;
  214.     _victim setVariable ["ExileDeaths", _newVictimDeaths];
  215.     format["addAccountDeath:%1", getPlayerUID _victim] call ExileServer_system_database_query_fireAndForget;
  216.     _victim call ExileServer_object_player_sendStatsUpdate;
  217. };
  218. [_victim] joinSilent ExileGraveyardGroup;
  219. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement