Guest User

Untitled

a guest
Dec 12th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.95 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <csx>
  5.  
  6. #define MAXPLAYERS 33
  7.  
  8. #define HITS_SIZE 8
  9. #define CSW_SIZE 32
  10.  
  11. enum _:STATS{
  12. _Kills,
  13. _Deaths,
  14. _Suicides,
  15. _Headshots,
  16. _Hits,
  17. _Damage,
  18. _Bomb_Planting,
  19. _Bomb_Planted,
  20. _Bomb_Defusing,
  21. _Bomb_Defused,
  22. _Rounds_Played,
  23. _Round_Wins,
  24. _Rounds_Loses
  25. };
  26.  
  27. new StatsData[MAXPLAYERS][STATS];
  28. new StatsHits[MAXPLAYERS][HITS_SIZE];
  29.  
  30. new WeaponsKills[MAXPLAYERS][CSW_SIZE];
  31. new WeaponsDeath[MAXPLAYERS][CSW_SIZE];
  32.  
  33.  
  34. public plugin_init()
  35. {
  36. register_plugin("Custom Stats",AMXX_VERSION_STR,"SGG");
  37.  
  38. register_event("SendAudio","TeamsWon","a","2=%!MRAD_terwin","2=%!MRAD_ctwin");
  39.  
  40. register_clcmd("say", "cmdSay")
  41. register_clcmd("say_team", "cmdSay")
  42. }
  43.  
  44. public cmdSay(id)
  45. {
  46.  
  47. static iTarget, szText[ 32 ], szCommand[ 32 ], szTarget[ 32 ]
  48.  
  49. read_args( szText, charsmax( szText ) )
  50.  
  51. remove_quotes( szText )
  52.  
  53. strtok( szText,szCommand,31,szTarget,31,'=',1 )
  54.  
  55. if ( equali( szCommand, ".info" ) )
  56. {
  57. iTarget = cmd_target( id, szTarget, CMDTARGET_NO_BOTS )
  58.  
  59. if ( iTarget ) ShowMotd( id,iTarget )
  60.  
  61. return PLUGIN_HANDLED
  62. }
  63.  
  64. return PLUGIN_CONTINUE;
  65. }
  66.  
  67. public client_death(Attacker,Victim,WP,Place,TK)
  68. {
  69.  
  70. if(WP == CSW_C4) return;
  71.  
  72. if(Place == HIT_HEAD) StatsData[Attacker][_Headshots]++;
  73.  
  74. if(Attacker == Victim) StatsData[Attacker][_Suicides]++;
  75.  
  76. StatsData[Attacker][_Kills]++;
  77. StatsData[Victim][_Deaths]++;
  78.  
  79. WeaponsKills[Attacker][WP]++;
  80. WeaponsDeath[Victim][WP]++;
  81. }
  82.  
  83. public client_damage(Attacker,Victim,Damage,WP,Place,TA)
  84. {
  85. StatsData[Attacker][_Hits]++;
  86. StatsData[Attacker][_Damage] += Damage;
  87.  
  88. StatsHits[Attacker][Place]++;
  89. }
  90.  
  91. public TeamsWon()
  92. {
  93.  
  94. static Message[32];
  95. read_data(2,Message,charsmax(Message));
  96.  
  97. new iPlayers[32],iNum,Players;
  98. get_players(iPlayers,iNum,"h");
  99.  
  100. if(containi(Message,"ter") != -1)
  101. {
  102. for(new i;i < iNum;i++)
  103. {
  104. Players = iPlayers[i];
  105.  
  106. switch(cs_get_user_team(Players))
  107. {
  108. case CS_TEAM_T:
  109. {
  110. StatsData[Players][_Rounds_Played]++;
  111.  
  112. StatsData[Players][_Round_Wins]++;
  113. }
  114. case CS_TEAM_CT:
  115. {
  116. StatsData[Players][_Rounds_Played]++;
  117.  
  118. StatsData[Players][_Rounds_Loses]++;
  119. }
  120. }
  121. }
  122. }
  123. else if(containi(Message,"ct") != -1)
  124. {
  125. for(new i;i < iNum;i++)
  126. {
  127. Players = iPlayers[i];
  128.  
  129. switch(cs_get_user_team(Players))
  130. {
  131. case CS_TEAM_T:
  132. {
  133. StatsData[Players][_Rounds_Played]++;
  134.  
  135. StatsData[Players][_Rounds_Loses]++;
  136. }
  137. case CS_TEAM_CT:
  138. {
  139. StatsData[Players][_Rounds_Played]++;
  140.  
  141. StatsData[Players][_Round_Wins]++;
  142. }
  143. }
  144. }
  145. }
  146. }
  147.  
  148. public bomb_planting(id)
  149. {
  150. StatsData[id][_Bomb_Planting]++;
  151. }
  152.  
  153. public bomb_planted(id)
  154. {
  155. StatsData[id][_Bomb_Planted]++;
  156. }
  157.  
  158. public bomb_defusing(id)
  159. {
  160. StatsData[id][_Bomb_Defusing]++;
  161. }
  162.  
  163. public bomb_defused(id)
  164. {
  165. StatsData[id][_Bomb_Defused]++;
  166. }
  167.  
  168. stock ShowMotd( const id,const target )
  169. {
  170. static szName[32], Info[1501], len;
  171. get_user_name(target, szName, charsmax(szName))
  172.  
  173. len = format(Info, 1500,"<body bgcolor=#000000><font color=#87cefa><pre>");
  174. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Player:</B><font color=^"white^">%s</color></left>^n", szName);
  175. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Frags:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Kills]);
  176. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Deaths:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Deaths]);
  177. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Damage:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Damage]);
  178. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Hits:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Hits]);
  179. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Headshots:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Headshots]);
  180. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Rounds_Played:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Rounds_Played]);
  181. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Wins:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Round_Wins]);
  182. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Losses:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Rounds_Loses]);
  183. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Bombs Defused:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Bomb_Defused]);
  184. len += format(Info[len], 1500-len,"<left><font color=^"red^"><B>Bombs Planted:</B><font color=^"white^">%d</color></left>^n", StatsData[target][_Bomb_Planted]);
  185.  
  186. show_motd(id, Info, "Stats");
  187.  
  188. return 1;
  189. }
Add Comment
Please, Sign In to add comment