Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2020
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 30.13 KB | None | 0 0
  1. /*
  2.     SourcePawn is Copyright (C) 2006-2008 AlliedModders LLC.  All rights reserved.
  3.     SourceMod is Copyright (C) 2006-2008 AlliedModders LLC.  All rights reserved.
  4.     Pawn and SMALL are Copyright (C) 1997-2008 ITB CompuPhase.
  5.     Source is Copyright (C) Valve Corporation.
  6.     All trademarks are property of their respective owners.
  7.     This program is free software: you can redistribute it and/or modify it
  8.     under the terms of the GNU General Public License as published by the
  9.     Free Software Foundation, either version 3 of the License, or (at your
  10.     option) any later version.
  11.     This program is distributed in the hope that it will be useful, but
  12.     WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     General Public License for more details.
  15.     You should have received a copy of the GNU General Public License along
  16.     with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. */
  18.  
  19. #include <sourcemod>
  20. #include <multicolors>
  21. #include <sdkhooks>
  22. #include <sdktools>
  23.  
  24. #pragma semicolon 1
  25. #pragma newdecls required
  26.  
  27. // Stats Buffer
  28. int g_ibTotalAssists[MAXPLAYERS+1];
  29. int g_ibTotalSkeets[MAXPLAYERS+1];
  30. int g_ibTotalSkeetHurts[MAXPLAYERS+1];
  31. int g_ibTotalMeleeSkeets[MAXPLAYERS+1];
  32. int g_ibTotalSmgSkeets[MAXPLAYERS+1];
  33. int g_ibTotalMagnumSkeets[MAXPLAYERS+1];
  34. int g_ibTotalMagnumHeadShotSkeets[MAXPLAYERS+1];
  35. int g_ibTotalTongueCuts[MAXPLAYERS+1];
  36. int g_ibTotalSmokerSelfClears[MAXPLAYERS+1];
  37. int g_ibTotalChargerLevels[MAXPLAYERS+1];
  38. int g_ibTotalChargerLevelHurts[MAXPLAYERS+1];
  39. int g_ibTotalRockSkeet[MAXPLAYERS+1];
  40. int g_ibTotalBoomerPops[MAXPLAYERS+1];
  41. int g_ibTotalJockeySkeets[MAXPLAYERS+1];
  42. int g_ibTotalSurvivorIncaps[MAXPLAYERS+1];
  43. int g_ibTotalFriendlyFire[MAXPLAYERS+1];
  44. int g_ibTotalUsedPills[MAXPLAYERS+1];
  45. int g_ibTotalCarAlarmTriggered[MAXPLAYERS+1];
  46. int g_ibTotalCarAlarmTriggeredBoomer[MAXPLAYERS+1];
  47. int g_ibTotalSurvivorPounced[MAXPLAYERS+1];
  48. int g_ibTotalSurvivorTankRockHits[MAXPLAYERS+1];
  49. int g_ibTotalHunterCaps[MAXPLAYERS+1];
  50. int g_ibTotalJockeyCaps[MAXPLAYERS+1];
  51. int g_ibTotalSmokerCaps[MAXPLAYERS+1];
  52. int g_ibTotalChargerCaps[MAXPLAYERS+1];
  53. int g_ibTotalBoomerVomits[MAXPLAYERS+1];
  54. int g_ibTotalChargerImpacts[MAXPLAYERS+1];
  55. int g_ibTotalChargerInstaKills[MAXPLAYERS+1];
  56. int g_ibTotalHunterPounces[MAXPLAYERS+1];
  57. int g_ibTotalTankPunch[MAXPLAYERS+1];
  58. int g_ibTotalTankIncaps[MAXPLAYERS+1];
  59. int g_ibTotalTankPropHits[MAXPLAYERS+1];
  60. int g_ibTotalClears[MAXPLAYERS+1];
  61. int g_ibAcummulatedSurvivorKills[MAXPLAYERS+1];
  62. int g_ibAcummulatedInfectedKills[MAXPLAYERS+1];
  63. int g_ibAcummulatedInfectedIncap[MAXPLAYERS+1];
  64. int g_ibAcummulatedCommons[MAXPLAYERS+1];
  65. int g_ibTotalBoomerDamage[MAXPLAYERS+1];
  66. int g_ibTotalSpitterDamage[MAXPLAYERS+1];
  67. float g_fbClearsTime[MAXPLAYERS+1][512];
  68. float g_fbClearsAverage[MAXPLAYERS+1];
  69.  
  70. // Buffer
  71. int iSur[4];
  72. int iInf[4];   
  73. char sSurNames[4][MAX_NAME_LENGTH];
  74. char sInfNames[4][MAX_NAME_LENGTH];
  75. char sSurNameSpaces[8][8];
  76. char sInfNameSpaces[8][8];
  77. char sClearTimes[4][22];
  78. bool g_bbPlayerCanUseInfoCmd[MAXPLAYERS+1];
  79. bool g_bbAllowedToSend;
  80.  
  81. /*************************************************************************************************************************************************/
  82. /*************************************************************************************************************************************************/
  83. /*************************************************************************************************************************************************/
  84.  
  85. public Plugin myinfo = {
  86.     name = "Skill Level and Elo System (Console info)",
  87.     author = "Mis",
  88.     description = "Console info module of the SkillLevel package",
  89.     version = "0.1.0",
  90.     url = "https://github.com/misdocumeno/L4D2_SkillLevel_Elo_System"
  91. };
  92.  
  93. // *********************************************************** //
  94. // *********** || S T O C K   F U N C T I O N S || *********** //
  95. // *********************************************************** //
  96.  
  97. public void OnPluginStart()
  98. {
  99.     HookEvent("round_end", OnRoundEnd_Event, EventHookMode_Post);
  100.     HookEvent("round_start", OnRoundStart_Event, EventHookMode_Post);
  101.  
  102.     RegConsoleCmd("sm_consoleinfo", ConsoleInfoCommand);
  103. }
  104.  
  105. // *********************************************************** //
  106. // *** || P L U G I N S   S T O C K   F U N C T I O N S || *** //
  107. // *********************************************************** //
  108.  
  109. static void BufferReset()
  110. {
  111.     for (int i = 1; i <= MaxClients; i++)
  112.     {
  113.         g_ibAcummulatedCommons[i] = 0;
  114.         g_ibAcummulatedSurvivorKills[i] = 0;
  115.         g_ibAcummulatedInfectedKills[i] = 0;
  116.         g_ibAcummulatedInfectedIncap[i] = 0;
  117.         g_ibTotalRockSkeet[i] = 0;
  118.         g_ibTotalAssists[i] = 0;
  119.         g_ibTotalSkeets[i] = 0;
  120.         g_ibTotalSkeetHurts[i] = 0;
  121.         g_ibTotalMeleeSkeets[i] = 0;
  122.         g_ibTotalSmgSkeets[i] = 0;
  123.         g_ibTotalMagnumSkeets[i] = 0;
  124.         g_ibTotalMagnumHeadShotSkeets[i] = 0;
  125.         g_ibTotalTongueCuts[i] = 0;
  126.         g_ibTotalSmokerSelfClears[i] = 0;
  127.         g_ibTotalChargerLevels[i] = 0;
  128.         g_ibTotalChargerLevelHurts[i] = 0;
  129.         g_ibTotalBoomerPops[i] = 0;
  130.         g_ibTotalJockeySkeets[i] = 0;
  131.         g_ibTotalSurvivorIncaps[i] = 0;
  132.         g_ibTotalFriendlyFire[i] = 0;
  133.         g_ibTotalUsedPills[i] = 0;
  134.         g_ibTotalCarAlarmTriggered[i] = 0;
  135.         g_ibTotalCarAlarmTriggeredBoomer[i] = 0;
  136.         g_ibTotalSurvivorPounced[i] = 0;
  137.         g_ibTotalSurvivorTankRockHits[i] = 0;
  138.         g_ibTotalHunterCaps[i] = 0;
  139.         g_ibTotalJockeyCaps[i] = 0;
  140.         g_ibTotalSmokerCaps[i] = 0;
  141.         g_ibTotalChargerCaps[i] = 0;
  142.         g_ibTotalBoomerVomits[i] = 0;
  143.         g_ibTotalChargerImpacts[i] = 0;
  144.         g_ibTotalChargerInstaKills[i] = 0;
  145.         g_ibTotalHunterPounces[i] = 0;
  146.         g_ibTotalTankPunch[i] = 0;
  147.         g_ibTotalTankIncaps[i] = 0;
  148.         g_ibTotalTankPropHits[i] = 0;
  149.         g_ibTotalClears[i] = 0;
  150.         g_fbClearsAverage[i] = -1.0;
  151.         g_bbPlayerCanUseInfoCmd[i] = true;
  152.  
  153.         for (int j = 0; j < 512; j++)
  154.         {
  155.             g_fbClearsTime[i][j] = -1.0;
  156.         }
  157.     }
  158. }
  159.  
  160. public Action AllowInfoCommand(Handle timer, int client)
  161. {
  162.     g_bbPlayerCanUseInfoCmd[client] = true;
  163. }
  164.  
  165. // *********************************************************** //
  166. // ************* || P L A Y E R   C H E C K S || ************* //
  167. // *********************************************************** //
  168.  
  169. bool IsValidSurvivor(int survivor)
  170. {
  171.     return (survivor > 0
  172.         && survivor <= MaxClients
  173.         && IsClientInGame(survivor)
  174.         && GetClientTeam(survivor) == 2);
  175. }
  176.  
  177. bool IsValidInfected(int infected)
  178. {
  179.     return (infected > 0
  180.         && infected <= MaxClients
  181.         && IsClientInGame(infected)
  182.         && GetClientTeam(infected) == 3);
  183. }
  184.  
  185. /*************************************************************************************************************************************************/
  186. /*************************************************************************************************************************************************/
  187. /*************************************************************************************************************************************************/
  188.  
  189. // *********************************************************** //
  190. // *********** || E V E N T   F U N C T I O N S || *********** //
  191. // *********************************************************** //
  192.  
  193. public void OnRoundStart_Event(Event event, const char[] name, bool dontBroadcast)
  194. {
  195.     BufferReset();
  196.     g_bbAllowedToSend = true;
  197. }
  198.  
  199. public void OnRoundEnd_Event(Event event, const char[] name, bool dontBroadcast)
  200. {
  201.     if (g_bbAllowedToSend)
  202.     {
  203.         g_bbAllowedToSend = false;
  204.         CreateTimer(1.0, OnRoundEndConsoleInfoTimer);
  205.     }
  206. }
  207.  
  208. /*************************************************************************************************************************************************/
  209. /*************************************************************************************************************************************************/
  210. /*************************************************************************************************************************************************/
  211.  
  212. // *********************************************************** //
  213. // ********** || C A L L   I N F O   E V E N T S || ********** //
  214. // *********************************************************** //
  215.  
  216. static Action ConsoleInfoCommand(int client, any args)
  217. {
  218.     if (!g_bbPlayerCanUseInfoCmd[client])
  219.         return Plugin_Handled;
  220.  
  221.     g_bbPlayerCanUseInfoCmd[client] = false;
  222.     CreateTimer(1.0, AllowInfoCommand, client);
  223.  
  224.     GetSurClients();
  225.  
  226.     GetFormatNames();
  227.  
  228.     GetFormatSpaces();
  229.  
  230.     GetFormatClearTimes();
  231.  
  232.     CreateTimer(0.05, PrintSurvivorHeader, client);
  233.  
  234.     CreateTimer(0.10, PrintSurvivorTableA, client);
  235.  
  236.     CreateTimer(0.15, PrintSurvivorTableB, client);
  237.  
  238.     CreateTimer(0.20, PrintSurvivorTableC, client);
  239.  
  240.     CreateTimer(0.25, PrintSurvivorTableD, client);
  241.  
  242.     CreateTimer(0.30, PrintSurvivorTableE, client);
  243.  
  244.     CreateTimer(0.35, PrintTableSpaces, client);
  245.  
  246.     CreateTimer(0.40, PrintInfectedHeader, client);
  247.  
  248.     CreateTimer(0.45, PrintInfectedTableA, client);
  249.  
  250.     CreateTimer(0.50, PrintInfectedTableB, client);
  251.  
  252.     CreateTimer(0.55, PrintInfectedTableC, client);
  253.  
  254.     CreateTimer(0.60, PrintInfectedTableD, client);
  255.  
  256.     CreateTimer(0.65, PrintInfectedTableE, client);
  257.  
  258.     return Plugin_Handled;
  259. }
  260.  
  261. static Action OnRoundEndConsoleInfoTimer(Handle timer)
  262. {
  263.     GetSurClients();
  264.  
  265.     GetFormatNames();
  266.  
  267.     GetFormatSpaces();
  268.  
  269.     GetFormatClearTimes();
  270.  
  271.     for (int i = 1; i <= MaxClients; i++)
  272.     {
  273.         if (IsClientInGame(i))
  274.         {
  275.             CreateTimer(0.05, PrintSurvivorHeader, i);
  276.  
  277.             CreateTimer(0.10, PrintSurvivorTableA, i);
  278.  
  279.             CreateTimer(0.15, PrintSurvivorTableB, i);
  280.  
  281.             CreateTimer(0.20, PrintSurvivorTableC, i);
  282.  
  283.             CreateTimer(0.25, PrintSurvivorTableD, i);
  284.  
  285.             CreateTimer(0.30, PrintSurvivorTableE, i);
  286.  
  287.             CreateTimer(0.35, PrintTableSpaces, i);
  288.  
  289.             CreateTimer(0.40, PrintInfectedHeader, i);
  290.  
  291.             CreateTimer(0.45, PrintInfectedTableA, i);
  292.  
  293.             CreateTimer(0.50, PrintInfectedTableB, i);
  294.  
  295.             CreateTimer(0.55, PrintInfectedTableC, i);
  296.  
  297.             CreateTimer(0.60, PrintInfectedTableD, i);
  298.  
  299.             CreateTimer(0.65, PrintInfectedTableE, i);
  300.         }
  301.     }
  302. }
  303.  
  304. // *********************************************************** //
  305. // *********** || P R I N T   F U N C T I O N S || *********** //
  306. // *********************************************************** //
  307.  
  308. public Action PrintSurvivorHeader(Handle timer, int client)
  309. {
  310.     PrintToConsole(client, "======================================================================================");
  311.     PrintToConsole(client, "|     Survivor Stats     |%s%s%s|%s%s%s|%s%s%s|%s%s%s|", sSurNameSpaces[0], sSurNames[0], sSurNameSpaces[1], sSurNameSpaces[2], sSurNames[1], sSurNameSpaces[3], sSurNameSpaces[4], sSurNames[2], sSurNameSpaces[5], sSurNameSpaces[6], sSurNames[3], sSurNameSpaces[7]);
  312.     PrintToConsole(client, "======================================================================================");
  313. }
  314.  
  315. public Action PrintSurvivorTableA(Handle timer, int client)
  316. {
  317.     PrintToConsole(client, "|         Kills          |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibAcummulatedSurvivorKills[iSur[0]], g_ibAcummulatedSurvivorKills[iSur[1]], g_ibAcummulatedSurvivorKills[iSur[2]], g_ibAcummulatedSurvivorKills[iSur[3]]);
  318.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  319.     PrintToConsole(client, "|        Assists         |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalAssists[iSur[0]], g_ibTotalAssists[iSur[1]], g_ibTotalAssists[iSur[2]], g_ibTotalAssists[iSur[3]]);
  320.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  321.     PrintToConsole(client, "|        Commons         |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibAcummulatedCommons[iSur[0]], g_ibAcummulatedCommons[iSur[1]], g_ibAcummulatedCommons[iSur[2]], g_ibAcummulatedCommons[iSur[3]]);
  322.     PrintToConsole(client, "======================================================================================");
  323. }
  324.  
  325. public Action PrintSurvivorTableB(Handle timer, int client)
  326. {
  327.     PrintToConsole(client, "|         Skeets         |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalSkeets[iSur[0]], g_ibTotalSkeets[iSur[1]], g_ibTotalSkeets[iSur[2]], g_ibTotalSkeets[iSur[3]]);
  328.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  329.     PrintToConsole(client, "|   Smoker tongue cuts   |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalTongueCuts[iSur[0]], g_ibTotalTongueCuts[iSur[1]], g_ibTotalTongueCuts[iSur[2]], g_ibTotalTongueCuts[iSur[3]]);
  330.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  331.     PrintToConsole(client, "|   Smoker self clears   |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalSmokerSelfClears[iSur[0]], g_ibTotalSmokerSelfClears[iSur[1]], g_ibTotalSmokerSelfClears[iSur[2]], g_ibTotalSmokerSelfClears[iSur[3]]);
  332.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  333. }
  334.  
  335. public Action PrintSurvivorTableC(Handle timer, int client)
  336. {
  337.     PrintToConsole(client, "|     Charger levels     |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalChargerLevels[iSur[0]], g_ibTotalChargerLevels[iSur[1]], g_ibTotalChargerLevels[iSur[2]], g_ibTotalChargerLevels[iSur[3]]);
  338.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  339.     PrintToConsole(client, "|  Charger hurt levels   |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalChargerLevelHurts[iSur[0]], g_ibTotalChargerLevelHurts[iSur[1]], g_ibTotalChargerLevelHurts[iSur[2]], g_ibTotalChargerLevelHurts[iSur[3]]);
  340.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  341.     PrintToConsole(client, "|      Boomer pops       |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalBoomerPops[iSur[0]], g_ibTotalBoomerPops[iSur[1]], g_ibTotalBoomerPops[iSur[2]], g_ibTotalBoomerPops[iSur[3]]);
  342.     PrintToConsole(client, "======================================================================================");
  343. }
  344.  
  345. public Action PrintSurvivorTableD(Handle timer, int client)
  346. {
  347.     PrintToConsole(client, "|   Tank rocks skeeted   |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalRockSkeet[iSur[0]], g_ibTotalRockSkeet[iSur[1]], g_ibTotalRockSkeet[iSur[2]], g_ibTotalRockSkeet[iSur[3]]);
  348.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  349.     PrintToConsole(client, "|    Tank rocks eated    |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalSurvivorTankRockHits[iSur[0]], g_ibTotalSurvivorTankRockHits[iSur[1]], g_ibTotalSurvivorTankRockHits[iSur[2]], g_ibTotalSurvivorTankRockHits[iSur[3]]);
  350.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  351.     PrintToConsole(client, "|   Clear time average   |%s|%s|%s|%s|", sClearTimes[0], sClearTimes[1], sClearTimes[2], sClearTimes[3]);
  352.     PrintToConsole(client, "======================================================================================");
  353. }
  354.  
  355. public Action PrintSurvivorTableE(Handle timer, int client)
  356. {
  357.     PrintToConsole(client, "|        Incaps          |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalSurvivorIncaps[iSur[0]], g_ibTotalSurvivorIncaps[iSur[1]], g_ibTotalSurvivorIncaps[iSur[2]], g_ibTotalSurvivorIncaps[iSur[3]]);
  358.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  359.     PrintToConsole(client, "|     Friendly fire      |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalFriendlyFire[iSur[0]], g_ibTotalFriendlyFire[iSur[1]], g_ibTotalFriendlyFire[iSur[2]], g_ibTotalFriendlyFire[iSur[3]]);
  360.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  361.     PrintToConsole(client, "|       Pills used       |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalUsedPills[iSur[0]], g_ibTotalUsedPills[iSur[1]], g_ibTotalUsedPills[iSur[2]], g_ibTotalUsedPills[iSur[3]]);
  362.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  363.     PrintToConsole(client, "|     Hunter pounces     |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalSurvivorPounced[iSur[0]], g_ibTotalSurvivorPounced[iSur[1]], g_ibTotalSurvivorPounced[iSur[2]], g_ibTotalSurvivorPounced[iSur[3]]);
  364.     PrintToConsole(client, "======================================================================================");
  365. }
  366.  
  367. public Action PrintTableSpaces(Handle timer, int client)
  368. {
  369.     PrintToConsole(client, " ");
  370.     PrintToConsole(client, " ");
  371. }
  372.  
  373. public Action PrintInfectedHeader(Handle timer, int client)
  374. {
  375.     PrintToConsole(client, "======================================================================================");
  376.     PrintToConsole(client, "|     Infected Stats     |%s%s%s|%s%s%s|%s%s%s|%s%s%s|", sInfNameSpaces[0], sInfNames[0], sInfNameSpaces[1], sInfNameSpaces[2], sInfNames[1], sInfNameSpaces[3], sInfNameSpaces[4], sInfNames[2], sInfNameSpaces[5], sInfNameSpaces[6], sInfNames[3], sInfNameSpaces[7]);
  377.     PrintToConsole(client, "======================================================================================");
  378. }
  379.  
  380. public Action PrintInfectedTableA(Handle timer, int client)
  381. {
  382.     PrintToConsole(client, "|         Kills          |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibAcummulatedInfectedKills[iInf[0]], g_ibAcummulatedInfectedKills[iInf[1]], g_ibAcummulatedInfectedKills[iInf[2]], g_ibAcummulatedInfectedKills[iInf[3]]);
  383.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  384.     PrintToConsole(client, "|        Incaps          |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibAcummulatedInfectedIncap[iInf[0]], g_ibAcummulatedInfectedIncap[iInf[1]], g_ibAcummulatedInfectedIncap[iInf[2]], g_ibAcummulatedInfectedIncap[iInf[3]]);
  385.     PrintToConsole(client, "======================================================================================");
  386. }
  387.  
  388. public Action PrintInfectedTableB(Handle timer, int client)
  389. {
  390.     PrintToConsole(client, "|      Hunter caps       |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalHunterCaps[iInf[0]], g_ibTotalHunterCaps[iInf[1]], g_ibTotalHunterCaps[iInf[2]], g_ibTotalHunterCaps[iInf[3]]);
  391.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  392.     PrintToConsole(client, "|     Hunter pounces     |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalHunterPounces[iInf[0]], g_ibTotalHunterPounces[iInf[1]], g_ibTotalHunterPounces[iInf[2]], g_ibTotalHunterPounces[iInf[3]]);
  393.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  394.     PrintToConsole(client, "|      Jockey caps       |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalJockeyCaps[iInf[0]], g_ibTotalJockeyCaps[iInf[1]], g_ibTotalJockeyCaps[iInf[2]], g_ibTotalJockeyCaps[iInf[3]]);
  395.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  396. }
  397.  
  398. public Action PrintInfectedTableC(Handle timer, int client)
  399. {
  400.     PrintToConsole(client, "|      Smoker caps       |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalSmokerCaps[iInf[0]], g_ibTotalSmokerCaps[iInf[1]], g_ibTotalSmokerCaps[iInf[2]], g_ibTotalSmokerCaps[iInf[3]]);
  401.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  402.     PrintToConsole(client, "|      Charger caps      |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalChargerCaps[iInf[0]], g_ibTotalChargerCaps[iInf[1]], g_ibTotalChargerCaps[iInf[2]], g_ibTotalChargerCaps[iInf[3]]);
  403.     PrintToConsole(client, "======================================================================================");
  404. }
  405.  
  406. public Action PrintInfectedTableD(Handle timer, int client)
  407. {
  408.     PrintToConsole(client, "|     Boomer damage      |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalBoomerDamage[iInf[0]], g_ibTotalBoomerDamage[iInf[1]], g_ibTotalBoomerDamage[iInf[2]], g_ibTotalBoomerDamage[iInf[3]]);
  409.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  410.     PrintToConsole(client, "|     Spitter damage     |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalSpitterDamage[iInf[0]], g_ibTotalSpitterDamage[iInf[1]], g_ibTotalSpitterDamage[iInf[2]], g_ibTotalSpitterDamage[iInf[3]]);
  411.     PrintToConsole(client, "======================================================================================");
  412. }
  413.  
  414. public Action PrintInfectedTableE(Handle timer, int client)
  415. {
  416.     PrintToConsole(client, "|       Tank hits        |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalTankPunch[iInf[0]], g_ibTotalTankPunch[iInf[1]], g_ibTotalTankPunch[iInf[2]], g_ibTotalTankPunch[iInf[3]]);
  417.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  418.     PrintToConsole(client, "|   Tank hittable hits   |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalTankPropHits[iInf[0]], g_ibTotalTankPropHits[iInf[1]], g_ibTotalTankPropHits[iInf[2]], g_ibTotalTankPropHits[iInf[3]]);
  419.     PrintToConsole(client, "|------------------------|--------------|--------------|--------------|--------------|");
  420.     PrintToConsole(client, "|      Tank incaps       |     %3d      |     %3d      |     %3d      |     %3d      |", g_ibTotalTankIncaps[iInf[0]], g_ibTotalTankIncaps[iInf[1]], g_ibTotalTankIncaps[iInf[2]], g_ibTotalTankIncaps[iInf[3]]);
  421.     PrintToConsole(client, "======================================================================================");
  422. }
  423.  
  424. // *********************************************************** //
  425. // ********** || F O R M A T   F U N C T I O N S || ********** //
  426. // *********************************************************** //
  427.  
  428. static void GetSurClients()
  429. {
  430.     int iSurCount;
  431.     int iInfCount;
  432.  
  433.     for (int i = 1; i <= MaxClients; i++)
  434.     {
  435.         if (IsValidSurvivor(i))
  436.         {
  437.             iSur[iSurCount] = i;
  438.             iSurCount++;       
  439.         }
  440.         else if (IsValidInfected(i))
  441.         {
  442.             iInf[iInfCount] = i;
  443.             iInfCount++;
  444.         }
  445.     }
  446. }
  447.  
  448. static void GetFormatNames()
  449. {
  450.     char sNone[] = "none";
  451.  
  452.     for (int i = 0; i < 4; i++)
  453.     {
  454.         if (!iSur[i])
  455.             strcopy(sSurNames[i], sizeof(sSurNames), sNone);
  456.         else
  457.             GetClientName(iSur[i], sSurNames[i], sizeof(sSurNames));
  458.  
  459.         if (!iInf[i])
  460.             strcopy(sInfNames[i], sizeof(sInfNames), sNone);
  461.         else
  462.             GetClientName(iInf[i], sInfNames[i], sizeof(sInfNames));
  463.     }
  464.  
  465.     for (int i = 0; i < 4; i++)
  466.     {
  467.         if (strlen(sSurNames[i]) > 14)
  468.         {
  469.             sSurNames[i][11] = '.';
  470.             sSurNames[i][12] = '.';
  471.             sSurNames[i][13] = '.';
  472.             sSurNames[i][14] = 0;
  473.         }
  474.  
  475.         if (strlen(sInfNames[i]) > 14)
  476.         {
  477.             sInfNames[i][11] = '.';
  478.             sInfNames[i][12] = '.';
  479.             sInfNames[i][13] = '.';
  480.             sInfNames[i][14] = 0;
  481.         }
  482.     }
  483. }
  484.  
  485. static void GetFormatSpaces()
  486. {
  487.     for (int i = 0; i < 8; i++)
  488.     {
  489.         for (int j = 0; j < 7; j++)
  490.         {
  491.             sSurNameSpaces[i][j] = ' ';
  492.             sInfNameSpaces[i][j] = ' ';
  493.         }
  494.  
  495.         sSurNameSpaces[i][7] = 0;
  496.         sInfNameSpaces[i][7] = 0;  
  497.     }
  498.  
  499.     for (int i = 0; i < 4; i++)
  500.     {
  501.         int iMissingSpaceSur = 14 - strlen(sSurNames[i]);
  502.         int iSurSpaceLeft = RoundFloat(iMissingSpaceSur / 2.0 - 0.25);
  503.         int iSurSpaceRight = RoundFloat(iMissingSpaceSur /2.0 + 0.25);
  504.  
  505.         sSurNameSpaces[i*2][iSurSpaceLeft] = 0;
  506.         sSurNameSpaces[i*2+1][iSurSpaceRight] = 0;
  507.  
  508.         int iMissingSpaceInf = 14 - strlen(sInfNames[i]);
  509.         int iInfSpaceLeft = RoundFloat(iMissingSpaceInf / 2.0 - 0.25);
  510.         int iInfSpaceRight = RoundFloat(iMissingSpaceInf /2.0 + 0.25);
  511.  
  512.         sInfNameSpaces[i*2][iInfSpaceLeft] = 0;
  513.         sInfNameSpaces[i*2+1][iInfSpaceRight] = 0;
  514.     }
  515. }
  516.  
  517. static void GetFormatClearTimes()
  518. {
  519.     for (int i = 0; i < 4; i++)
  520.     {
  521.         if (GetClearTimeAverage(iSur[i]) < 10.0 && GetClearTimeAverage(iSur[i]) != -1.0)
  522.         {
  523.             char sFormatClearTimes[] = "     %2fs      ";
  524.             FormatEx(sClearTimes[i], sizeof(sClearTimes), sFormatClearTimes, GetClearTimeAverage(iSur[i]));
  525.         }
  526.         else if (GetClearTimeAverage(iSur[i]) >= 10.0)
  527.         {
  528.             char sFormatClearTimes[] = "     %2fs     ";
  529.             FormatEx(sClearTimes[i], sizeof(sClearTimes), sFormatClearTimes, GetClearTimeAverage(iSur[i]));
  530.         }
  531.         else
  532.         {
  533.             char sFormatClearTimes[] = "  No clears!  ";
  534.             strcopy(sClearTimes[i], sizeof(sClearTimes), sFormatClearTimes);
  535.         }
  536.     }
  537. }
  538.  
  539. float GetClearTimeAverage(int client)
  540. {
  541.     float fTimeBuffer;
  542.  
  543.     int iClearsAmount;
  544.  
  545.     for (int i = 0; i < 512; i++)
  546.     {
  547.         if (g_fbClearsTime[client][i] != -1.0)
  548.         {
  549.             fTimeBuffer += g_fbClearsTime[client][i];
  550.  
  551.             iClearsAmount++;
  552.         }
  553.     }
  554.    
  555.     if (iClearsAmount)
  556.         return fTimeBuffer / iClearsAmount;
  557.     else
  558.         return -1.0;
  559. }
  560.  
  561. /*************************************************************************************************************************************************/
  562. /*************************************************************************************************************************************************/
  563. /*************************************************************************************************************************************************/
  564.  
  565. // *********************************************************** //
  566. // ************* || M A I N   F O R W A R D S || ************* //
  567. // *********************************************************** //
  568.  
  569. //// [ SURVIVOR ] ////
  570.  
  571. public void EloSurvivorKill(int survivor)
  572. {
  573.     g_ibAcummulatedSurvivorKills[survivor]++;
  574. }
  575.  
  576. public void EloSurvivorKill2(int survivor)
  577. {
  578.     g_ibAcummulatedSurvivorKills[survivor]++;
  579. }
  580.  
  581. public void EloSurvivorKill3(int survivor)
  582. {
  583.     g_ibAcummulatedSurvivorKills[survivor]++;
  584. }
  585.  
  586. public void EloSurvivorKill4(int survivor)
  587. {
  588.     g_ibAcummulatedSurvivorKills[survivor]++;
  589. }
  590.  
  591. public void EloSurvivorAssist(int survivor)
  592. {
  593.     g_ibTotalAssists[survivor]++;
  594. }
  595.  
  596. public void EloSurvivorSkeet(int survivor)
  597. {
  598.     g_ibTotalSkeets[survivor]++;
  599. }
  600.  
  601. public void EloSurvivorSkeetHurt(int survivor)
  602. {
  603.     g_ibTotalSkeets[survivor]++;
  604. }
  605.  
  606. public void EloSurvivorSkeetMelee(int survivor)
  607. {
  608.     g_ibTotalSkeets[survivor]++;
  609. }
  610.  
  611. public void EloSurvivorSkeetSmg(int survivor)
  612. {
  613.     g_ibTotalSkeets[survivor]++;
  614. }
  615.  
  616. public void EloSurvivorSkeetMagnum(int survivor)
  617. {
  618.     g_ibTotalSkeets[survivor]++;
  619. }
  620.  
  621. public void EloSurvivorSkeetMagnumHeadShot(int survivor)
  622. {
  623.     g_ibTotalSkeets[survivor]++;
  624. }
  625.  
  626. public void EloSurvivorBoomerPop(int survivor)
  627. {
  628.     g_ibTotalBoomerPops[survivor]++;
  629. }
  630.  
  631. public void EloSurvivorSmokerSelfClear(int survivor)
  632. {
  633.     g_ibTotalSmokerSelfClears[survivor]++;
  634. }
  635.  
  636. public void EloSurvivorSmokerTongueCut(int survivor)
  637. {
  638.     g_ibTotalTongueCuts[survivor]++;
  639. }
  640.  
  641. public void EloSurvivorJockeySkeet(int survivor)
  642. {
  643.     g_ibTotalJockeySkeets[survivor]++;
  644. }
  645.  
  646. public void EloSurvivorChargerLevel(int survivor)
  647. {
  648.     g_ibTotalChargerLevels[survivor]++;
  649. }
  650.  
  651. public void EloSurvivorChargerLevelHurt(int survivor)
  652. {
  653.     g_ibTotalChargerLevelHurts[survivor]++;
  654. }
  655.  
  656. public void EloSurvivorRockSkeet(int survivor)
  657. {
  658.     g_ibTotalRockSkeet[survivor]++;
  659. }
  660.  
  661. public void EloSurvivorClearTime(int survivor, float ftime)
  662. {
  663.     for (int i = 1; i <= 512; i++)
  664.     {
  665.         if (g_fbClearsTime[float(survivor)][float(i)] == -1.0)
  666.         {
  667.             g_fbClearsTime[float(survivor)][float(i)] = ftime;
  668.  
  669.             break;
  670.         }
  671.     }
  672. }
  673.  
  674. public void EloSurvivorCommons(int survivor)
  675. {
  676.     g_ibAcummulatedCommons[survivor]++;
  677. }
  678.  
  679. public void EloSurvivorIncapacitated(int survivor)
  680. {
  681.     g_ibTotalSurvivorIncaps[survivor]++;
  682. }
  683.  
  684. public void EloSurvivorFF(int survivor, int damage)
  685. {
  686.     g_ibTotalFriendlyFire[survivor] += damage;
  687. }
  688.  
  689. public void EloSurvivorTankRockEaten(int survivor)
  690. {
  691.     g_ibTotalSurvivorTankRockHits[survivor]++;
  692. }
  693.  
  694. public void g_hEloSurvivorPounced15(int survivor)
  695. {
  696.     g_ibTotalSurvivorPounced[survivor]++;
  697. }
  698.  
  699. public void g_hEloSurvivorPounced20(int survivor)
  700. {
  701.     g_ibTotalSurvivorPounced[survivor]++;
  702. }
  703.  
  704. public void g_hEloSurvivorPounced25(int survivor)
  705. {
  706.     g_ibTotalSurvivorPounced[survivor]++;
  707. }
  708.  
  709. public void EloSurvivorPillsUsed(int survivor)
  710. {
  711.     g_ibTotalUsedPills[survivor]++;
  712. }
  713.  
  714. //// [ INFECTED ] ////
  715.  
  716. public void EloInfectedDamage(int infected, int damage)
  717. {
  718.     if (GetEntProp(infected, Prop_Send, "m_zombieClass") == 2)
  719.         g_ibTotalBoomerDamage[infected] += damage;
  720.     if (GetEntProp(infected, Prop_Send, "m_zombieClass") == 4)
  721.         g_ibTotalSpitterDamage[infected] += damage;
  722. }
  723.  
  724. public void EloInfectedKill(int infected)
  725. {
  726.     g_ibAcummulatedInfectedKills[infected]++;
  727. }
  728.  
  729. public void EloInfectedIncap(int infected)
  730. {
  731.     g_ibAcummulatedInfectedIncap[infected]++;
  732. }
  733.  
  734. public void EloInfectedHunterCap(int infected)
  735. {
  736.     g_ibTotalHunterCaps[infected]++;
  737. }
  738.  
  739. public void EloInfectedHighPounce15(int infected)
  740. {
  741.     g_ibTotalHunterPounces[infected]++;
  742. }
  743.  
  744. public void EloInfectedHighPounce20(int infected)
  745. {
  746.     g_ibTotalHunterPounces[infected]++;
  747. }
  748.  
  749. public void EloInfectedHighPounce25(int infected)
  750. {
  751.     g_ibTotalHunterPounces[infected]++;
  752. }
  753.  
  754. public void EloInfectedJockeyCap(int infected)
  755. {
  756.     g_ibTotalJockeyCaps[infected]++;
  757. }
  758.  
  759. public void EloInfectedSmokerCap(int infected)
  760. {
  761.     g_ibTotalSmokerCaps[infected]++;
  762. }
  763.  
  764. public void EloInfectedChargerCap(int infected)
  765. {
  766.     g_ibTotalChargerCaps[infected]++;
  767. }
  768.  
  769. public void EloInfectedChargerImpact(int infected)
  770. {
  771.     g_ibTotalChargerImpacts[infected]++;
  772. }
  773.  
  774. public void EloInfectedChargerInstaKill(int infected)
  775. {
  776.     g_ibTotalChargerInstaKills[infected]++;
  777. }
  778.  
  779. public void EloInfectedBoomerVomit1(int infected)
  780. {
  781.     g_ibTotalBoomerVomits[infected]++;
  782. }
  783.  
  784. public void EloInfectedBoomerVomit2(int infected)
  785. {
  786.     g_ibTotalBoomerVomits[infected] += 2;
  787. }
  788.  
  789. public void EloInfectedBoomerVomit3(int infected)
  790. {
  791.     g_ibTotalBoomerVomits[infected] += 3;
  792. }
  793.  
  794. public void EloInfectedBoomerVomit4(int infected)
  795. {
  796.     g_ibTotalBoomerVomits[infected] += 4;
  797. }
  798.  
  799. public void EloInfectedTankPunch(int infected)
  800. {
  801.     g_ibTotalTankPunch[infected]++;
  802. }
  803.  
  804. public void EloInfectedTankPropHit(int infected)
  805. {
  806.     g_ibTotalTankPropHits[infected]++;
  807. }
  808.  
  809. public void EloInfectedTankIncap(int infected)
  810. {
  811.     g_ibTotalTankIncaps[infected]++;
  812. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement