Guest User

Untitled

a guest
Aug 2nd, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 120.36 KB | None | 0 0
  1. /*
  2. *================================
  3. * Íàçâàíèå: statsx_shell
  4. * Âåðñèÿ : 2.0.0 (BETA)
  5. * Êîä: AMX Dev Team
  6. * Äîðàáîòêà: MastaMan
  7. * ----------------------
  8. * Äîñòóïíûå ÿçûêè: RU, UA, EN
  9. *
  10. * Èñòî÷íèê: http://amx-server.blogspot.com
  11. * ================================
  12. */
  13. /* AMX Mod X
  14. * StatsX Plugin
  15. *
  16. * by the AMX Mod X Development Team
  17. * originally developed by OLO
  18. *
  19. * This file is part of AMX Mod X.
  20. *
  21. *
  22. * This program is free software; you can redistribute it and/or modify it
  23. * under the terms of the GNU General Public License as published by the
  24. * Free Software Foundation; either version 2 of the License, or (at
  25. * your option) any later version.
  26. *
  27. * This program is distributed in the hope that it will be useful, but
  28. * WITHOUT ANY WARRANTY; without even the implied warranty of
  29. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  30. * General Public License for more details.
  31. *
  32. * You should have received a copy of the GNU General Public License
  33. * along with this program; if not, write to the Free Software Foundation,
  34. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  35. *
  36. * In addition, as a special exception, the author gives permission to
  37. * link the code of this program with the Half-Life Game Engine ("HL
  38. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  39. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  40. * respects for all of the code used other than the HL Engine and MODs
  41. * from Valve. If you modify this file, you may extend this exception
  42. * to your version of the file, but you are not obligated to do so. If
  43. * you do not wish to do so, delete this exception statement from your
  44. * version.
  45. */
  46.  
  47. //--------------------------------
  48. #include <amxmodx>
  49. #include <amxmisc>
  50. #include <csx>
  51. #include <cstrike>
  52. #include <nvault>
  53.  
  54. #define STATSX_SHELL_VER "2.0.0 (BETA)"
  55. //--------------------------------
  56.  
  57. /*Color Chat*/
  58. #define MAXSLOTS 32
  59.  
  60. enum ChatColor
  61. {
  62. CHATCOLOR_NORMAL = 1,
  63. CHATCOLOR_GREEN,
  64. CHATCOLOR_TEAM_COLOR,
  65. CHATCOLOR_GREY,
  66. CHATCOLOR_RED,
  67. CHATCOLOR_BLUE,
  68. }
  69.  
  70. new g_TeamName[][] =
  71. {
  72. "",
  73. "TERRORIST",
  74. "CT",
  75. "SPECTATOR"
  76. }
  77.  
  78. new g_msgSayText
  79. new g_msgTeamInfo
  80.  
  81. // Uncomment to activate log debug messages.
  82. //#define STATSX_DEBUG
  83.  
  84. // HUD statistics duration in seconds (minimum 1.0 seconds).
  85. #define HUD_DURATION_CVAR "amx_statsx_duration"
  86. #define HUD_DURATION "12.0"
  87.  
  88. // HUD statistics stop relative freeze end in seconds.
  89. // To stop before freeze end use a negative value.
  90. #define HUD_FREEZE_LIMIT_CVAR "amx_statsx_freeze"
  91. #define HUD_FREEZE_LIMIT "-2.0"
  92.  
  93. // HUD statistics minimum duration, in seconds, to trigger the display logic.
  94. #define HUD_MIN_DURATION 0.2
  95.  
  96. // Config plugin constants.
  97. #define MODE_HUD_DELAY 0 // Make a 0.01 sec delay on HUD reset process.
  98.  
  99. // You can also manualy enable or disable these options by setting them to 1
  100. // For example:
  101. // public ShowAttackers = 1
  102. // However amx_statscfg command is recommended
  103.  
  104. public KillerChat = 0 // displays killer hp&ap to victim console
  105. // and screen
  106.  
  107. public ShowAttackers = 0 // shows attackers
  108. public ShowVictims = 0 // shows victims
  109. public ShowKiller = 0 // shows killer
  110. public ShowTeamScore = 0 // shows team score at round end
  111. public ShowTotalStats = 0 // shows round total stats
  112. public ShowBestScore = 0 // shows rounds best scored player
  113. public ShowMostDisruptive = 0 // shows rounds most disruptive player
  114.  
  115. public EndPlayer = 0 // displays player stats at the end of map
  116. public EndTop15 = 0 // displays top15 at the end of map
  117.  
  118. public SayHP = 0 // displays information about user killer
  119. public SayStatsMe = 0 // displays user's stats and rank
  120. public SayRankStats = 0 // displays user's rank stats
  121. public SayMe = 0 // displays user's stats
  122. public SayRank = 0 // displays user's rank
  123. public SayReport = 0 // report user's weapon status to team
  124. public SayScore = 0 // displays team's map score
  125. public SayTop15 = 0 // displays first 15 players
  126. public SayStatsAll = 0 // displays all players stats and rank
  127.  
  128. public ShowStats = 1 // set client HUD-stats switched off by default
  129. public ShowDistHS = 0 // show distance and HS in attackers and
  130. // victims HUD lists
  131. public ShowFullStats = 0 // show full HUD stats (more than 78 chars)
  132.  
  133. public SpecRankInfo = 0 // displays rank info when spectating
  134.  
  135. // Standard Contstants.
  136. #define MAX_TEAMS 2
  137. #define MAX_PLAYERS 32 + 1
  138.  
  139. #define MAX_NAME_LENGTH 128
  140. #define MAX_WEAPON_LENGTH 31
  141. #define MAX_TEXT_LENGTH 255
  142. #define MAX_BUFFER_LENGTH 2047
  143.  
  144. // User stats parms id
  145. #define STATS_KILLS 0
  146. #define STATS_DEATHS 1
  147. #define STATS_HS 2
  148. #define STATS_TKS 3
  149. #define STATS_SHOTS 4
  150. #define STATS_HITS 5
  151. #define STATS_DAMAGE 6
  152.  
  153. // Global player flags.
  154. new BODY_PART[8][] =
  155. {
  156. "WHOLEBODY",
  157. "HEAD",
  158. "CHEST",
  159. "STOMACH",
  160. "LEFTARM",
  161. "RIGHTARM",
  162. "LEFTLEG",
  163. "RIGHTLEG"
  164. }
  165.  
  166. new MM_BODY_PART[8][] =
  167. {
  168. "WHOLEBODY",
  169. "HEAD",
  170. "CHEST",
  171. "STOMACH",
  172. "MM_LEFTARM",
  173. "MM_RIGHTARM",
  174. "MM_LEFTLEG",
  175. "MM_RIGHTLEG"
  176. }
  177.  
  178. // Killer information, save killer info at the time when player is killed.
  179. #define KILLED_KILLER_ID 0 // Killer userindex/user-ID
  180. #define KILLED_KILLER_HEALTH 1 // Killer's health
  181. #define KILLED_KILLER_ARMOUR 2 // Killer's armour
  182. #define KILLED_TEAM 3 // Killer's team
  183. #define KILLED_KILLER_STATSFIX 4 // Fix to register the last hit/kill
  184.  
  185. new g_izKilled[MAX_PLAYERS][5]
  186.  
  187. // Menu variables and configuration
  188. #define MAX_PPL_MENU_ACTIONS 2 // Number of player menu actions
  189. #define PPL_MENU_OPTIONS 7 // Number of player options per displayed menu
  190.  
  191. new g_iPluginMode = 0
  192.  
  193. new g_izUserMenuPosition[MAX_PLAYERS] = {0, ...}
  194. new g_izUserMenuAction[MAX_PLAYERS] = {0, ...}
  195. new g_izUserMenuPlayers[MAX_PLAYERS][32]
  196.  
  197. new g_izSpecMode[MAX_PLAYERS] = {0, ...}
  198.  
  199. new g_izShowStatsFlags[MAX_PLAYERS] = {0, ...}
  200. new g_izStatsSwitch[MAX_PLAYERS] = {0, ...}
  201. new Float:g_fzShowUserStatsTime[MAX_PLAYERS] = {0.0, ...}
  202. new Float:g_fShowStatsTime = 0.0
  203. new Float:g_fFreezeTime = 0.0
  204. new Float:g_fFreezeLimitTime = 0.0
  205. new Float:g_fHUDDuration = 0.0
  206.  
  207. new g_iRoundEndTriggered = 0
  208. new g_iRoundEndProcessed = 0
  209.  
  210. new Float:g_fStartGame = 0.0
  211. new g_izTeamScore[MAX_TEAMS] = {0, ...}
  212. new g_izTeamEventScore[MAX_TEAMS] = {0, ...}
  213. new g_izTeamRndStats[MAX_TEAMS][8]
  214. new g_izTeamGameStats[MAX_TEAMS][8]
  215. new g_izUserUserID[MAX_PLAYERS] = {0, ...}
  216. new g_izUserAttackerDistance[MAX_PLAYERS] = {0, ...}
  217. new g_izUserVictimDistance[MAX_PLAYERS][MAX_PLAYERS]
  218. new g_izUserRndName[MAX_PLAYERS][MAX_NAME_LENGTH + 1]
  219. new g_izUserRndStats[MAX_PLAYERS][8]
  220. new g_izUserGameStats[MAX_PLAYERS][8]
  221.  
  222. // Common buffer to improve performance, as Small always zero-initializes all vars
  223. new g_sBuffer[MAX_BUFFER_LENGTH + 1] = ""
  224. new g_sScore[MAX_TEXT_LENGTH + 1] = ""
  225. new g_sAwardAndScore[MAX_BUFFER_LENGTH + 1] = ""
  226.  
  227. new t_sText[MAX_TEXT_LENGTH + 1] = ""
  228. new t_sName[MAX_NAME_LENGTH + 1] = ""
  229. new t_sWpn[MAX_WEAPON_LENGTH + 1] = ""
  230.  
  231. new g_HudSync_EndRound
  232. new g_HudSync_SpecInfo
  233.  
  234. // MastaMan Edition
  235.  
  236. #define MAX_SORT_COUNT 100
  237.  
  238. #define MM_MINUTE 60
  239. #define MM_HOUR 3600
  240. #define MM_DAY 86400
  241. #define MM_WEEK 604800
  242. #define MM_MONTH 2592000
  243. #define MM_YEAR 31536000
  244.  
  245. new bool:szTrigger = true
  246.  
  247. new iTopX, iTopEnd, iAwardID, iDesign, g_Vault, g_Vault2
  248.  
  249. new pcvar_statsmarquee, pcvar_statsmarquee_effect, pcvar_statsmarquee_color, pcvar_statsmarquee_position
  250. new pcvar_award, pcvar_award_anonce_chat, pcvar_award_chance, pcvar_award_cash, pcvar_dmg, pcvar_hs, pcvar_bot, pcvar_topx
  251. new pcvar_style, pcvar_design, pcvar_day, pcvar_connect_message, pcvar_hostname, pcvar_connect_message_effect, pcvar_connect_message_color
  252. new pcvar_pt, pcvar_pt_bonus, pcvar_pt_bonus_1h, pcvar_pt_bonus_2h, pcvar_pt_bonus_3h, pcvar_pt_bonus_4h, pcvar_pt_bonus_5h
  253. new pcvar_pt_bonus_anonce, pcvar_connect_message_visit
  254.  
  255. new marquee_iID
  256.  
  257. new m_sName[MAX_NAME_LENGTH + 1] = ""
  258. new marquee_place[40] = ""
  259.  
  260. new g_Statsx_Shell_Cvars[31][] =
  261. {
  262. "csstats_rank",
  263. "csstats_maxsize",
  264. "amx_statsx_duration",
  265. "amx_statsx_freeze",
  266. "amx_statsx_shell_mode",
  267. "amx_statsx_design",
  268. "amx_statsx_marquee_enabled",
  269. "amx_statsx_marquee_effect",
  270. "amx_statsx_marquee_color",
  271. "amx_statsx_marquee_position",
  272. "amx_statsx_top_dmg_enabled",
  273. "amx_statsx_top_hs_enabled",
  274. "amx_statsx_top_bot_enabled",
  275. "amx_statsx_top_topx_enabled",
  276. "amx_statsx_award_enabled",
  277. "amx_statsx_award_cash",
  278. "amx_statsx_award_chance",
  279. "amx_statsx_award_anonce",
  280. "amx_statsx_day_stat",
  281. "amx_statsx_pt_enabled",
  282. "amx_statsx_pt_bonus",
  283. "amx_statsx_pt_bonus_anonce",
  284. "amx_statsx_pt_bonus_1h",
  285. "amx_statsx_pt_bonus_2h",
  286. "amx_statsx_pt_bonus_3h",
  287. "amx_statsx_pt_bonus_4h",
  288. "amx_statsx_pt_bonus_5h",
  289. "amx_statsx_conn_msg_enabled",
  290. "amx_statsx_conn_msg_effect",
  291. "amx_statsx_conn_msg_color",
  292. "amx_statsx_conn_msg_visit"
  293. }
  294.  
  295. // Themes
  296.  
  297. #define STATSX_SHELL_DESIGN_MAX 13
  298.  
  299. #define STATSX_SHELL_DESIGN1_STYLE "<meta charset=UTF-8><style>body{background:#112233;font-family:Arial}th{background:#558866;color:#FFF;padding:10px 2px;text-align:left}td{padding:4px 3px}table{background:#EEEECC;font-size:12px;font-family:Arial}h2,h3{color:#FFF;font-family:Verdana}#c{background:#E2E2BC}img{height:10px;background:#09F;margin:0 3px}#r{height:10px;background:#B6423C}#clr{background:none;color:#FFF;font-size:20px}</style>"
  300. #define STATSX_SHELL_DESIGN2_STYLE "<meta charset=UTF-8><style>body{font-family:Arial}th{background:#575757;color:#FFF;padding:5px;border-bottom:2px #BCE27F solid;text-align:left}td{padding:3px;border-bottom:1px #E7F0D0 solid}table{color:#3C9B4A;background:#FFF;font-size:12px}h2,h3{color:#333;font-family:Verdana}#c{background:#F0F7E2}img{height:10px;background:#62B054;margin:0 3px}#r{height:10px;background:#717171}#clr{background:none;color:#575757;font-size:20px}</style>"
  301. #define STATSX_SHELL_DESIGN3_STYLE "<meta charset=UTF-8><style>body{background:#E6E6E6;font-family:Verdana}th{background:#F5F5F5;color:#A70000;padding:6px;text-align:left}td{padding:2px 6px}table{color:#333;background:#E6E6E6;font-size:10px;font-family:Georgia;border:2px solid #D9D9D9}h2,h3{color:#333;}#c{background:#FFF}img{height:10px;background:#14CC00;margin:0 3px}#r{height:10px;background:#CC8A00}#clr{background:none;color:#A70000;font-size:20px;border:0}</style>"
  302. #define STATSX_SHELL_DESIGN4_STYLE "<meta charset=UTF-8><style>body{background:#E8EEF7;margin:2px;font-family:Tahoma}th{color:#0000CC;padding:3px}tr{text-align:left;background:#E8EEF7}td{padding:3px}table{background:#CCC;font-size:11px}h2,h3{font-family:Verdana}img{height:10px;background:#09F;margin:0 3px}#r{height:10px;background:#B6423C}#clr{background:none;color:#000;font-size:20px}</style>"
  303. #define STATSX_SHELL_DESIGN5_STYLE "<meta charset=UTF-8><style>body{background:#555;font-family:Arial}th{border-left:1px solid #ADADAD;border-top:1px solid #ADADAD}table{background:#3C3C3C;font-size:11px;color:#FFF;border-right:1px solid #ADADAD;border-bottom:1px solid #ADADAD;padding:3px}h2,h3{color:#FFF}#c{background:#FF9B00;color:#000}img{height:10px;background:#00E930;margin:0 3px}#r{height:10px;background:#B6423C}#clr{background:none;color:#FFF;font-size:20px;border:0}</style>"
  304. #define STATSX_SHELL_DESIGN6_STYLE "<meta charset=UTF-8><style>body{background:#FFF;font-family:Tahoma}th{background:#303B4A;color:#FFF}table{padding:6px 2px;background:#EFF1F3;font-size:12px;color:#222;border:1px solid #CCC}h2,h3{color:#222}#c{background:#E9EBEE}img{height:7px;background:#F8931F;margin:0 3px}#r{height:7px;background:#D2232A}#clr{background:none;color:#303B4A;font-size:20px;border:0}</style>"
  305. #define STATSX_SHELL_DESIGN7_STYLE "<meta charset=UTF-8><style>body{background:#FFF;font-family:Verdana}th{background:#2E2E2E;color:#FFF;text-align:left}table{padding:6px 2px;background:#FFF;font-size:11px;color:#333;border:1px solid #CCC}h2,h3{color:#333}#c{background:#F0F0F0}img{height:7px;background:#444;margin:0 3px}#r{height:7px;background:#999}#clr{background:none;color:#2E2E2E;font-size:20px;border:0}</style>"
  306. #define STATSX_SHELL_DESIGN8_STYLE "<meta charset=UTF-8><style>body{background:#242424;margin:20px;font-family:Tahoma}th{background:#2F3034;color:#BDB670;text-align:left} table{padding:4px;background:#4A4945;font-size:10px;color:#FFF}h2,h3{color:#D2D1CF}#c{background:#3B3C37}img{height:12px;background:#99CC00;margin:0 3px}#r{height:12px;background:#999900}#clr{background:none;color:#FFF;font-size:20px}</style>"
  307. #define STATSX_SHELL_DESIGN9_STYLE "<meta charset=UTF-8><style>body{background:#FFF;font-family:Tahoma}th{background:#056B9E;color:#FFF;padding:3px;text-align:left;border-top:4px solid #3986AC}td{padding:2px 6px}table{color:#006699;background:#FFF;font-size:12px;border:2px solid #006699}h2,h3{color:#F69F1C;}#c{background:#EFEFEF}img{height:5px;background:#1578D3;margin:0 3px}#r{height:5px;background:#F49F1E}#clr{background:none;color:#056B9E;font-size:20px;border:0}</style>"
  308. #define STATSX_SHELL_DESIGN10_STYLE "<meta charset=UTF-8><style>body{background:#4C5844;font-family:Tahoma}th{background:#1E1E1E;color:#C0C0C0;padding:2px;text-align:left;}td{padding:2px 10px}table{color:#AAC0AA;background:#424242;font-size:13px}h2,h3{color:#C2C2C2;font-family:Tahoma}#c{background:#323232}img{height:3px;background:#B4DA45;margin:0 3px}#r{height:3px;background:#6F9FC8}#clr{background:none;color:#FFF;font-size:20px}</style>"
  309. #define STATSX_SHELL_DESIGN11_STYLE "<meta charset=UTF-8><style>body{background:#F2F2F2;font-family:Arial}th{background:#175D8B;color:#FFF;padding:7px;text-align:left}td{padding:3px;border-bottom:1px #BFBDBD solid}table{color:#153B7C;background:#F4F4F4;font-size:11px;border:1px solid #BFBDBD}h2,h3{color:#153B7C}#c{background:#ECECEC}img{height:8px;background:#54D143;margin:0 3px}#r{height:8px;background:#C80B0F}#clr{background:none;color:#175D8B;font-size:20px;border:0}</style>"
  310. #define STATSX_SHELL_DESIGN12_STYLE "<meta charset=UTF-8><style>body{background:#283136;font-family:Arial}th{background:#323B40;color:#6ED5FF;padding:10px 2px;text-align:left}td{padding:4px 3px;border-bottom:1px solid #DCDCDC}table{background:#EDF1F2;font-size:10px;border:2px solid #505A62}h2,h3{color:#FFF}img{height:10px;background:#A7CC00;margin:0 3px}#r{height:10px;background:#CC3D00}#clr{background:none;color:#6ED5FF;font-size:20px;border:0}</style>"
  311. #define STATSX_SHELL_DESIGN13_STYLE "<meta charset=UTF-8><style>body{background:#220000;font-family:Tahoma}th{background:#3E0909;color:#FFF;padding:5px 2px;text-align:left;border-bottom:1px solid #DEDEDE}td{padding:2px 2px;}table{background:#FFF;font-size:11px;border:1px solid #791616}h2,h3{color:#FFF}#c{background:#F4F4F4;color:#7B0000}img{height:7px;background:#a00000;margin:0 3px}#r{height:7px;background:#181818}#clr{background:none;color:#CFCFCF;font-size:20px;border:0}</style>"
  312.  
  313. #define STATSX_SHELL_DEFAULT_STYLE "<meta charset=UTF-8><style>body{background:#000}tr{text-align:left}table{font-size:13px;color:#FFB000;padding:2px}h2,h3{color:#FFF;font-family:Verdana}img{height:5px;background:#0000FF;margin:0 3px}#r{height:5px;background:#FF0000}</style>"
  314.  
  315.  
  316. //--------------------------------
  317. // Initialize
  318. //--------------------------------
  319. public plugin_init()
  320. {
  321. // Register plugin.
  322. register_plugin("StatsX (MastaMan Edition)", AMXX_VERSION_STR, "AMXX Dev Team")
  323. register_dictionary("statsx_shell.txt")
  324.  
  325. register_cvar("statsx_shell_ver", STATSX_SHELL_VER, FCVAR_SPONLY | FCVAR_SERVER)
  326.  
  327. //Stats Marquee
  328. set_task(15.0, "StatsMarquee", 0, _, 0)
  329.  
  330. // Random award ID
  331. //iAwardID = random_num(0,9)
  332.  
  333. // Random design
  334. iDesign = random_num(1, STATSX_SHELL_DESIGN_MAX)
  335.  
  336. pcvar_hostname = get_cvar_pointer("hostname")
  337.  
  338. pcvar_style = register_cvar("amx_statsx_shell_mode", "1")
  339. pcvar_design = register_cvar("amx_statsx_design", "1")
  340.  
  341. pcvar_statsmarquee = register_cvar("amx_statsx_marquee_enabled", "1")
  342. pcvar_statsmarquee_effect = register_cvar("amx_statsx_marquee_effect", "0")
  343. pcvar_statsmarquee_color = register_cvar("amx_statsx_marquee_color", "0")
  344. pcvar_statsmarquee_position = register_cvar("amx_statsx_marquee_position", "0")
  345.  
  346. pcvar_dmg = register_cvar("amx_statsx_top_dmg_enabled", "1")
  347.  
  348. pcvar_hs = register_cvar("amx_statsx_top_hs_enabled", "1")
  349.  
  350. pcvar_bot = register_cvar("amx_statsx_top_bot_enabled", "1")
  351.  
  352. pcvar_topx = register_cvar("amx_statsx_top_topx_enabled", "1")
  353.  
  354. pcvar_award = register_cvar("amx_statsx_award_enabled", "1")
  355. pcvar_award_cash = register_cvar("amx_statsx_award_cash", "1000")
  356. pcvar_award_chance = register_cvar("amx_statsx_award_chance", "0.1")
  357. pcvar_award_anonce_chat = register_cvar("amx_statsx_award_anonce", "1")
  358.  
  359. pcvar_day = register_cvar("amx_statsx_day_stat", "1")
  360.  
  361. pcvar_pt = register_cvar("amx_statsx_pt_enabled", "1")
  362. pcvar_pt_bonus = register_cvar("amx_statsx_pt_bonus", "1")
  363. pcvar_pt_bonus_anonce = register_cvar("amx_statsx_pt_bonus_anonce", "1")
  364. pcvar_pt_bonus_1h = register_cvar("amx_statsx_pt_bonus_1h", "250")
  365. pcvar_pt_bonus_2h = register_cvar("amx_statsx_pt_bonus_2h", "500")
  366. pcvar_pt_bonus_3h = register_cvar("amx_statsx_pt_bonus_3h", "1000")
  367. pcvar_pt_bonus_4h = register_cvar("amx_statsx_pt_bonus_4h", "2000")
  368. pcvar_pt_bonus_5h = register_cvar("amx_statsx_pt_bonus_5h", "5000")
  369.  
  370. pcvar_connect_message = register_cvar("amx_statsx_conn_msg_enabled", "1")
  371. pcvar_connect_message_effect = register_cvar("amx_statsx_conn_msg_effect", "0")
  372. pcvar_connect_message_color = register_cvar("amx_statsx_conn_msg_color", "0")
  373. pcvar_connect_message_visit = register_cvar("amx_statsx_conn_msg_visit", "1")
  374.  
  375.  
  376. // Register events.
  377. register_event("TextMsg", "eventStartGame", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
  378. register_event("ResetHUD", "eventResetHud", "be")
  379. register_event("RoundTime", "eventStartRound", "bc")
  380. register_event("SendAudio", "eventEndRound", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
  381. register_event("TeamScore", "eventTeamScore", "a")
  382. register_event("30", "eventIntermission", "a")
  383. register_event("TextMsg", "eventSpecMode", "bd", "2&ec_Mod")
  384. register_event("StatusValue", "eventShowRank", "bd", "1=2")
  385.  
  386. // Register commands.
  387. register_clcmd("say /hp", "cmdHp", 0, "- display info. about your killer (chat)")
  388. register_clcmd("say /statsme", "cmdStatsMe", 0, "- display your stats (MOTD)")
  389. register_clcmd("say /rankstats", "cmdRankStats", 0, "- display your server stats (MOTD)")
  390. register_clcmd("say /me", "cmdMe", 0, "- display current round stats (chat)")
  391. register_clcmd("say /score", "cmdScore", 0, "- display last score (chat)")
  392. register_clcmd("say /rank", "cmdRank", 0, "- display your rank (chat)")
  393. register_clcmd("say /report", "cmdReport", 0, "- display weapon status (say_team)")
  394. register_clcmd("say /stats", "cmdStats", 0, "- display players stats (menu/MOTD)")
  395. register_clcmd("say /switch", "cmdSwitch", 0, "- switch client's stats on or off")
  396. register_clcmd("say_team /hp", "cmdHp", 0, "- display info. about your killer (chat)")
  397. register_clcmd("say_team /statsme", "cmdStatsMe", 0, "- display your stats (MOTD)")
  398. register_clcmd("say_team /rankstats", "cmdRankStats", 0, "- display your server stats (MOTD)")
  399. register_clcmd("say_team /me", "cmdMe", 0, "- display current round stats (chat)")
  400. register_clcmd("say_team /score", "cmdScore", 0, "- display last score (chat)")
  401. register_clcmd("say_team /rank", "cmdRank", 0, "- display your rank (chat)")
  402. register_clcmd("say_team /report", "cmdReport", 0, "- display weapon status (say_team_team)")
  403. register_clcmd("say_team /stats", "cmdStats", 0, "- display players stats (menu/MOTD)")
  404. register_clcmd("say_team /switch", "cmdSwitch", 0, "- switch client's stats on or off")
  405.  
  406.  
  407. register_clcmd("say /top15", "cmdPlace1", 0, "- display top 15 players (MOTD)")
  408. register_clcmd("say_team /top15", "cmdPlace1", 0, "- display top 15 players (MOTD)")
  409.  
  410. // Register menus.
  411. register_menucmd(register_menuid("Server Stats"), 1023, "actionStatsMenu")
  412.  
  413. // Register special configuration setting and default value.
  414. register_srvcmd("amx_statsx_mode", "cmdPluginMode", ADMIN_CFG, "<flags> - sets plugin options")
  415.  
  416. #if defined STATSX_DEBUG
  417. register_clcmd("say /hudtest", "cmdHudTest")
  418. #endif
  419.  
  420. register_cvar(HUD_DURATION_CVAR, HUD_DURATION)
  421. register_cvar(HUD_FREEZE_LIMIT_CVAR, HUD_FREEZE_LIMIT)
  422.  
  423.  
  424. // Init buffers and some global vars.
  425. g_sBuffer[0] = 0
  426. save_team_chatscore()
  427.  
  428. g_HudSync_EndRound = CreateHudSyncObj()
  429. g_HudSync_SpecInfo = CreateHudSyncObj()
  430.  
  431. g_msgSayText = get_user_msgid("SayText")
  432. g_msgTeamInfo = get_user_msgid("TeamInfo")
  433. }
  434.  
  435. public plugin_cfg()
  436. {
  437. new addStast[] = "amx_statscfg add ^"%s^" %s"
  438.  
  439. server_cmd(addStast, "ST_SHOW_KILLER_CHAT", "KillerChat")
  440. server_cmd(addStast, "ST_SHOW_ATTACKERS", "ShowAttackers")
  441. server_cmd(addStast, "ST_SHOW_VICTIMS", "ShowVictims")
  442. server_cmd(addStast, "ST_SHOW_KILLER", "ShowKiller")
  443. server_cmd(addStast, "ST_SHOW_TEAM_SCORE", "ShowTeamScore")
  444. server_cmd(addStast, "ST_SHOW_TOTAL_STATS", "ShowTotalStats")
  445. server_cmd(addStast, "ST_SHOW_BEST_SCORE", "ShowBestScore")
  446. server_cmd(addStast, "ST_SHOW_MOST_DISRUPTIVE", "ShowMostDisruptive")
  447. server_cmd(addStast, "ST_SHOW_HUD_STATS_DEF", "ShowStats")
  448. server_cmd(addStast, "ST_SHOW_DIST_HS_HUD", "ShowDistHS")
  449. server_cmd(addStast, "ST_STATS_PLAYER_MAP_END", "EndPlayer")
  450. server_cmd(addStast, "ST_STATS_TOP15_MAP_END", "EndTop15")
  451. server_cmd(addStast, "ST_SAY_HP", "SayHP")
  452. server_cmd(addStast, "ST_SAY_STATSME", "SayStatsMe")
  453. server_cmd(addStast, "ST_SAY_RANKSTATS", "SayRankStats")
  454. server_cmd(addStast, "ST_SAY_ME", "SayMe")
  455. server_cmd(addStast, "ST_SAY_RANK", "SayRank")
  456. server_cmd(addStast, "ST_SAY_REPORT", "SayReport")
  457. server_cmd(addStast, "ST_SAY_SCORE", "SayScore")
  458. server_cmd(addStast, "ST_SAY_TOP15", "SayTop15")
  459. server_cmd(addStast, "ST_SAY_STATS", "SayStatsAll")
  460. server_cmd(addStast, "ST_SPEC_RANK", "SpecRankInfo")
  461.  
  462. // Update local configuration vars with value in cvars.
  463. get_config_cvars()
  464.  
  465. //MastaMan Edition
  466.  
  467. if(get_pcvar_num(pcvar_day))
  468. {
  469. g_Vault = nvault_open("statsx_shell_hour_attend")
  470.  
  471. if(g_Vault == INVALID_HANDLE)
  472. {
  473. set_fail_state("Error opening nVault")
  474. }
  475. }
  476.  
  477. if(get_pcvar_num(pcvar_pt))
  478. {
  479. g_Vault2 = nvault_open("statsx_shell_played_time")
  480.  
  481. if(g_Vault2 == INVALID_HANDLE)
  482. {
  483. set_fail_state("Error opening nVault")
  484. }
  485.  
  486. nvault_prune(g_Vault2 , 0 , get_systime() - (30 * 86400 ))
  487. }
  488.  
  489. if(is_plugin_loaded("statsx.amxx", true) != -1)
  490. {
  491. server_cmd("amxx pause statsx.amxx")
  492. }
  493.  
  494. new szCfgDir[MAX_TEXT_LENGTH], Time[9]
  495. get_time("%H:%M:%S",Time,8)
  496.  
  497. get_configsdir(szCfgDir, MAX_TEXT_LENGTH - 1)
  498. formatex(szCfgDir, sizeof (szCfgDir) -1 , "%s/statsx_shell/statsx_shell.cfg", szCfgDir)
  499. server_cmd("exec %s", szCfgDir)
  500.  
  501.  
  502. server_print(" ")
  503. server_print("###############################################################################")
  504. server_print("^tTitle : StatsX Shell (Ultimate StatsX)")
  505. server_print("^tVersion: %s", STATSX_SHELL_VER)
  506. server_print("^tAuthor : AMX MOD X DEV TEAM")
  507. server_print("^tEdited : MastaMan")
  508. server_print("^tSite : http://amx-server.blogspot.com")
  509. server_print(" ")
  510. server_print("------------------------------------------------------------------------------")
  511. server_print(" ")
  512. if(file_exists(szCfgDir))
  513. {
  514. server_print("[%s] > Load settings from: statsx_shell.cfg", Time)
  515. }
  516. else
  517. {
  518. server_print("[%s] > Not found: statsx_shell.cfg ........................... [ERROR]", Time)
  519. server_print(" ")
  520. server_print("> Please reinstall plugin statsx_shell.amxx for ")
  521. server_print(" solve this problem or check your cfg!")
  522. server_print(" ")
  523. server_print("> Visit www.amx-server.blogspot.com for check new version and more info...")
  524. server_print(" ")
  525. server_print("###############################################################################")
  526.  
  527. //log_amx("Not found: statsx_shell.cfg")
  528.  
  529.  
  530. return PLUGIN_CONTINUE
  531. }
  532. server_print(" ")
  533.  
  534. new szData[MAX_TEXT_LENGTH], i
  535. new bool:bERROR_MESSAGE, szERROR_MESSAGE[70]
  536. new file = fopen(szCfgDir, "rt")
  537. while(!feof(file))
  538. {
  539. new bool:g_bERROR_MESSAGE_TYPE1 = true
  540. new bool:g_bERROR_MESSAGE_TYPE2 = true
  541.  
  542. fgets(file, szData, sizeof(szData) -1)
  543.  
  544.  
  545. if(szData[0] == '/' || szData[0] == ';' || strlen(szData) < 3)
  546. {
  547. continue
  548. }
  549.  
  550. new param1[32], param2[32]
  551.  
  552. parse(szData, param1, sizeof(param1), param2, sizeof(param2))
  553.  
  554. ////////////////////////////////////////////////
  555.  
  556. for(new j = 0; j < sizeof(g_Statsx_Shell_Cvars); j++)
  557. {
  558. if(equali(param1, g_Statsx_Shell_Cvars[j]))
  559. {
  560. g_bERROR_MESSAGE_TYPE1 = false
  561. }
  562. }
  563.  
  564. if(strlen(param2) < 1 || equali(param2, " "))
  565. {
  566. g_bERROR_MESSAGE_TYPE2 = true
  567. }
  568. else
  569. {
  570. g_bERROR_MESSAGE_TYPE2 = false
  571. }
  572.  
  573. ////////////////////////////////////////////////
  574.  
  575. new szSpaceCount[128]
  576. new iLen = 0
  577.  
  578. new iSpaceCount
  579.  
  580. ////////////////////////////////////////////////
  581.  
  582. if(!g_bERROR_MESSAGE_TYPE1)
  583. {
  584. if(!g_bERROR_MESSAGE_TYPE2)
  585. {
  586.  
  587. iLen = formatex(szERROR_MESSAGE, sizeof(szERROR_MESSAGE) - 1, "[%s] > Read cvar ^"%s^" ^"%s^" ", Time,param1, param2)
  588.  
  589. iSpaceCount = sizeof(szERROR_MESSAGE) - iLen
  590.  
  591. for(new k = 1; k < iSpaceCount; k ++)
  592. {
  593. iLen += formatex(szERROR_MESSAGE[iLen], sizeof(szERROR_MESSAGE) - iLen, ".")
  594. }
  595.  
  596. server_print("%s%s%s", szERROR_MESSAGE, szSpaceCount, " [OK]")
  597. server_cmd("%s %s", param1, param2)
  598. }
  599. else
  600. {
  601. bERROR_MESSAGE = true
  602.  
  603. iLen = formatex(szERROR_MESSAGE, sizeof(szERROR_MESSAGE) - 1, "[%s] > Bad value for ^"%s^" ", Time,param1)
  604.  
  605. iSpaceCount = sizeof(szERROR_MESSAGE) - iLen
  606.  
  607. for(new k = 1; k < iSpaceCount; k ++)
  608. {
  609. iLen += formatex(szERROR_MESSAGE[iLen], sizeof(szERROR_MESSAGE) - iLen, ".")
  610. }
  611.  
  612. server_print("%s%s%s", szERROR_MESSAGE, szSpaceCount, " [ERROR]")
  613. //log_amx("Bad value for %s", param1)
  614. }
  615. }
  616. else
  617. {
  618. bERROR_MESSAGE = true
  619.  
  620. iLen = formatex(szERROR_MESSAGE, sizeof(szERROR_MESSAGE) - 1, "[%s] > Unknown cvar ^"%s^" ", Time, param1)
  621.  
  622. iSpaceCount = sizeof(szERROR_MESSAGE) - iLen
  623.  
  624. for(new k = 1; k < iSpaceCount; k ++)
  625. {
  626. iLen += formatex(szERROR_MESSAGE[iLen], sizeof(szERROR_MESSAGE) - iLen, ".")
  627. }
  628.  
  629. server_print("%s%s%s", szERROR_MESSAGE, szSpaceCount, " [ERROR]")
  630. //log_amx("Unknown cvar %s", param1)
  631. }
  632.  
  633.  
  634. i++
  635. }
  636.  
  637. if(bERROR_MESSAGE)
  638. {
  639. server_print(" ")
  640. server_print("------------------------------------------------------------------------------")
  641. server_print(" ")
  642. server_print("[%s] > [!] WARNING: Read some cvar's from configuration failure!", Time)
  643. server_print("> Please check [ERROR] messages above...")
  644. server_print(" ")
  645. server_print("> Visit www.amx-server.blogspot.com for check new version and more info...")
  646.  
  647. }
  648. else
  649. {
  650. server_print(" ")
  651. server_print("------------------------------------------------------------------------------")
  652. server_print(" ")
  653. server_print("[%s] > [OK] All settings load success!", Time)
  654. }
  655.  
  656. fclose(file)
  657.  
  658. server_print(" ")
  659. server_print("###############################################################################")
  660.  
  661. // MastaMan Edition
  662.  
  663. if(get_pcvar_num(pcvar_style))
  664. {
  665. register_clcmd("say /top", "cmdPlace1", 0, "- display top 10 players (MOTD)")
  666. register_clcmd("say /place", "cmdPlace1", 0, "- display top 10 players (MOTD)")
  667. register_clcmd("say /1place", "cmdPlace1", 0, "- display top 10 players (MOTD)")
  668. register_clcmd("say /2place", "cmdPlace2", 0, "- display top 20 players (MOTD)")
  669. register_clcmd("say /3place", "cmdPlace3", 0, "- display top 30 players (MOTD)")
  670. register_clcmd("say /top1", "cmdPlace1", 0, "- display top 10 players (MOTD)")
  671. register_clcmd("say /top10", "cmdPlace1", 0, "- display top 10 players (MOTD)")
  672. register_clcmd("say /top2", "cmdPlace2", 0, "- display top 20 players (MOTD)")
  673. register_clcmd("say /top20", "cmdPlace2", 0, "- display top 20 players (MOTD)")
  674. register_clcmd("say /top3", "cmdPlace3", 0, "- display top 30 players (MOTD)")
  675. register_clcmd("say /top30", "cmdPlace3", 0, "- display top 30 players (MOTD)")
  676. register_clcmd("say /dmg", "cmdDmg", 0, "- display top 10 dmg players (MOTD)")
  677. register_clcmd("say /damage", "cmdDmg", 0, "- display top 10 dmg players (MOTD)")
  678. register_clcmd("say /hs", "cmdHs", 0, "- display top 10 hs players (MOTD)")
  679. register_clcmd("say /headshot", "cmdHs", 0, "- display top 10 hs players (MOTD)")
  680. register_clcmd("say /bot", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  681. register_clcmd("say /bots", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  682. register_clcmd("say /flop", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  683. register_clcmd("say /flops", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  684. register_clcmd("say /noob", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  685. register_clcmd("say /noobs", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  686. register_clcmd("say /lol", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  687. register_clcmd("say /lols", "cmdBot10", 0, "- display top 10 bots (MOTD)")
  688. register_clcmd("say /award", "cmdAward", 0, "- display top 10 bots (MOTD)")
  689. register_clcmd("say", "cmdTopX")
  690. register_clcmd("say /day", "cmdDay")
  691. register_clcmd("say /attend", "cmdDay")
  692. register_clcmd("say /time", "cmdPlTime")
  693. register_clcmd("say /pt", "cmdPlTime")
  694. }
  695.  
  696.  
  697. return PLUGIN_CONTINUE
  698. }
  699.  
  700. public plugin_end()
  701. {
  702.  
  703. if(get_pcvar_num(pcvar_day))
  704. {
  705. nvault_close(g_Vault)
  706. }
  707.  
  708. if(get_pcvar_num(pcvar_pt))
  709. {
  710. nvault_close(g_Vault2)
  711. }
  712. }
  713.  
  714. public client_putinserver(id)
  715. {
  716. if(get_pcvar_num(pcvar_connect_message))
  717. {
  718. set_task(2.5, "connect_message_anonce", id)
  719. }
  720. }
  721.  
  722. public connect_message_anonce(id)
  723. {
  724. new szName[32], szKey[50], szData[128], szHUDMessage[512]
  725. new szHour[5], szDay[5], szMonth[5]
  726. new izStats[8], izBody[8], szHostname[64]
  727. new iHour, iDay, iMonth
  728. new iLen = 0
  729. new iColor_R, iColor_G, iColor_B, g_pcvarColor
  730.  
  731. format_time(szHour, sizeof(szHour) - 1, "%H")
  732. format_time(szDay, sizeof(szDay) - 1, "%d")
  733. format_time(szMonth, sizeof(szMonth) - 1, "%m")
  734.  
  735. iHour = str_to_num(szHour)
  736. iDay = str_to_num(szDay)
  737. iMonth = str_to_num(szMonth)
  738.  
  739.  
  740. get_user_name(id, szName, sizeof(szName) - 1)
  741. formatex(szKey, sizeof(szKey) - 1, "LAST_VISIT#%s", szName)
  742.  
  743. new g_iLastPT = get_pcvar_num(pcvar_pt)
  744. new g_iLastVisit = get_pcvar_num(pcvar_connect_message_visit)
  745.  
  746.  
  747. new iRank = get_user_stats(id, izStats, izBody)
  748. new iMax = get_statsnum()
  749. get_pcvar_string(pcvar_hostname, szHostname, sizeof(szHostname) - 1)
  750.  
  751. iLen = formatex(szHUDMessage, sizeof(szHUDMessage) - 1, "%L %s^n^n%L %L^n", LANG_SERVER, "MM_WELCOME", szHostname, LANG_SERVER, "YOUR", LANG_SERVER, "RANK_IS", iRank, iMax)
  752.  
  753. if(g_iLastPT && g_iLastVisit)
  754. {
  755. new g_iNvault = nvault_get(g_Vault2, szKey, szData, sizeof(szData) - 1)
  756.  
  757. new szTmpDay[5], szTmpMonth[5], szTmpYear[5], szTmpHour[5], szTmpMinute[5]
  758. parse(szData, szTmpDay, sizeof(szTmpDay), szTmpMonth, sizeof(szTmpMonth), szTmpYear, sizeof(szTmpYear), szTmpHour, sizeof(szTmpHour), szTmpMinute, sizeof(szTmpMinute))
  759.  
  760. if(strlen(szTmpMinute) == 1)
  761. {
  762. formatex(szTmpMinute, sizeof(szTmpMinute) - 1, "0%s", szTmpMinute)
  763. }
  764.  
  765. if(g_iNvault && iDay == str_to_num(szTmpDay) && iMonth == str_to_num(szTmpMonth) && (iHour - str_to_num(szTmpHour)) >= 1)
  766. {
  767. iLen += formatex(szHUDMessage[iLen], sizeof(szHUDMessage) - iLen, "%L %L %s:%s", LANG_SERVER, "MM_LAST_VISIT", LANG_SERVER, "MM_TODAY", szTmpHour, szTmpMinute)
  768. }
  769. if(g_iNvault && (iDay - str_to_num(szTmpDay)) == 1 && iMonth == str_to_num(szTmpMonth))
  770. {
  771. iLen += formatex(szHUDMessage[iLen], sizeof(szHUDMessage) - iLen, "%L %L %s:%s", LANG_SERVER, "MM_LAST_VISIT", LANG_SERVER, "MM_YESTERDAY", szTmpHour, szTmpMinute)
  772. }
  773. if(g_iNvault && (iDay - str_to_num(szTmpDay)) == 2 && iMonth == str_to_num(szTmpMonth))
  774. {
  775. iLen += formatex(szHUDMessage[iLen], sizeof(szHUDMessage) - iLen, "%L %L %s:%s", LANG_SERVER, "MM_LAST_VISIT", LANG_SERVER, "MM_DAY_BEFORE", szTmpHour, szTmpMinute)
  776. }
  777. if(g_iNvault && 2 < (iDay - str_to_num(szTmpDay)) <= 7 && iMonth == str_to_num(szTmpMonth))
  778. {
  779. iLen += formatex(szHUDMessage[iLen], sizeof(szHUDMessage) - iLen, "%L %d %L %L %s:%s", LANG_SERVER, "MM_LAST_VISIT", (iDay - str_to_num(szTmpDay)), LANG_SERVER, "MM_DAY", LANG_SERVER, "MM_BEFORE", szTmpHour, szTmpMinute)
  780. }
  781. if(g_iNvault && (iDay - str_to_num(szTmpDay)) > 7 && iMonth == str_to_num(szTmpMonth))
  782. {
  783. iLen += formatex(szHUDMessage[iLen], sizeof(szHUDMessage) - iLen, "%L %s.%s.%s %s:%s", LANG_SERVER, "MM_LAST_VISIT", szTmpDay, szTmpMonth, szTmpYear, szTmpHour, szTmpMinute)
  784. }
  785. }
  786.  
  787. g_pcvarColor = get_pcvar_num(pcvar_connect_message_color)
  788.  
  789. if(g_pcvarColor == 10)
  790. {
  791. g_pcvarColor = random_num(1, 8)
  792. }
  793.  
  794. switch(g_pcvarColor)
  795. {
  796. case 1:
  797. {
  798. // RED
  799. iColor_R = 255
  800. iColor_G = 0
  801. iColor_B = 0
  802. }
  803.  
  804. case 2:
  805. {
  806. // BLUE
  807. iColor_R = 0
  808. iColor_G = 0
  809. iColor_B = 255
  810. }
  811. case 3:
  812. {
  813. // YELLOW
  814. iColor_R = 255
  815. iColor_G = 255
  816. iColor_B = 0
  817. }
  818.  
  819. case 4:
  820. {
  821. // CYAN
  822. iColor_R = 0
  823. iColor_G = 255
  824. iColor_B = 255
  825. }
  826.  
  827. case 5:
  828. {
  829. // MAGENTA
  830. iColor_R = 255
  831. iColor_G = 0
  832. iColor_B = 255
  833. }
  834. case 6:
  835. {
  836. // ORANGE
  837. iColor_R = 255
  838. iColor_G = 128
  839. iColor_B = 0
  840. }
  841. case 7:
  842. {
  843. // VIOLET
  844. iColor_R = 0
  845. iColor_G = 128
  846. iColor_B = 255
  847. }
  848. case 8:
  849. {
  850. // GRAY
  851. iColor_R = 100
  852. iColor_G = 100
  853. iColor_B = 100
  854. }
  855. case 9:
  856. {
  857. // RANDOM
  858. iColor_R = random_num(0, 255)
  859. iColor_G = random_num(0, 255)
  860. iColor_B = random_num(0, 255)
  861. }
  862. default:
  863. {
  864. // GREEN
  865. iColor_R = 0
  866. iColor_G = 255
  867. iColor_B = 0
  868. }
  869. }
  870.  
  871. new iEffect, Float:iFadeIn, Float:iFadeOut, Float:iHoldTime
  872. switch(get_pcvar_num(pcvar_connect_message_effect))
  873. {
  874. case 1:
  875. {
  876. iEffect = 1
  877. iFadeIn = 0.2
  878. iFadeOut = 0.2
  879. iHoldTime = 7.0
  880. }
  881. case 2:
  882. {
  883. iEffect = 2
  884. iFadeIn = 0.05
  885. iFadeOut = 0.5
  886. iHoldTime = 7.0
  887. }
  888. default:
  889. {
  890. iEffect = 0
  891. iFadeIn = 0.5
  892. iFadeOut = 0.5
  893. iHoldTime = 7.0
  894. }
  895. }
  896.  
  897. set_hudmessage(iColor_R, iColor_G, iColor_B, 0.15, 0.40, iEffect, 0.1, iHoldTime, iFadeIn, iFadeOut, -1)
  898. show_hudmessage(id, "%s", szHUDMessage)
  899. }
  900.  
  901. // Set hudmessage format.
  902. set_hudtype_killer(Float:fDuration)
  903. set_hudmessage(220, 80, 0, 0.05, 0.15, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, -1)
  904.  
  905. set_hudtype_endround(Float:fDuration)
  906. {
  907. set_hudmessage(100, 200, 0, 0.05, 0.55, 0, 0.02, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0)
  908. }
  909.  
  910. set_hudtype_attacker(Float:fDuration)
  911. set_hudmessage(220, 80, 0, 0.55, 0.35, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, -1)
  912.  
  913. set_hudtype_victim(Float:fDuration)
  914. set_hudmessage(0, 80, 220, 0.55, 0.60, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, -1)
  915.  
  916. set_hudtype_specmode()
  917. {
  918. set_hudmessage(255, 255, 255, 0.02, 0.96, 2, 0.05, 0.1, 0.01, 3.0, -1)
  919. }
  920.  
  921. #if defined STATSX_DEBUG
  922. public cmdHudTest(id)
  923. {
  924. new i, iLen
  925. iLen = 0
  926.  
  927. for (i = 1; i < 20; i++)
  928. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "....x....1....x....2....x....3....x....4....x....^n")
  929.  
  930. set_hudtype_killer(50.0)
  931. show_hudmessage(id, "%s", g_sBuffer)
  932. }
  933. #endif
  934.  
  935. // Stats formulas
  936. Float:accuracy(izStats[8])
  937. {
  938. if (!izStats[STATS_SHOTS])
  939. return (0.0)
  940.  
  941. return (100.0 * float(izStats[STATS_HITS]) / float(izStats[STATS_SHOTS]))
  942. }
  943.  
  944. Float:effec(izStats[8])
  945. {
  946. if (!izStats[STATS_KILLS])
  947. return (0.0)
  948.  
  949. return (100.0 * float(izStats[STATS_KILLS]) / float(izStats[STATS_KILLS] + izStats[STATS_DEATHS]))
  950. }
  951.  
  952. // Distance formula (metric)
  953. Float:distance(iDistance)
  954. {
  955. return float(iDistance) * 0.0254
  956. }
  957.  
  958. // Get plugin config flags.
  959. set_plugin_mode(id, sFlags[])
  960. {
  961. if (sFlags[0])
  962. g_iPluginMode = read_flags(sFlags)
  963.  
  964. get_flags(g_iPluginMode, t_sText, MAX_TEXT_LENGTH)
  965. console_print(id, "%L", id, "MODE_SET_TO", t_sText)
  966.  
  967. return g_iPluginMode
  968. }
  969.  
  970. // Get config parameters.
  971. get_config_cvars()
  972. {
  973. g_fFreezeTime = get_cvar_float("mp_freezetime")
  974.  
  975. if (g_fFreezeTime < 0.0)
  976. g_fFreezeTime = 0.0
  977.  
  978. g_fHUDDuration = get_cvar_float(HUD_DURATION_CVAR)
  979.  
  980. if (g_fHUDDuration < 1.0)
  981. g_fHUDDuration = 1.0
  982.  
  983. g_fFreezeLimitTime = get_cvar_float(HUD_FREEZE_LIMIT_CVAR)
  984. }
  985.  
  986. // Get and format attackers header and list.
  987. get_attackers(id, sBuffer[MAX_BUFFER_LENGTH + 1])
  988. {
  989. new izStats[8], izBody[8]
  990. new iAttacker
  991. new iFound, iLen
  992. new iMaxPlayer = get_maxplayers()
  993.  
  994. iFound = 0
  995. sBuffer[0] = 0
  996.  
  997. // Get and format header. Add killing attacker statistics if user is dead.
  998. // Make sure shots is greater than zero or division by zero will occur.
  999. // To print a '%', 4 of them must done in a row.
  1000. izStats[STATS_SHOTS] = 0
  1001. iAttacker = g_izKilled[id][KILLED_KILLER_ID]
  1002.  
  1003. if (iAttacker)
  1004. get_user_astats(id, iAttacker, izStats, izBody)
  1005.  
  1006. if (izStats[STATS_SHOTS] && ShowFullStats)
  1007. {
  1008. get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
  1009. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %s -- %0.2f%% %L:^n", id, "ATTACKERS", t_sName, accuracy(izStats), id, "ACC")
  1010. }
  1011. else
  1012. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS")
  1013.  
  1014. // Get and format attacker list.
  1015. for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++)
  1016. {
  1017. if (get_user_astats(id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))
  1018. {
  1019. iFound = 1
  1020. get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
  1021.  
  1022. if (izStats[STATS_KILLS])
  1023. {
  1024. if (!ShowDistHS)
  1025. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  1026. izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
  1027. else if (izStats[STATS_HS])
  1028. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / MM_HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  1029. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id]))
  1030. else
  1031. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  1032. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id]))
  1033. }
  1034. else
  1035. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG")
  1036. }
  1037. }
  1038.  
  1039. if (!iFound)
  1040. sBuffer[0] = 0
  1041.  
  1042. return iFound
  1043. }
  1044.  
  1045. // Get and format victims header and list
  1046. get_victims(id, sBuffer[MAX_BUFFER_LENGTH + 1])
  1047. {
  1048. new izStats[8], izBody[8]
  1049. new iVictim
  1050. new iFound, iLen
  1051. new iMaxPlayer = get_maxplayers()
  1052.  
  1053. iFound = 0
  1054. sBuffer[0] = 0
  1055.  
  1056. // Get and format header.
  1057. // Make sure shots is greater than zero or division by zero will occur.
  1058. // To print a '%', 4 of them must done in a row.
  1059. izStats[STATS_SHOTS] = 0
  1060. get_user_vstats(id, 0, izStats, izBody)
  1061.  
  1062. if (izStats[STATS_SHOTS])
  1063. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%% %L:^n", id, "VICTIMS", accuracy(izStats), id, "ACC")
  1064. else
  1065. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS")
  1066.  
  1067. for (iVictim = 1; iVictim <= iMaxPlayer; iVictim++)
  1068. {
  1069. if (get_user_vstats(id, iVictim, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))
  1070. {
  1071. iFound = 1
  1072. get_user_name(iVictim, t_sName, MAX_NAME_LENGTH)
  1073.  
  1074. if (izStats[STATS_DEATHS])
  1075. {
  1076. if (!ShowDistHS)
  1077. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  1078. izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
  1079. else if (izStats[STATS_HS])
  1080. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / MM_HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  1081. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim]))
  1082. else
  1083. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  1084. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim]))
  1085. }
  1086. else
  1087. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG")
  1088. }
  1089. }
  1090.  
  1091. if (!iFound)
  1092. sBuffer[0] = 0
  1093.  
  1094. return iFound
  1095. }
  1096.  
  1097. // Get and format kill info.
  1098. get_kill_info(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
  1099. {
  1100. new iFound, iLen
  1101.  
  1102. iFound = 0
  1103. sBuffer[0] = 0
  1104.  
  1105. if (iKiller && iKiller != id)
  1106. {
  1107. new izAStats[8], izABody[8], izVStats[8], iaVBody[8]
  1108.  
  1109. iFound = 1
  1110. get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
  1111.  
  1112. izAStats[STATS_HITS] = 0
  1113. izAStats[STATS_DAMAGE] = 0
  1114. t_sWpn[0] = 0
  1115. get_user_astats(id, iKiller, izAStats, izABody, t_sWpn, MAX_WEAPON_LENGTH)
  1116.  
  1117. izVStats[STATS_HITS] = 0
  1118. izVStats[STATS_DAMAGE] = 0
  1119. get_user_vstats(id, iKiller, izVStats, iaVBody)
  1120.  
  1121. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L^n", id, "KILLED_YOU_DIST", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]))
  1122. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "DID_DMG_HITS", izAStats[STATS_DAMAGE], izAStats[STATS_HITS], g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR])
  1123. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "YOU_DID_DMG", izVStats[STATS_DAMAGE], izVStats[STATS_HITS])
  1124. }
  1125.  
  1126. return iFound
  1127. }
  1128.  
  1129. // Get and format most disruptive.
  1130. add_most_disruptive(sBuffer[MAX_BUFFER_LENGTH + 1])
  1131. {
  1132. new id, iMaxDamageId, iMaxDamage, iMaxHeadShots
  1133.  
  1134. iMaxDamageId = 0
  1135. iMaxDamage = 0
  1136. iMaxHeadShots = 0
  1137.  
  1138. // Find player.
  1139. for (id = 1; id < MAX_PLAYERS; id++)
  1140. {
  1141. if (g_izUserRndStats[id][STATS_DAMAGE] >= iMaxDamage && (g_izUserRndStats[id][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots))
  1142. {
  1143. iMaxDamageId = id
  1144. iMaxDamage = g_izUserRndStats[id][STATS_DAMAGE]
  1145. iMaxHeadShots = g_izUserRndStats[id][STATS_HS]
  1146. }
  1147. }
  1148.  
  1149. // Format statistics.
  1150. if (iMaxDamageId)
  1151. {
  1152. id = iMaxDamageId
  1153.  
  1154. new Float:fGameEff = effec(g_izUserGameStats[id])
  1155. new Float:fRndAcc = accuracy(g_izUserRndStats[id])
  1156.  
  1157. format(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d %L -- %0.2f%% %L / %0.2f%% %L^n", LANG_SERVER, "MOST_DMG", g_izUserRndName[id],
  1158. g_izUserRndStats[id][STATS_HITS], LANG_SERVER, "HIT_S", iMaxDamage, LANG_SERVER, "DMG", fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC")
  1159. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  1160. }
  1161.  
  1162. return iMaxDamageId
  1163. }
  1164.  
  1165. // Get and format best score.
  1166. add_best_score(sBuffer[MAX_BUFFER_LENGTH + 1])
  1167. {
  1168. new id, iMaxKillsId, iMaxKills, iMaxHeadShots
  1169.  
  1170. iMaxKillsId = 0
  1171. iMaxKills = 0
  1172. iMaxHeadShots = 0
  1173.  
  1174. // Find player
  1175. for (id = 1; id < MAX_PLAYERS; id++)
  1176. {
  1177. if (g_izUserRndStats[id][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[id][STATS_KILLS] > iMaxKills || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots))
  1178. {
  1179. iMaxKillsId = id
  1180. iMaxKills = g_izUserRndStats[id][STATS_KILLS]
  1181. iMaxHeadShots = g_izUserRndStats[id][STATS_HS]
  1182. }
  1183. }
  1184.  
  1185. // Format statistics.
  1186. if (iMaxKillsId)
  1187. {
  1188. id = iMaxKillsId
  1189.  
  1190. new Float:fGameEff = effec(g_izUserGameStats[id])
  1191. new Float:fRndAcc = accuracy(g_izUserRndStats[id])
  1192.  
  1193. format(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d hs -- %0.2f%% %L / %0.2f%% %L^n", LANG_SERVER, "BEST_SCORE", g_izUserRndName[id],
  1194. iMaxKills, LANG_SERVER, "KILL_S", iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC")
  1195. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  1196. }
  1197.  
  1198. return iMaxKillsId
  1199. }
  1200.  
  1201. // Get and format team score.
  1202. add_team_score(sBuffer[MAX_BUFFER_LENGTH + 1])
  1203. {
  1204. new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS]
  1205.  
  1206. // Calculate team stats
  1207. for (new iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  1208. {
  1209. fzMapEff[iTeam] = effec(g_izTeamGameStats[iTeam])
  1210. fzMapAcc[iTeam] = accuracy(g_izTeamGameStats[iTeam])
  1211. fzRndAcc[iTeam] = accuracy(g_izTeamRndStats[iTeam])
  1212. }
  1213.  
  1214. // Format round team stats, MOTD
  1215. format(t_sText, MAX_TEXT_LENGTH, "TERRORIST %d / %0.2f%% %L / %0.2f%% %L^nCT %d / %0.2f%% %L / %0.2f%% %L^n", g_izTeamScore[0],
  1216. fzMapEff[0], LANG_SERVER, "EFF", fzRndAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzRndAcc[1], LANG_SERVER, "ACC")
  1217. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  1218. }
  1219.  
  1220. // Get and format team stats, chat version
  1221. save_team_chatscore()
  1222. {
  1223. new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS]
  1224.  
  1225. // Calculate team stats
  1226. for (new iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  1227. {
  1228. fzMapEff[iTeam] = effec(g_izTeamGameStats[iTeam])
  1229. fzMapAcc[iTeam] = accuracy(g_izTeamGameStats[iTeam])
  1230. fzRndAcc[iTeam] = accuracy(g_izTeamRndStats[iTeam])
  1231. }
  1232.  
  1233. // Format game team stats, chat
  1234. format(g_sScore, MAX_BUFFER_LENGTH, "%L $t%d $g/ $t%0.2f%%$g %L / $t%0.2f%% $g%L -- %L $t%d $g/ $t%0.2f%% $g%L / $t%0.2f%% $g%L", LANG_SERVER, "MM_T", g_izTeamScore[0],
  1235. fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", LANG_SERVER, "MM_CT", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC")
  1236. }
  1237.  
  1238. // Get and format total stats.
  1239. add_total_stats(sBuffer[MAX_BUFFER_LENGTH + 1])
  1240. {
  1241. format(t_sText, MAX_TEXT_LENGTH, "%L: %d %L / %d hs -- %d %L / %d %L^n", LANG_SERVER, "TOTAL", g_izUserRndStats[0][STATS_KILLS], LANG_SERVER, "KILL_S",
  1242. g_izUserRndStats[0][STATS_HS], g_izUserRndStats[0][STATS_HITS], LANG_SERVER, "HITS", g_izUserRndStats[0][STATS_SHOTS], LANG_SERVER, "SHOT_S")
  1243. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  1244. }
  1245.  
  1246. // Get and format a user's list of body hits from an attacker.
  1247. add_attacker_hits(id, iAttacker, sBuffer[MAX_BUFFER_LENGTH + 1])
  1248. {
  1249. new iFound = 0
  1250.  
  1251. if (iAttacker && iAttacker != id)
  1252. {
  1253. new izStats[8], izBody[8], iLen
  1254.  
  1255. izStats[STATS_HITS] = 0
  1256. get_user_astats(id, iAttacker, izStats, izBody)
  1257.  
  1258. if (izStats[STATS_HITS])
  1259. {
  1260. iFound = 1
  1261. iLen = strlen(sBuffer)
  1262. get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
  1263.  
  1264. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L:^n", id, "HITS_YOU_IN", t_sName)
  1265.  
  1266. for (new i = 1; i < 8; i++)
  1267. {
  1268. if (!izBody[i])
  1269. continue
  1270.  
  1271. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L: %d^n", id, MM_BODY_PART[i], izBody[i])
  1272. }
  1273. }
  1274. }
  1275.  
  1276. return iFound
  1277. }
  1278.  
  1279. // Get and format killed stats: killer hp, ap, hits.
  1280. format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
  1281. {
  1282. new iFound = 0
  1283.  
  1284. if (iKiller && iKiller != id)
  1285. {
  1286. new izStats[8], izBody[8]
  1287. new iLen
  1288.  
  1289. iFound = 1
  1290. get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
  1291. izStats[STATS_HITS] = 0
  1292. get_user_astats(id, iKiller, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH)
  1293.  
  1294. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L (%d%L, %d%L) $g>>", id, "KILLED_BY_WITH", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]),
  1295. g_izKilled[id][KILLED_KILLER_HEALTH], id, "MM_HP", g_izKilled[id][KILLED_KILLER_ARMOUR], id, "MM_AP")
  1296.  
  1297. if (izStats[STATS_HITS])
  1298. {
  1299. for (new i = 1; i < 8; i++)
  1300. {
  1301. if (!izBody[i])
  1302. continue
  1303.  
  1304. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " $g%L: $t%d$g", id, MM_BODY_PART[i], izBody[i])
  1305. }
  1306. }
  1307. else
  1308. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
  1309. }
  1310. else
  1311. format(sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER")
  1312.  
  1313. return iFound
  1314. }
  1315.  
  1316. // Get and format killed stats: hits, damage on killer.
  1317. format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
  1318. {
  1319. new iFound = 0
  1320. new izStats[8]
  1321. new izBody[8]
  1322. new iLen
  1323.  
  1324. izStats[STATS_HITS] = 0
  1325. izStats[STATS_DAMAGE] = 0
  1326. get_user_vstats(id, iKiller, izStats, izBody)
  1327.  
  1328. if (iKiller && iKiller != id)
  1329. {
  1330. iFound = 1
  1331. get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
  1332. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L $g>>", id, "YOU_HIT", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE])
  1333. }
  1334. else
  1335. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L $g>>", id, "LAST_RES", izStats[STATS_HITS], izStats[STATS_DAMAGE])
  1336.  
  1337. if (izStats[STATS_HITS])
  1338. {
  1339. for (new i = 1; i < 8; i++)
  1340. {
  1341. if (!izBody[i])
  1342. continue
  1343.  
  1344. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " $g%L: $t%d$g", id, MM_BODY_PART[i], izBody[i])
  1345. }
  1346. }
  1347. else
  1348. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
  1349.  
  1350. return iFound
  1351. }
  1352.  
  1353. // MastaMan Edition
  1354. format_topx(sBuffer[MAX_BUFFER_LENGTH + 1])
  1355. {
  1356. new izStats[8], izBody[8]
  1357. new iLen = 0
  1358.  
  1359. new lKills[30], lDeaths[30], lHits[30], lShots[30], lEff[30], lAcc[30], lHs[30], lNick[30], lPot[45]
  1360.  
  1361.  
  1362. format(lNick, 29, "%L", LANG_SERVER, "MM_NICK")
  1363. replace_all(lNick, 29, " ", "&nbsp")
  1364. format(lKills, 29, "%L", LANG_SERVER, "KILLS")
  1365. format(lDeaths, 29, "%L", LANG_SERVER, "DEATHS")
  1366. format(lHits, 29, "%L", LANG_SERVER, "HITS")
  1367. format(lShots, 29, "%L", LANG_SERVER, "SHOTS")
  1368. format(lHs, 29, "%L", LANG_SERVER, "MM_HS")
  1369. replace_all(lHs, 29, " ", "&nbsp")
  1370. format(lEff, 29, "%L", LANG_SERVER, "MM_EFF")
  1371. format(lAcc, 29, "%L", LANG_SERVER, "MM_ACC")
  1372. format(lPot, 44, "%L", LANG_SERVER, "MM_POT")
  1373.  
  1374. ucfirst(lEff)
  1375. ucfirst(lAcc)
  1376.  
  1377.  
  1378. iLen = format_all_themes(sBuffer, iLen)
  1379.  
  1380.  
  1381. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><table width=100%% border=0 align=center cellpadding=0 cellspacing=1>")
  1382.  
  1383. if(get_pcvar_num(pcvar_style))
  1384. {
  1385. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs, lPot)
  1386. }
  1387. else
  1388. {
  1389. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs)
  1390. }
  1391.  
  1392. for (new i = iTopX; i < iTopEnd && MAX_BUFFER_LENGTH - iLen > 0; i++)
  1393. {
  1394. iLen = format_all_stats(g_sBuffer, izStats, izBody, iLen, i)
  1395. }
  1396. }
  1397.  
  1398. // MastaMan Edition
  1399. format_place1(sBuffer[MAX_BUFFER_LENGTH + 1])
  1400. {
  1401. new iMax = get_statsnum()
  1402. new izStats[8], izBody[8]
  1403. new iLen = 0
  1404.  
  1405. if(get_pcvar_num(pcvar_style))
  1406. {
  1407. if (iMax > 10)
  1408. iMax = 10
  1409. }
  1410. else
  1411. {
  1412. if (iMax > 15)
  1413. iMax = 15
  1414. }
  1415.  
  1416. new lFirstPlace[60], lKills[30], lDeaths[30], lHits[30], lShots[30], lEff[30], lAcc[30], lHs[30], lNick[30], lPot[45]
  1417.  
  1418.  
  1419. format(lFirstPlace, 59, "%L", LANG_SERVER, "MM_FIRSTPLACE")
  1420. format(lNick, 29, "%L", LANG_SERVER, "MM_NICK")
  1421. replace_all(lNick, 29, " ", "&nbsp")
  1422. format(lKills, 29, "%L", LANG_SERVER, "KILLS")
  1423. format(lDeaths, 29, "%L", LANG_SERVER, "DEATHS")
  1424. format(lHits, 29, "%L", LANG_SERVER, "HITS")
  1425. format(lShots, 29, "%L", LANG_SERVER, "SHOTS")
  1426. format(lHs, 29, "%L", LANG_SERVER, "MM_HS")
  1427. replace_all(lHs, 29, " ", "&nbsp")
  1428. format(lEff, 29, "%L", LANG_SERVER, "MM_EFF")
  1429. format(lAcc, 29, "%L", LANG_SERVER, "MM_ACC")
  1430. format(lPot, 44, "%L", LANG_SERVER, "MM_POT")
  1431.  
  1432. ucfirst(lEff)
  1433. ucfirst(lAcc)
  1434.  
  1435. iLen = format_all_themes(sBuffer, iLen)
  1436.  
  1437. if(get_pcvar_num(pcvar_style))
  1438. {
  1439. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lFirstPlace)
  1440. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs, lPot)
  1441. }
  1442. else
  1443. {
  1444. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><table width=100%% border=0 align=center cellpadding=0 cellspacing=1>")
  1445. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs)
  1446. }
  1447.  
  1448.  
  1449. for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
  1450. {
  1451. iLen = format_all_stats(g_sBuffer, izStats, izBody, iLen, i)
  1452. }
  1453. }
  1454.  
  1455. format_all_themes(sBuffer[MAX_BUFFER_LENGTH + 1], iLen)
  1456. {
  1457. if(get_pcvar_num(pcvar_design)<= STATSX_SHELL_DESIGN_MAX)
  1458. {
  1459. iDesign = get_pcvar_num(pcvar_design)
  1460. }
  1461. else
  1462. {
  1463. if(get_pcvar_num(pcvar_design) == (STATSX_SHELL_DESIGN_MAX + 1))
  1464. {
  1465. iDesign = random_num(1,STATSX_SHELL_DESIGN_MAX)
  1466. }
  1467. }
  1468.  
  1469. switch(iDesign)
  1470. {
  1471. case 1:
  1472. {
  1473. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN1_STYLE)
  1474. }
  1475.  
  1476. case 2:
  1477. {
  1478. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN2_STYLE)
  1479. }
  1480.  
  1481. case 3:
  1482. {
  1483. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN3_STYLE)
  1484. }
  1485.  
  1486. case 4:
  1487. {
  1488. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN4_STYLE)
  1489. }
  1490.  
  1491. case 5:
  1492. {
  1493. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN5_STYLE)
  1494. }
  1495.  
  1496. case 6:
  1497. {
  1498. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN6_STYLE)
  1499. }
  1500.  
  1501. case 7:
  1502. {
  1503. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN7_STYLE)
  1504. }
  1505.  
  1506. case 8:
  1507. {
  1508. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN8_STYLE)
  1509. }
  1510.  
  1511. case 9:
  1512. {
  1513. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN9_STYLE)
  1514. }
  1515.  
  1516. case 10:
  1517. {
  1518. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN10_STYLE)
  1519. }
  1520.  
  1521. case 11:
  1522. {
  1523. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN11_STYLE)
  1524. }
  1525.  
  1526. case 12:
  1527. {
  1528. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN12_STYLE)
  1529. }
  1530.  
  1531. case 13:
  1532. {
  1533. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DESIGN13_STYLE)
  1534. }
  1535.  
  1536. default:
  1537. {
  1538. iLen = format(sBuffer, MAX_BUFFER_LENGTH, STATSX_SHELL_DEFAULT_STYLE)
  1539. }
  1540. }
  1541.  
  1542. return iLen
  1543. }
  1544.  
  1545. format_all_stats(sBuffer[MAX_BUFFER_LENGTH + 1], izStats[8], izBody[8], iLen, i)
  1546. {
  1547. get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
  1548. replace_all(t_sName, MAX_NAME_LENGTH, "<", "&lt")
  1549. replace_all(t_sName, MAX_NAME_LENGTH, ">", "&gt")
  1550.  
  1551. if (szTrigger)
  1552. {
  1553. szTrigger = false
  1554.  
  1555. if(get_pcvar_num(pcvar_style))
  1556. {
  1557. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%d<td>%s<td>%d<td>%d<td>%d", i + 1, t_sName, izStats[STATS_KILLS],
  1558. izStats[STATS_DEATHS], izStats[STATS_HS])
  1559.  
  1560. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  1561. {
  1562. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img id=r width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1563. }
  1564. else
  1565. {
  1566. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1567. }
  1568. }
  1569. else
  1570. {
  1571. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%d<td>%s<td>%d<td>%d<td>%d</tr>", i + 1, t_sName, izStats[STATS_KILLS],
  1572. izStats[STATS_DEATHS], izStats[STATS_HS])
  1573.  
  1574. }
  1575. }
  1576. else
  1577. {
  1578. szTrigger = true
  1579.  
  1580. if(get_pcvar_num(pcvar_style))
  1581. {
  1582. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%d<td>%s<td>%d<td>%d<td>%d", i + 1, t_sName, izStats[STATS_KILLS],
  1583. izStats[STATS_DEATHS], izStats[STATS_HS])
  1584.  
  1585. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  1586. {
  1587.  
  1588. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img id=r width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1589. }
  1590. else
  1591. {
  1592. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1593. }
  1594. }
  1595. else
  1596. {
  1597. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%d<td>%s<td>%d<td>%d<td>%d</tr>", i + 1, t_sName, izStats[STATS_KILLS],
  1598. izStats[STATS_DEATHS], izStats[STATS_HS])
  1599. }
  1600. }
  1601.  
  1602. return iLen
  1603. }
  1604.  
  1605. format_dmg_stats(sBuffer[MAX_BUFFER_LENGTH + 1], izStats[8], iLen, i)
  1606. {
  1607. if (szTrigger)
  1608. {
  1609. szTrigger = false
  1610.  
  1611. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%d<td>%s<td>%d<td>%d<td>%d</tr>", i + 1, t_sName, izStats[STATS_DAMAGE], izStats[STATS_KILLS],
  1612. izStats[STATS_DEATHS])
  1613.  
  1614. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  1615. {
  1616. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img id=r width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1617. }
  1618. else
  1619. {
  1620. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1621. }
  1622.  
  1623. }
  1624. else
  1625. {
  1626. szTrigger = true
  1627.  
  1628. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%d<td>%s<td>%d<td>%d<td>%d", i + 1, t_sName, izStats[STATS_DAMAGE],
  1629. izStats[STATS_DEATHS], izStats[STATS_HS])
  1630.  
  1631. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  1632. {
  1633. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img id=r width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1634. }
  1635. else
  1636. {
  1637. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1638. }
  1639. }
  1640.  
  1641. return iLen
  1642. }
  1643.  
  1644. format_hs_stats(sBuffer[MAX_BUFFER_LENGTH + 1], izStats[8], iLen, i)
  1645. {
  1646. if (szTrigger)
  1647. {
  1648. szTrigger = false
  1649.  
  1650. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%d<td>%s<td>%d<td>%d<td>%d</tr>", i + 1, t_sName, izStats[STATS_HS], izStats[STATS_KILLS],
  1651. izStats[STATS_DEATHS])
  1652.  
  1653. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  1654. {
  1655. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img id=r width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1656. }
  1657. else
  1658. {
  1659. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1660. }
  1661.  
  1662. }
  1663. else
  1664. {
  1665. szTrigger = true
  1666.  
  1667. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%d<td>%s<td>%d<td>%d<td>%d", i + 1, t_sName, izStats[STATS_HS],
  1668. izStats[STATS_DEATHS], izStats[STATS_HS])
  1669.  
  1670. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  1671. {
  1672. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img id=r width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1673. }
  1674. else
  1675. {
  1676. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td><img width=%3.0f%%>%2.0f%%</tr>", (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  1677. }
  1678. }
  1679.  
  1680. return iLen
  1681. }
  1682.  
  1683. // MastaMan Edition
  1684. format_place2(sBuffer[MAX_BUFFER_LENGTH + 1])
  1685. {
  1686. new iMax = get_statsnum()
  1687. new izStats[8], izBody[8]
  1688. new iLen = 0
  1689.  
  1690. if(get_pcvar_num(pcvar_style))
  1691. {
  1692. if (iMax > 20)
  1693. iMax = 20
  1694. }
  1695. else
  1696. {
  1697. if (iMax > 15)
  1698. iMax = 15
  1699. }
  1700.  
  1701. new lSecondPlace[60], lKills[30], lDeaths[30], lHits[30], lShots[30], lEff[30], lAcc[30], lHs[30], lNick[30], lPot[45]
  1702.  
  1703.  
  1704. format(lSecondPlace, 59, "%L", LANG_SERVER, "MM_SECONDPLACE")
  1705. format(lNick, 29, "%L", LANG_SERVER, "MM_NICK")
  1706. replace_all(lNick, 29, " ", "&nbsp")
  1707. format(lKills, 29, "%L", LANG_SERVER, "KILLS")
  1708. format(lDeaths, 29, "%L", LANG_SERVER, "DEATHS")
  1709. format(lHits, 29, "%L", LANG_SERVER, "HITS")
  1710. format(lShots, 29, "%L", LANG_SERVER, "SHOTS")
  1711. format(lHs, 29, "%L", LANG_SERVER, "MM_HS")
  1712. replace_all(lHs, 29, " ", "&nbsp")
  1713. format(lEff, 29, "%L", LANG_SERVER, "MM_EFF")
  1714. format(lAcc, 29, "%L", LANG_SERVER, "MM_ACC")
  1715. format(lPot, 44, "%L", LANG_SERVER, "MM_POT")
  1716.  
  1717. ucfirst(lEff)
  1718. ucfirst(lAcc)
  1719.  
  1720. iLen = format_all_themes(sBuffer, iLen)
  1721.  
  1722. if(get_pcvar_num(pcvar_style))
  1723. {
  1724. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lSecondPlace)
  1725. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs, lPot)
  1726. }
  1727. else
  1728. {
  1729. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><table width=100%% border=0 align=center cellpadding=0 cellspacing=1>")
  1730. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs)
  1731. }
  1732.  
  1733. for (new i = 10; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
  1734. {
  1735. iLen = format_all_stats(g_sBuffer, izStats, izBody, iLen, i)
  1736. }
  1737. }
  1738.  
  1739. // MastaMan Edition
  1740. format_place3(sBuffer[MAX_BUFFER_LENGTH + 1])
  1741. {
  1742. new iMax = get_statsnum()
  1743. new izStats[8], izBody[8]
  1744. new iLen = 0
  1745.  
  1746. if(get_pcvar_num(pcvar_style))
  1747. {
  1748. if (iMax > 30)
  1749. iMax = 30
  1750. }
  1751. else
  1752. {
  1753. if (iMax > 15)
  1754. iMax = 15
  1755. }
  1756.  
  1757. new lThirdPlace[60], lKills[30], lDeaths[30], lHits[30], lShots[30], lEff[30], lAcc[30], lHs[30], lNick[30], lPot[45]
  1758.  
  1759.  
  1760. format(lThirdPlace, 59, "%L", LANG_SERVER, "MM_THIRDPLACE")
  1761. format(lNick, 29, "%L", LANG_SERVER, "MM_NICK")
  1762. replace_all(lNick, 29, " ", "&nbsp")
  1763. format(lKills, 29, "%L", LANG_SERVER, "KILLS")
  1764. format(lDeaths, 29, "%L", LANG_SERVER, "DEATHS")
  1765. format(lHits, 29, "%L", LANG_SERVER, "HITS")
  1766. format(lShots, 29, "%L", LANG_SERVER, "SHOTS")
  1767. format(lHs, 29, "%L", LANG_SERVER, "MM_HS")
  1768. replace_all(lHs, 29, " ", "&nbsp")
  1769. format(lEff, 29, "%L", LANG_SERVER, "MM_EFF")
  1770. format(lAcc, 29, "%L", LANG_SERVER, "MM_ACC")
  1771. format(lPot, 44, "%L", LANG_SERVER, "MM_POT")
  1772.  
  1773. ucfirst(lEff)
  1774. ucfirst(lAcc)
  1775.  
  1776. iLen = format_all_themes(sBuffer, iLen)
  1777.  
  1778. if(get_pcvar_num(pcvar_style))
  1779. {
  1780. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lThirdPlace)
  1781. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs, lPot)
  1782. }
  1783. else
  1784. {
  1785. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><table width=100%% border=0 align=center cellpadding=0 cellspacing=1>")
  1786. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><tr><th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs)
  1787. }
  1788.  
  1789. for (new i = 20; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
  1790. {
  1791. iLen = format_all_stats(g_sBuffer, izStats, izBody, iLen, i)
  1792. }
  1793. }
  1794.  
  1795.  
  1796. // MastaMan Edition
  1797. format_bot10(sBuffer[MAX_BUFFER_LENGTH + 1])
  1798. {
  1799. new iMax = get_statsnum()
  1800. new iBotX = iMax - 10
  1801. new izStats[8], izBody[8]
  1802. new iLen = 0
  1803.  
  1804. new lBot[60], lKills[30], lDeaths[30], lHits[30], lShots[30], lEff[30], lAcc[30], lHs[30], lNick[30], lPot[45]
  1805.  
  1806.  
  1807. format(lBot, 59, "%L", LANG_SERVER, "MM_BOT")
  1808. format(lNick, 29, "%L", LANG_SERVER, "MM_NICK")
  1809. replace_all(lNick, 29, " ", "&nbsp")
  1810. format(lKills, 29, "%L", LANG_SERVER, "KILLS")
  1811. format(lDeaths, 29, "%L", LANG_SERVER, "DEATHS")
  1812. format(lHits, 29, "%L", LANG_SERVER, "HITS")
  1813. format(lShots, 29, "%L", LANG_SERVER, "SHOTS")
  1814. format(lHs, 29, "%L", LANG_SERVER, "MM_HS")
  1815. replace_all(lHs, 29, " ", "&nbsp")
  1816. format(lEff, 29, "%L", LANG_SERVER, "MM_EFF")
  1817. format(lAcc, 29, "%L", LANG_SERVER, "MM_ACC")
  1818. format(lPot, 44, "%L", LANG_SERVER, "MM_POT")
  1819.  
  1820. ucfirst(lEff)
  1821. ucfirst(lAcc)
  1822.  
  1823. iLen = format_all_themes(sBuffer, iLen)
  1824.  
  1825. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lBot)
  1826.  
  1827. if(get_pcvar_num(pcvar_style))
  1828. {
  1829. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs, lPot)
  1830. }
  1831. else
  1832. {
  1833. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lKills, lDeaths, lHs)
  1834. }
  1835.  
  1836.  
  1837. for (new i = iMax - 1; i > iBotX && MAX_BUFFER_LENGTH - iLen > 0; i--)
  1838. {
  1839. iLen = format_all_stats(g_sBuffer, izStats, izBody, iLen, i)
  1840. }
  1841. }
  1842.  
  1843. find_max_stats(g_iStatsBase[], iMax, iExcludeID[])
  1844. {
  1845. new g_iDataMax = 0
  1846. new iId
  1847.  
  1848. for(new j = 0; j < iMax; j++)
  1849. {
  1850. if(!iExcludeID[j])
  1851. {
  1852. if(g_iStatsBase[j] > g_iDataMax)
  1853. {
  1854. g_iDataMax = g_iStatsBase[j]
  1855. iExcludeID[j] = true
  1856. iId = j
  1857. }
  1858. }
  1859. }
  1860.  
  1861.  
  1862. return iId
  1863. }
  1864.  
  1865.  
  1866. // MastaMan Edition
  1867. format_top_dmg(sBuffer[MAX_BUFFER_LENGTH + 1])
  1868. {
  1869. new iMax = get_statsnum()
  1870. new izStats[8], izBody[8]
  1871. new iLen = 0
  1872.  
  1873. new g_iStatsBase[MAX_SORT_COUNT]
  1874. new bool:iExcludeID[MAX_SORT_COUNT]
  1875.  
  1876. new lDmg_Place[60], lDamage[30], lKills[30], lDeaths[30], lHits[30], lEff[30], lAcc[30], lHs[30], lNick[30], lPot[45]
  1877.  
  1878.  
  1879. if (iMax > MAX_SORT_COUNT)
  1880. {
  1881. iMax = MAX_SORT_COUNT
  1882. }
  1883.  
  1884.  
  1885. for(new i = 0; i < iMax; i++)
  1886. {
  1887. get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
  1888.  
  1889. g_iStatsBase[i] = izStats[STATS_DAMAGE]
  1890. }
  1891.  
  1892.  
  1893.  
  1894. format(lDmg_Place, 59, "%L", LANG_SERVER, "MM_DMG_PLACE")
  1895. format(lNick, 29, "%L", LANG_SERVER, "MM_NICK")
  1896. replace_all(lNick, 29, " ", "&nbsp")
  1897. format(lDamage, 29, "%L", LANG_SERVER, "MM_DAMAGE")
  1898. format(lKills, 29, "%L", LANG_SERVER, "KILLS")
  1899. format(lDeaths, 29, "%L", LANG_SERVER, "DEATHS")
  1900. format(lHits, 29, "%L", LANG_SERVER, "HITS")
  1901. format(lHs, 29, "%L", LANG_SERVER, "MM_HS")
  1902. replace_all(lHs, 29, " ", "&nbsp")
  1903. format(lEff, 29, "%L", LANG_SERVER, "MM_EFF")
  1904. format(lAcc, 29, "%L", LANG_SERVER, "MM_ACC")
  1905. format(lPot, 44, "%L", LANG_SERVER, "MM_POT")
  1906.  
  1907. ucfirst(lEff)
  1908. ucfirst(lAcc)
  1909.  
  1910. iLen = format_all_themes(sBuffer, iLen)
  1911.  
  1912. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lDmg_Place)
  1913.  
  1914. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lDamage, lKills, lDeaths, lPot)
  1915.  
  1916. for(new i = 0; i < 10; i++)
  1917. {
  1918. get_stats(find_max_stats(g_iStatsBase, iMax, iExcludeID), izStats, izBody, t_sName, MAX_NAME_LENGTH)
  1919. replace_all(t_sName, MAX_NAME_LENGTH, "<", "&lt")
  1920. replace_all(t_sName, MAX_NAME_LENGTH, ">", "&gt")
  1921.  
  1922. iLen = format_dmg_stats(g_sBuffer, izStats, iLen, i)
  1923. }
  1924. }
  1925.  
  1926. // MastaMan Edition
  1927. format_top_hs(sBuffer[MAX_BUFFER_LENGTH + 1])
  1928. {
  1929. new iMax = get_statsnum()
  1930. new izStats[8], izBody[8]
  1931. new iLen = 0
  1932.  
  1933. new g_iStatsBase[MAX_SORT_COUNT]
  1934. new bool:iExcludeID[MAX_SORT_COUNT]
  1935.  
  1936. new lHs_Place[60], lKills[30], lDeaths[30], lHits[30], lEff[30], lAcc[30], lHs[30], lNick[30], lPot[45]
  1937.  
  1938.  
  1939. if (iMax > MAX_SORT_COUNT)
  1940. {
  1941. iMax = MAX_SORT_COUNT
  1942. }
  1943.  
  1944.  
  1945. for(new i = 0; i < iMax; i++)
  1946. {
  1947. get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
  1948.  
  1949. g_iStatsBase[i] = izStats[STATS_HS]
  1950. }
  1951.  
  1952.  
  1953.  
  1954. format(lHs_Place, 59, "%L", LANG_SERVER, "MM_HS_PLACE")
  1955. format(lNick, 29, "%L", LANG_SERVER, "MM_NICK")
  1956. replace_all(lNick, 29, " ", "&nbsp")
  1957. format(lKills, 29, "%L", LANG_SERVER, "KILLS")
  1958. format(lDeaths, 29, "%L", LANG_SERVER, "DEATHS")
  1959. format(lHits, 29, "%L", LANG_SERVER, "HITS")
  1960. format(lHs, 29, "%L", LANG_SERVER, "MM_HS")
  1961. replace_all(lHs, 29, " ", "&nbsp")
  1962. format(lEff, 29, "%L", LANG_SERVER, "MM_EFF")
  1963. format(lAcc, 29, "%L", LANG_SERVER, "MM_ACC")
  1964. format(lPot, 44, "%L", LANG_SERVER, "MM_POT")
  1965.  
  1966. ucfirst(lEff)
  1967. ucfirst(lAcc)
  1968.  
  1969. iLen = format_all_themes(sBuffer, iLen)
  1970.  
  1971. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lHs_Place)
  1972.  
  1973. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s</tr>", "#", lNick, lHs, lKills, lDeaths, lPot)
  1974.  
  1975. for(new i = 0; i < 10; i++)
  1976. {
  1977. get_stats(find_max_stats(g_iStatsBase, iMax, iExcludeID), izStats, izBody, t_sName, MAX_NAME_LENGTH)
  1978. replace_all(t_sName, MAX_NAME_LENGTH, "<", "&lt")
  1979. replace_all(t_sName, MAX_NAME_LENGTH, ">", "&gt")
  1980.  
  1981. iLen = format_hs_stats(g_sBuffer, izStats, iLen, i)
  1982. }
  1983. }
  1984.  
  1985. format_day(sBuffer[MAX_BUFFER_LENGTH + 1])
  1986. {
  1987. new g_szDayData[12], szKey[6]
  1988. new iLen = 0
  1989. new lHeader[100], lTitle1[30], lTitle2[30], szDate[128]
  1990.  
  1991. format_time(szDate, sizeof(szDate) - 1, "%d.%m.%Y")
  1992. formatex(lHeader, 99, "%L %L", LANG_SERVER, "MM_ATTEND", LANG_SERVER, "MM_ATTEND_TO", szDate)
  1993. formatex(lTitle1, 29, "%L", LANG_SERVER, "MM_TIME")
  1994. formatex(lTitle2, 29, "%L", LANG_SERVER, "MM_ATTEND")
  1995.  
  1996. iLen = format_all_themes(sBuffer, iLen)
  1997.  
  1998. if (g_Vault == INVALID_HANDLE)
  1999. {
  2000. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h3>Read data from vault failure!...</h3>")
  2001.  
  2002. return PLUGIN_HANDLED
  2003. }
  2004.  
  2005. //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2006. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h3>%s</h3>", lHeader)
  2007.  
  2008. if(get_pcvar_num(pcvar_day) == 1)
  2009. {
  2010. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<center><table width=600 border=0 style=^"font-size:14px^">")
  2011. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr height=250 valign=bottom>")
  2012. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td>100%%<div style=^"padding:15%% 0^">50%% </div> 0%% </td><td>")
  2013.  
  2014. for(new i = 0; i < 24; i++)
  2015. {
  2016. formatex(szKey, 5,"%d-h" , i)
  2017. nvault_get(g_Vault , szKey, g_szDayData, 11)
  2018.  
  2019. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<img style=^"height:%d^" width=18>", str_to_num(g_szDayData) * (250 / get_maxplayers()))
  2020. }
  2021.  
  2022. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "</td></tr><td></td><td>")
  2023. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<pre> 0.....2.....4.....6.....8.....10....12....14....16....18....20....22...</pre>")
  2024. }
  2025.  
  2026. if(get_pcvar_num(pcvar_day) > 1)
  2027. {
  2028. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<center><table border=0 cellpadding=0 cellspacing=1px>")
  2029. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<th>%s<th width=250>%s", lTitle1, lTitle2)
  2030.  
  2031. for(new i = 0; i < 24; i++)
  2032. {
  2033. formatex(szKey, 5,"%d-h" , i)
  2034. nvault_get(g_Vault , szKey, g_szDayData, 11)
  2035.  
  2036. if(szTrigger)
  2037. {
  2038. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%d:00<td><img width=%d> %d", i, (str_to_num(g_szDayData) * (250 / get_maxplayers())) - 10, str_to_num(g_szDayData))
  2039.  
  2040. szTrigger = false
  2041. }
  2042. else
  2043. {
  2044. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%d:00<td><img width=%d> %d", i, (str_to_num(g_szDayData) * (250 / get_maxplayers())) - 10, str_to_num(g_szDayData))
  2045.  
  2046. szTrigger = true
  2047. }
  2048. }
  2049.  
  2050. }
  2051.  
  2052. return PLUGIN_CONTINUE
  2053. }
  2054.  
  2055.  
  2056. format_played_time(id, sBuffer[MAX_BUFFER_LENGTH + 1])
  2057. {
  2058. new iLen = 0
  2059. new lTime[30], lName[30], szName[33], szTmpName[32]
  2060. new szPlayers[32], iNum, szKey[32], szData[128]
  2061. new lYear[30], lMonth[30], lDay[30], lWeek[30], lHour[30], lMinute[30]
  2062.  
  2063. formatex(lYear, 29, "%L", LANG_SERVER, "MM_YEAR")
  2064. formatex(lMonth, 29, "%L", LANG_SERVER, "MM_MONTH")
  2065. formatex(lWeek, 29, "%L", LANG_SERVER, "MM_WEEK")
  2066. formatex(lDay, 29, "%L", LANG_SERVER, "MM_DAY")
  2067. formatex(lHour, 29, "%L", LANG_SERVER, "MM_HOUR")
  2068. formatex(lMinute, 29, "%L", LANG_SERVER, "MM_MIN")
  2069.  
  2070. formatex(lName, 29, "%L", LANG_SERVER, "MM_NICK")
  2071. formatex(lTime, 29, "%L", LANG_SERVER, "MM_TIME")
  2072.  
  2073. iLen = format_all_themes(sBuffer, iLen)
  2074.  
  2075. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><center><table border=0 width=50%%><th>#<th>%s<th>%s", lName, lTime)
  2076.  
  2077. get_players(szPlayers, iNum)
  2078. for(new i = 0; i < iNum; i++)
  2079. {
  2080. new iYear, iMonth, iDay, iWeek, iHour, iMinute, szTime[64]
  2081.  
  2082. get_user_name(szPlayers[i], szName, sizeof(szName) - 1)
  2083.  
  2084. get_user_name(id, szTmpName, sizeof(szTmpName) - 1)
  2085. formatex(szKey, sizeof(szKey) - 1, "PLAYED_TIME#%s", szName)
  2086.  
  2087. nvault_get(g_Vault2, szKey, szData, sizeof(szData) - 1)
  2088.  
  2089. new iTime = str_to_num(szData) + get_user_time(szPlayers[i])
  2090.  
  2091. if(iTime / MM_MINUTE)
  2092. {
  2093. iMinute = iTime / MM_MINUTE
  2094. formatex(szTime, sizeof(szTime) - 1, "%d %s", iMinute, lMinute)
  2095. }
  2096. else
  2097. {
  2098. continue
  2099. }
  2100.  
  2101. if(iTime / MM_HOUR)
  2102. {
  2103. iHour = iTime / MM_HOUR
  2104. iMinute = (iTime - (iHour * MM_HOUR)) / MM_MINUTE
  2105. formatex(szTime, sizeof(szTime) - 1, "%d %s %d %s", iHour, lHour, iMinute, lMinute)
  2106. }
  2107.  
  2108. if(iTime / MM_DAY)
  2109. {
  2110. iDay = iTime / MM_DAY
  2111. iHour = (iTime - (iDay * MM_DAY)) / MM_HOUR
  2112. formatex(szTime, sizeof(szTime) - 1, "%d %s %d %s %d %s", iDay, lDay, iHour, lHour, iMinute, lMinute)
  2113. }
  2114.  
  2115. if(iTime / (MM_WEEK))
  2116. {
  2117. iWeek = iTime / (MM_WEEK)
  2118. iDay = (iTime - (iWeek * (MM_WEEK))) / MM_DAY
  2119. formatex(szTime, sizeof(szTime) - 1, "%d %s %d %s %d %s", iDay, iHour, iMinute )
  2120. }
  2121.  
  2122. if(iTime / MM_MONTH)
  2123. {
  2124. iMonth = iTime / MM_MONTH
  2125. iWeek = (iTime - (iMonth * MM_MONTH)) / 604800
  2126. formatex(szTime, sizeof(szTime) - 1, "%d month %d week %d day %d hour %d min", iMonth, iWeek , iDay, iHour, iMinute )
  2127. }
  2128.  
  2129. if((iTime / MM_YEAR) > 1)
  2130. {
  2131. iYear = iTime / MM_YEAR
  2132. iMonth = (iTime - (iYear * MM_YEAR)) / MM_MONTH
  2133. formatex(szTime, sizeof(szTime) - 1, "%d year %d month %d week %d day %d hour %d min", iYear, iMonth, iWeek, iDay, iHour, iMinute )
  2134. }
  2135.  
  2136. if(equal(szTmpName, szName))
  2137. {
  2138. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%d<td>%s<td>%s", i + 1, szName, szTime)
  2139. }
  2140. else
  2141. {
  2142. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%d<td>%s<td>%s", i + 1, szName, szTime)
  2143. }
  2144. }
  2145.  
  2146. return PLUGIN_CONTINUE
  2147. }
  2148.  
  2149. // MastaMan Edition
  2150. format_award(sBuffer[MAX_BUFFER_LENGTH + 1])
  2151. {
  2152. new izStats[8], izBody[8], szName[3][MAX_NAME_LENGTH], id
  2153. new iLen = 0
  2154. new Float:izAwardCash_Bonus[3], Float:izAwardSkil_Level[3], izCash
  2155.  
  2156. new lBonus[30]
  2157.  
  2158. format(lBonus, 29, "%L", LANG_SERVER, "MM_BONUS")
  2159.  
  2160. iLen = format_all_themes(sBuffer, iLen)
  2161.  
  2162. id = iAwardID
  2163. for(new i = 0; i < 3; i++)
  2164. {
  2165. get_stats(id, izStats, izBody, t_sName, MAX_NAME_LENGTH)
  2166. replace_all(t_sName, MAX_NAME_LENGTH, "<", "&lt")
  2167. replace_all(t_sName, MAX_NAME_LENGTH, ">", "&gt")
  2168.  
  2169. copy(szName[i], MAX_NAME_LENGTH - 1, t_sName)
  2170.  
  2171. izAwardCash_Bonus[i] = get_pcvar_num(pcvar_award_cash) * (((effec(izStats) + accuracy(izStats)) / 2) / 100)
  2172. izAwardSkil_Level[i] = ((effec(izStats) + accuracy(izStats)) / 2)
  2173.  
  2174. id += 10
  2175. }
  2176.  
  2177.  
  2178. iAwardID = random_num(0, 9)
  2179.  
  2180. iLen = format_all_themes(sBuffer, iLen)
  2181. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><center><br><br><div id=clr>%s</div>", szName[0])
  2182. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<table border=0 id=clr cellpadding=0 cellspacing=0><tr style=^"vertical-align:bottom^">")
  2183. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td align=right width=300><p>%s</p><div id=c style=^"border:1px solid;height:80px;width:100px;font-size:50px;text-align:center^">2</div></td>", szName[1])
  2184. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td width=100><div id=c style=^"border:1px solid;height:140px;width:100px;font-size:50px;text-align:center^">1</div></td>")
  2185. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td align=left width=300><p>%s</p><div id=c style=^"border:1px solid;height:50px;width:100px;font-size:50px;text-align:center^">3</div></td>", szName[2])
  2186. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "</tr></table><br>")
  2187.  
  2188. if(get_pcvar_num(pcvar_award_cash))
  2189. {
  2190. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<table width=90%% cellspacing=1 cellspadding=0>")
  2191.  
  2192. for(new i = 0; i < 3; i++)
  2193. {
  2194. izCash = get_pcvar_num(pcvar_award_cash) / (i + 1)
  2195.  
  2196. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%d<td>%s", i + 1, szName[i])
  2197.  
  2198. if(izAwardSkil_Level[i] < 50.0)
  2199. {
  2200. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td width=150><img id=r width=%3.0f%%>%2.0f%%", izAwardSkil_Level[i], izAwardSkil_Level[i])
  2201. }
  2202. else
  2203. {
  2204. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td width=150><img width=%3.0f%%>%2.0f%%", izAwardSkil_Level[i], izAwardSkil_Level[i])
  2205. }
  2206.  
  2207. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td>%d$ (+%0.0f$ %s)</tr>", izCash, izAwardCash_Bonus[i], lBonus)
  2208. }
  2209. }
  2210. }
  2211.  
  2212. // MastaMan Edition
  2213. format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
  2214. {
  2215. new izStats[8] = {0, ...}
  2216. new izBody[8]
  2217. new iRankPos, iLen
  2218. new lKills[30], lDeaths[30], lHits[30], lShots[30], lDamage[30], lEff[30], lAcc[30], lPot[45]
  2219.  
  2220. format(lKills, 29, "%L", id, "KILLS")
  2221. format(lDeaths, 29, "%L", id, "DEATHS")
  2222. format(lHits, 29, "%L", id, "HITS")
  2223. format(lShots, 29, "%L", id, "SHOTS")
  2224. format(lDamage, 29, "%L", id, "MM_DAMAGE")
  2225. format(lEff, 29, "%L", id, "MM_EFF")
  2226. format(lAcc, 29, "%L", id, "MM_ACC")
  2227. format(lPot, 44, "%L", id, "MM_POT")
  2228.  
  2229. ucfirst(lEff)
  2230. ucfirst(lAcc)
  2231.  
  2232. iLen = format_all_themes(sBuffer, iLen)
  2233.  
  2234.  
  2235. iRankPos = get_user_stats(id, izStats, izBody)
  2236. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h3>%L %L</h3>", id, (!iMyId || iMyId == id) ? "YOUR" : "PLAYERS", id, "RANK_IS", iRankPos, get_statsnum())
  2237. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<table width=40%% style=^"float:left; margin:0 7%% 0 7%%^" border=0 cellpadding=0 cellspacing=1><th colspan=2>%L</td>", id, "MM_STAT")
  2238.  
  2239. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%s<td>%d &nbsp&nbsp(%L)<tr><td>%s<td>%d<tr id=c><td>%s<td>%d<tr><td>%s<td>%d<tr id=c><td>%s<td>%d<tr><td>%s<td>%0.2f%%<tr id=c>",
  2240. lKills, izStats[STATS_KILLS], id, "MM_WITH_HS",izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS],
  2241. lDamage, izStats[STATS_DAMAGE], lAcc, accuracy(izStats))
  2242.  
  2243. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  2244. {
  2245. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td>%s<td><img id=r width=%3.0f%%>%2.0f%%</tr>", lPot, (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  2246. }
  2247. else
  2248. {
  2249. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td>%s<td><img width=%3.0f%%>%2.0f%%</tr>", lPot, (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  2250. }
  2251.  
  2252. new L_BODY_PART[8][32]
  2253.  
  2254. for (new i = 1; i < 8; i++)
  2255. {
  2256. format(L_BODY_PART[i], 31, "%L", id, BODY_PART[i])
  2257. }
  2258.  
  2259. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "</table><table width=40%% border=0 cellpadding=0 cellspacing=1><th colspan=2>%L</td>", id, "MM_HIT")
  2260.  
  2261. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%s<td>%d<tr><td>%s<td>%d<tr id=c><td>%s<td>%d<tr><td>%s<td>%d<tr id=c><td>%s<td>%d<tr><td>%s<td>%d<tr id=c><td>%s<td>%d",
  2262. L_BODY_PART[1], izBody[1], L_BODY_PART[2], izBody[2], L_BODY_PART[3], izBody[3], L_BODY_PART[4], izBody[4], L_BODY_PART[5],
  2263. izBody[5], L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7])
  2264. }
  2265.  
  2266. // MastaMan Edition
  2267. format_stats(id, sBuffer[MAX_BUFFER_LENGTH + 1])
  2268. {
  2269. new izStats[8] = {0, ...}
  2270. new izBody[8]
  2271. new iWeapon, iLen
  2272. new lKills[30], lDeaths[30], lHits[30], lShots[30], lDamage[30], lEff[30], lAcc[30], lWeapon[30], lPot[45]
  2273.  
  2274. format(lKills, 29, "%L", id, "KILLS")
  2275. format(lDeaths, 29, "%L", id, "DEATHS")
  2276. format(lHits, 29, "%L", id, "HITS")
  2277. format(lShots, 29, "%L", id, "SHOTS")
  2278. format(lDamage, 29, "%L", id, "MM_DAMAGE")
  2279. format(lEff, 29, "%L", id, "MM_EFF")
  2280. format(lAcc, 29, "%L", id, "MM_ACC")
  2281. format(lPot, 44, "%L", id, "MM_POT")
  2282. format(lWeapon, 29, "%L", id, "WEAPON")
  2283.  
  2284. ucfirst(lEff)
  2285. ucfirst(lAcc)
  2286.  
  2287. get_user_wstats(id, 0, izStats, izBody)
  2288.  
  2289. iLen = format_all_themes(sBuffer, iLen)
  2290.  
  2291.  
  2292. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<body><table width=50%% border=0 cellpadding=0 cellspacing=1><th colspan=2>%L</td>", id, "MM_STAT")
  2293.  
  2294. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr id=c><td>%s<td>%d &nbsp&nbsp(%L)<tr><td>%s<td>%d<tr id=c><td>%s<td>%d<tr><td>%s<td>%d<tr id=c><td>%s<td>%d<tr><td>%s<td>%0.2f<tr id=c><td>%s<td>%0.2f<tr>",
  2295. lKills, izStats[STATS_KILLS], id, "MM_WITH_HS",izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS],
  2296. lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
  2297.  
  2298. if(((effec(izStats) + accuracy(izStats)) / 2) < 50)
  2299. {
  2300. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td>%s<td><img id=r width=%3.0f%%>%2.0f%%", lPot, (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  2301. }
  2302. else
  2303. {
  2304. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<td>%s<td><img width=%3.0f%%>%2.0f%%", lPot, (((effec(izStats) + accuracy(izStats)) / 2) / 1.3), ((effec(izStats) + accuracy(izStats)) / 2))
  2305. }
  2306.  
  2307.  
  2308. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "</table><br><table width=90%% border=0 cellpadding=0 cellspacing=1>")
  2309.  
  2310. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><th>%s<th>%s<th>%s<th>%s<th>%s<th>%s<th>%s", lWeapon, lKills, lDeaths, lHits, lShots, lDamage, lAcc)
  2311.  
  2312. new bool:szTrigger = true
  2313. for (iWeapon = 1; iWeapon < xmod_get_maxweapons() && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++)
  2314. {
  2315. if (get_user_wstats(id, iWeapon, izStats, izBody))
  2316. {
  2317. xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH)
  2318. if(szTrigger)
  2319. {
  2320. szTrigger = false
  2321.  
  2322. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr class=c><td>%s<td>%d<td>%d<td>%d<td>%d<td>%d<td>%3.0f", t_sWpn, izStats[STATS_KILLS], izStats[STATS_DEATHS],
  2323. izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_DAMAGE], accuracy(izStats))
  2324. }
  2325. else
  2326. {
  2327. szTrigger = true
  2328.  
  2329. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><td>%s<td>%d<td>%d<td>%d<td>%d<td>%d<td>%3.0f", t_sWpn, izStats[STATS_KILLS], izStats[STATS_DEATHS],
  2330. izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_DAMAGE], accuracy(izStats))
  2331. }
  2332. }
  2333. }
  2334. }
  2335.  
  2336.  
  2337.  
  2338. // Show round end stats. If gametime is zero then use default duration time.
  2339. show_roundend_hudstats(id, Float:fGameTime)
  2340. {
  2341. // Bail out if there no HUD stats should be shown
  2342. // for this player or end round stats not created.
  2343. if (!g_izStatsSwitch[id]) return
  2344. if (!g_sAwardAndScore[0]) return
  2345.  
  2346. // If round end timer is zero clear round end stats.
  2347. if (g_fShowStatsTime == 0.0)
  2348. {
  2349. ClearSyncHud(id, g_HudSync_EndRound)
  2350. #if defined STATSX_DEBUG
  2351. log_amx("Clear round end HUD stats for #%d", id)
  2352. #endif
  2353. }
  2354.  
  2355. // Set HUD-duration to default or remaining time.
  2356. new Float:fDuration
  2357.  
  2358. if (fGameTime == 0.0)
  2359. fDuration = g_fHUDDuration
  2360. else
  2361. {
  2362. fDuration = g_fShowStatsTime + g_fHUDDuration - fGameTime
  2363.  
  2364. if (fDuration > g_fFreezeTime + g_fFreezeLimitTime)
  2365. fDuration = g_fFreezeTime + g_fFreezeLimitTime
  2366. }
  2367.  
  2368. // Show stats only if more time left than coded minimum.
  2369. if (fDuration >= HUD_MIN_DURATION)
  2370. {
  2371. set_hudtype_endround(fDuration)
  2372. ShowSyncHudMsg(id, g_HudSync_EndRound, "%s", g_sAwardAndScore)
  2373. #if defined STATSX_DEBUG
  2374. log_amx("Show %1.2fs round end HUD stats for #%d", fDuration, id)
  2375. #endif
  2376. }
  2377. }
  2378.  
  2379. // Show round end stats.
  2380. show_user_hudstats(id, Float:fGameTime)
  2381. {
  2382. // Bail out if there no HUD stats should be shown
  2383. // for this player or user stats timer is zero.
  2384. if (!g_izStatsSwitch[id]) return
  2385. if (g_fzShowUserStatsTime[id] == 0.0) return
  2386.  
  2387. // Set HUD-duration to default or remaining time.
  2388. new Float:fDuration
  2389.  
  2390. if (fGameTime == 0.0)
  2391. fDuration = g_fHUDDuration
  2392. else
  2393. {
  2394. fDuration = g_fzShowUserStatsTime[id] + g_fHUDDuration - fGameTime
  2395.  
  2396. if (fDuration > g_fFreezeTime + g_fFreezeLimitTime)
  2397. fDuration = g_fFreezeTime + g_fFreezeLimitTime
  2398. }
  2399.  
  2400. // Show stats only if more time left than coded minimum.
  2401. if (fDuration >= HUD_MIN_DURATION)
  2402. {
  2403. if (ShowKiller)
  2404. {
  2405. new iKiller
  2406.  
  2407. iKiller = g_izKilled[id][KILLED_KILLER_ID]
  2408. get_kill_info(id, iKiller, g_sBuffer)
  2409. add_attacker_hits(id, iKiller, g_sBuffer)
  2410. set_hudtype_killer(fDuration)
  2411. show_hudmessage(id, "%s", g_sBuffer)
  2412. #if defined STATSX_DEBUG
  2413. log_amx("Show %1.2fs %suser HUD k-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
  2414. #endif
  2415. }
  2416.  
  2417. if (ShowVictims)
  2418. {
  2419. get_victims(id, g_sBuffer)
  2420. set_hudtype_victim(fDuration)
  2421. show_hudmessage(id, "%s", g_sBuffer)
  2422. #if defined STATSX_DEBUG
  2423. log_amx("Show %1.2fs %suser HUD v-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
  2424. #endif
  2425. }
  2426.  
  2427. if (ShowAttackers)
  2428. {
  2429. get_attackers(id, g_sBuffer)
  2430. set_hudtype_attacker(fDuration)
  2431. show_hudmessage(id, "%s", g_sBuffer)
  2432. #if defined STATSX_DEBUG
  2433. log_amx("Show %1.2fs %suser HUD a-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
  2434. #endif
  2435. }
  2436. }
  2437. }
  2438.  
  2439. //------------------------------------------------------------
  2440. // Plugin commands
  2441. //------------------------------------------------------------
  2442.  
  2443. // Set or get plugin config flags.
  2444. public cmdPluginMode(id, level, cid)
  2445. {
  2446. if (!cmd_access(id, level, cid, 1))
  2447. return PLUGIN_HANDLED
  2448.  
  2449. if (read_argc() > 1)
  2450. read_argv(1, g_sBuffer, MAX_BUFFER_LENGTH)
  2451. else
  2452. g_sBuffer[0] = 0
  2453.  
  2454. set_plugin_mode(id, g_sBuffer)
  2455.  
  2456. return PLUGIN_HANDLED
  2457. }
  2458.  
  2459. // Display MOTD stats.
  2460. public cmdStatsMe(id)
  2461. {
  2462. if (!SayStatsMe)
  2463. {
  2464. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2465. return PLUGIN_HANDLED
  2466. }
  2467.  
  2468. format_stats(id, g_sBuffer)
  2469.  
  2470. get_user_name(id, t_sName, MAX_NAME_LENGTH)
  2471. format(t_sName, MAX_NAME_LENGTH - 1, "StatsMe ^"%s^"", t_sName)
  2472.  
  2473. show_motd(id, g_sBuffer, t_sName)
  2474.  
  2475. return PLUGIN_CONTINUE
  2476. }
  2477.  
  2478. // Display MOTD rank.
  2479. public cmdRankStats(id)
  2480. {
  2481. if (!SayRankStats)
  2482. {
  2483. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2484. return PLUGIN_HANDLED
  2485. }
  2486.  
  2487. format_rankstats(id, g_sBuffer)
  2488.  
  2489. get_user_name(id, t_sName, MAX_NAME_LENGTH)
  2490. format(t_sName, MAX_NAME_LENGTH - 1, "RankStats ^"%s^"", t_sName)
  2491.  
  2492. show_motd(id, g_sBuffer, t_sName)
  2493.  
  2494. return PLUGIN_CONTINUE
  2495. }
  2496.  
  2497. //MastaMan Edition
  2498. public cmdTopX(id)
  2499. {
  2500. if (!SayTop15)
  2501. {
  2502. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2503. return PLUGIN_HANDLED
  2504. }
  2505.  
  2506. if(!get_pcvar_num(pcvar_topx))
  2507. {
  2508. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2509. return PLUGIN_HANDLED
  2510. }
  2511.  
  2512. new szArg[128]
  2513. read_args(szArg, 127)
  2514. remove_quotes(szArg)
  2515. new szTopX[32]
  2516.  
  2517. new szMotdTitle[30]
  2518.  
  2519. if(equal(szArg, "/top", 4))
  2520. {
  2521. copy(szTopX, charsmax(szTopX), szArg[4])
  2522.  
  2523. iTopX = str_to_num(szTopX)
  2524.  
  2525. if(get_pcvar_num(pcvar_style) && iTopX > 30)
  2526. {
  2527. if (get_statsnum() < iTopX + 10)
  2528. {
  2529. iTopEnd = get_statsnum()
  2530. iTopX = iTopEnd - 10
  2531.  
  2532. formatex(szMotdTitle, charsmax(szMotdTitle), "%L %d - %d", LANG_SERVER, "MM_TOPX_T", iTopX + 1, iTopEnd)
  2533. }
  2534. else
  2535. {
  2536. iTopX = iTopX - 1
  2537. iTopEnd = iTopX + 10
  2538.  
  2539. formatex(szMotdTitle, charsmax(szMotdTitle), "%L %d - %d", LANG_SERVER, "MM_TOPX_T", iTopX + 1, iTopEnd)
  2540. }
  2541.  
  2542. format_topx(g_sBuffer)
  2543.  
  2544. show_motd(id, g_sBuffer, szMotdTitle)
  2545. }
  2546. }
  2547.  
  2548. return PLUGIN_CONTINUE
  2549. }
  2550.  
  2551.  
  2552. // Display MOTD top15 ranked.
  2553. public cmdPlace1(id)
  2554. {
  2555. if (!SayTop15)
  2556. {
  2557. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2558. return PLUGIN_HANDLED
  2559. }
  2560.  
  2561. new szMotdTitle[30]
  2562.  
  2563. if(get_pcvar_num(pcvar_style))
  2564. {
  2565. formatex(szMotdTitle, charsmax(szMotdTitle), "10%L",id, "MM_PLACE")
  2566. }
  2567. else
  2568. {
  2569. szMotdTitle = "Top 15"
  2570. }
  2571.  
  2572. format_place1(g_sBuffer)
  2573. show_motd(id, g_sBuffer, szMotdTitle)
  2574.  
  2575.  
  2576. return PLUGIN_CONTINUE
  2577. }
  2578.  
  2579. public cmdPlace2(id)
  2580. {
  2581. if (!SayTop15)
  2582. {
  2583. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2584. return PLUGIN_HANDLED
  2585. }
  2586.  
  2587. format_place2(g_sBuffer)
  2588.  
  2589. new szMotdTitle[30]
  2590. formatex(szMotdTitle, charsmax(szMotdTitle), "20%L",id, "MM_PLACE")
  2591. show_motd(id, g_sBuffer, szMotdTitle)
  2592.  
  2593. return PLUGIN_CONTINUE
  2594. }
  2595.  
  2596. public cmdPlace3(id)
  2597. {
  2598. if (!SayTop15)
  2599. {
  2600. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2601. return PLUGIN_HANDLED
  2602. }
  2603.  
  2604. format_place3(g_sBuffer)
  2605.  
  2606. new szMotdTitle[30]
  2607. formatex(szMotdTitle, charsmax(szMotdTitle), "30%L",id, "MM_PLACE")
  2608. show_motd(id, g_sBuffer, szMotdTitle)
  2609.  
  2610. return PLUGIN_CONTINUE
  2611. }
  2612.  
  2613. public cmdBot10(id)
  2614. {
  2615. if (!SayTop15)
  2616. {
  2617. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2618. return PLUGIN_HANDLED
  2619. }
  2620.  
  2621. if(!get_pcvar_num(pcvar_bot))
  2622. {
  2623. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2624. return PLUGIN_HANDLED
  2625. }
  2626.  
  2627. format_bot10(g_sBuffer)
  2628.  
  2629. new szMotdTitle[30]
  2630. formatex(szMotdTitle, charsmax(szMotdTitle), "%L",id, "MM_BOT_T")
  2631. show_motd(id, g_sBuffer, szMotdTitle)
  2632.  
  2633. return PLUGIN_CONTINUE
  2634. }
  2635.  
  2636. public cmdAward(id)
  2637. {
  2638. if (!SayTop15)
  2639. {
  2640. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2641. return PLUGIN_HANDLED
  2642. }
  2643.  
  2644. if(!get_pcvar_num(pcvar_award))
  2645. {
  2646. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2647. return PLUGIN_HANDLED
  2648. }
  2649.  
  2650. format_award(g_sBuffer)
  2651.  
  2652. new szMotdTitle[30]
  2653. formatex(szMotdTitle, charsmax(szMotdTitle), "%L",id, "MM_AWARD_T")
  2654. show_motd(id, g_sBuffer, szMotdTitle)
  2655.  
  2656. return PLUGIN_CONTINUE
  2657. }
  2658.  
  2659. public cmdDay(id)
  2660. {
  2661. if (!SayTop15)
  2662. {
  2663. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2664. return PLUGIN_HANDLED
  2665. }
  2666.  
  2667. if(!get_pcvar_num(pcvar_day))
  2668. {
  2669. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2670. return PLUGIN_HANDLED
  2671. }
  2672.  
  2673. format_day(g_sBuffer)
  2674.  
  2675. new szMotdTitle[30]
  2676. formatex(szMotdTitle, sizeof(szMotdTitle) - 1, "%L", LANG_SERVER, "MM_ATTEND")
  2677. show_motd(id, g_sBuffer, szMotdTitle)
  2678.  
  2679. return PLUGIN_CONTINUE
  2680. }
  2681.  
  2682. public cmdPlTime(id)
  2683. {
  2684. if (!SayTop15)
  2685. {
  2686. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2687. return PLUGIN_HANDLED
  2688. }
  2689.  
  2690. if(!get_pcvar_num(pcvar_pt))
  2691. {
  2692. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2693. return PLUGIN_HANDLED
  2694. }
  2695.  
  2696. format_played_time(id, g_sBuffer)
  2697.  
  2698. new szMotdTitle[30]
  2699. formatex(szMotdTitle, charsmax(szMotdTitle), "%L",id, "MM_PT_T")
  2700. show_motd(id, g_sBuffer, szMotdTitle)
  2701.  
  2702. return PLUGIN_CONTINUE
  2703. }
  2704.  
  2705. public cmdDmg(id)
  2706. {
  2707. if (!SayTop15)
  2708. {
  2709. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2710. return PLUGIN_HANDLED
  2711. }
  2712.  
  2713. if(!get_pcvar_num(pcvar_dmg))
  2714. {
  2715. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2716. return PLUGIN_HANDLED
  2717. }
  2718.  
  2719. format_top_dmg(g_sBuffer)
  2720.  
  2721. new szMotdTitle[30]
  2722. formatex(szMotdTitle, charsmax(szMotdTitle), "%L",id, "MM_DMG_PLACE_T")
  2723. show_motd(id, g_sBuffer, szMotdTitle)
  2724.  
  2725. return PLUGIN_CONTINUE
  2726. }
  2727.  
  2728. public cmdHs(id)
  2729. {
  2730. if (!SayTop15)
  2731. {
  2732. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2733. return PLUGIN_HANDLED
  2734. }
  2735.  
  2736. if(!get_pcvar_num(pcvar_hs))
  2737. {
  2738. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2739. return PLUGIN_HANDLED
  2740. }
  2741.  
  2742. format_top_hs(g_sBuffer)
  2743.  
  2744. new szMotdTitle[30]
  2745. formatex(szMotdTitle, charsmax(szMotdTitle), "%L",id, "MM_HS_PLACE_T")
  2746. show_motd(id, g_sBuffer, szMotdTitle)
  2747.  
  2748. return PLUGIN_CONTINUE
  2749. }
  2750.  
  2751. // Display killer information.
  2752. public cmdHp(id)
  2753. {
  2754. if (!SayHP)
  2755. {
  2756. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2757. return PLUGIN_HANDLED
  2758. }
  2759.  
  2760. new iKiller = g_izKilled[id][KILLED_KILLER_ID]
  2761.  
  2762. format_kill_ainfo(id, iKiller, g_sBuffer)
  2763. colorChat(id, CHATCOLOR_RED, "* %s", g_sBuffer)
  2764.  
  2765. return PLUGIN_CONTINUE
  2766. }
  2767.  
  2768. // Display user stats.
  2769. public cmdMe(id)
  2770. {
  2771. if (!SayMe)
  2772. {
  2773. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2774. return PLUGIN_HANDLED
  2775. }
  2776.  
  2777. format_kill_vinfo(id, 0, g_sBuffer)
  2778. colorChat(id, CHATCOLOR_GREEN,"* %s", g_sBuffer)
  2779.  
  2780. return PLUGIN_CONTINUE
  2781. }
  2782.  
  2783. // Display user rank
  2784. public cmdRank(id)
  2785. {
  2786. if (!SayRank)
  2787. {
  2788. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2789. return PLUGIN_HANDLED
  2790. }
  2791.  
  2792. new izStats[8], izBody[8]
  2793. new iRankPos, iRankMax
  2794.  
  2795. iRankPos = get_user_stats(id, izStats, izBody)
  2796. iRankMax = get_statsnum()
  2797.  
  2798. colorChat(id, CHATCOLOR_GREEN, "* %L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS], ((effec(izStats) + accuracy(izStats)) / 2))
  2799.  
  2800. return PLUGIN_CONTINUE
  2801. }
  2802.  
  2803. // Report user weapon status to team.
  2804. public cmdReport(id)
  2805. {
  2806. if (!SayReport)
  2807. {
  2808. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2809. return PLUGIN_HANDLED
  2810. }
  2811.  
  2812. new iWeapon, iClip, iAmmo, iHealth, iArmor
  2813.  
  2814. iWeapon = get_user_weapon(id, iClip, iAmmo)
  2815.  
  2816. if (iWeapon != 0)
  2817. xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH)
  2818.  
  2819. iHealth = get_user_health(id)
  2820. iArmor = get_user_armor(id)
  2821.  
  2822. new lWeapon[16]
  2823.  
  2824. format(lWeapon, 15, "%L", id, "WEAPON")
  2825. strtolower(lWeapon)
  2826.  
  2827. if (iClip >= 0)
  2828. {
  2829. format(g_sBuffer, MAX_BUFFER_LENGTH, "^x04%s: ^x03%s^x04, %L: ^x03%d/%d^x04, %L: ^x03%d^x04, %L: ^x03%d", lWeapon, t_sWpn, LANG_SERVER, "AMMO", iClip, iAmmo, LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor)
  2830. }
  2831. else
  2832. format(g_sBuffer, MAX_BUFFER_LENGTH, "^x04%s: ^x03%s^x04, %L: ^x03%d^x04, %L: ^x03%d", lWeapon, t_sWpn[7], LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor)
  2833.  
  2834. engclient_cmd(id, "say_team", g_sBuffer)
  2835.  
  2836. return PLUGIN_CONTINUE
  2837. }
  2838.  
  2839. // Display team map score
  2840. public cmdScore(id)
  2841. {
  2842. if (!SayScore)
  2843. {
  2844. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2845. return PLUGIN_HANDLED
  2846. }
  2847.  
  2848. colorChat(id, CHATCOLOR_GREEN, "%L: %s", id, "GAME_SCORE", g_sScore)
  2849.  
  2850. return PLUGIN_CONTINUE
  2851. }
  2852.  
  2853. // Client switch to enable or disable stats announcements.
  2854. public cmdSwitch(id)
  2855. {
  2856. g_izStatsSwitch[id] = (g_izStatsSwitch[id]) ? 0 : -1
  2857. num_to_str(g_izStatsSwitch[id], t_sText, MAX_TEXT_LENGTH)
  2858. client_cmd(id, "setinfo _amxstatsx %s", t_sText)
  2859.  
  2860. new lEnDis[32]
  2861.  
  2862. format(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
  2863. colorChat(id, CHATCOLOR_GREEN, "* %L", id, "STATS_ANNOUNCE", lEnDis)
  2864.  
  2865. return PLUGIN_CONTINUE
  2866. }
  2867.  
  2868. // Player stats menu.
  2869. public cmdStats(id)
  2870. {
  2871. if (!SayStatsAll)
  2872. {
  2873. colorChat(id, CHATCOLOR_RED, "%L", id, "DISABLED_MSG")
  2874. return PLUGIN_HANDLED
  2875. }
  2876.  
  2877. showStatsMenu(id, g_izUserMenuPosition[id] = 0)
  2878.  
  2879. return PLUGIN_CONTINUE
  2880. }
  2881.  
  2882. //--------------------------------
  2883. // Menu
  2884. //--------------------------------
  2885.  
  2886. public actionStatsMenu(id, key)
  2887. {
  2888. switch (key)
  2889. {
  2890. // Key '1' to '7', execute action on this option
  2891. case 0..6:
  2892. {
  2893. new iOption, iIndex
  2894. iOption = (g_izUserMenuPosition[id] * PPL_MENU_OPTIONS) + key
  2895.  
  2896. if (iOption >= 0 && iOption < 32)
  2897. {
  2898. iIndex = g_izUserMenuPlayers[id][iOption]
  2899.  
  2900. if (is_user_connected(iIndex))
  2901. {
  2902. switch (g_izUserMenuAction[id])
  2903. {
  2904. case 0: format_stats(iIndex, g_sBuffer)
  2905. case 1: format_rankstats(iIndex, g_sBuffer, id)
  2906. default: g_sBuffer[0] = 0
  2907. }
  2908.  
  2909. if (g_sBuffer[0])
  2910. {
  2911. get_user_name(iIndex, t_sName, MAX_NAME_LENGTH)
  2912. show_motd(id, g_sBuffer, t_sName)
  2913. }
  2914. }
  2915. }
  2916.  
  2917. showStatsMenu(id, g_izUserMenuPosition[id])
  2918. }
  2919. // Key '8', change action
  2920. case 7:
  2921. {
  2922. g_izUserMenuAction[id]++
  2923.  
  2924. if (g_izUserMenuAction[id] >= MAX_PPL_MENU_ACTIONS)
  2925. g_izUserMenuAction[id] = 0
  2926.  
  2927. showStatsMenu(id, g_izUserMenuPosition[id])
  2928. }
  2929. // Key '9', select next page of options
  2930. case 8: showStatsMenu(id, ++g_izUserMenuPosition[id])
  2931. // Key '10', cancel or go back to previous menu
  2932. case 9:
  2933. {
  2934. if (g_izUserMenuPosition[id] > 0)
  2935. showStatsMenu(id, --g_izUserMenuPosition[id])
  2936. }
  2937. }
  2938.  
  2939. return PLUGIN_HANDLED
  2940. }
  2941.  
  2942. new g_izUserMenuActionText[MAX_PPL_MENU_ACTIONS][62]
  2943.  
  2944. showStatsMenu(id, iMenuPos)
  2945. {
  2946. formatex(g_izUserMenuActionText[0], charsmax(g_izUserMenuActionText[]),"\r%L", id, "MM_RANKSTATS")
  2947. formatex(g_izUserMenuActionText[1], charsmax(g_izUserMenuActionText[]),"\r%L", id, "MM_RANK")
  2948.  
  2949. new iLen, iKeyMask, iPlayers
  2950. new iUserIndex, iMenuPosMax, iMenuOption, iMenuOptionMax
  2951.  
  2952. get_players(g_izUserMenuPlayers[id], iPlayers)
  2953. iMenuPosMax = ((iPlayers - 1) / PPL_MENU_OPTIONS) + 1
  2954.  
  2955. // If menu pos does not excist use last menu (if players has left)
  2956. if (iMenuPos >= iMenuPosMax)
  2957. iMenuPos = iMenuPosMax - 1
  2958.  
  2959. iUserIndex = iMenuPos * PPL_MENU_OPTIONS
  2960. iLen = format(g_sBuffer, MAX_BUFFER_LENGTH, "\y%L\R%d/%d^n\w^n", id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax)
  2961. iMenuOptionMax = iPlayers - iUserIndex
  2962.  
  2963. if (iMenuOptionMax > PPL_MENU_OPTIONS)
  2964. iMenuOptionMax = PPL_MENU_OPTIONS
  2965.  
  2966. for (iMenuOption = 0; iMenuOption < iMenuOptionMax; iMenuOption++)
  2967. {
  2968. get_user_name(g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH)
  2969. iKeyMask |= (1<<iMenuOption)
  2970. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%d. %s^n\w", iMenuOption + 1, t_sName)
  2971. }
  2972.  
  2973. iKeyMask |= MENU_KEY_8|MENU_KEY_0
  2974. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n8. %s^n\w", g_izUserMenuActionText[g_izUserMenuAction[id]])
  2975.  
  2976. if (iPlayers > iUserIndex)
  2977. {
  2978. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE")
  2979. iKeyMask |= MENU_KEY_9
  2980. }
  2981.  
  2982. if (iMenuPos > 0)
  2983. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK")
  2984. else
  2985. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "EXIT")
  2986.  
  2987. show_menu(id, iKeyMask, g_sBuffer, -1, "Server Stats")
  2988.  
  2989. return PLUGIN_HANDLED
  2990. }
  2991.  
  2992. //------------------------------------------------------------
  2993. // Plugin events
  2994. //------------------------------------------------------------
  2995.  
  2996. // Reset game stats on game start and restart.
  2997. public eventStartGame()
  2998. {
  2999. read_data(2, t_sText, MAX_TEXT_LENGTH)
  3000.  
  3001. if (t_sText[6] == 'w')
  3002. {
  3003. read_data(3, t_sText, MAX_TEXT_LENGTH)
  3004. g_fStartGame = get_gametime() + float(str_to_num(t_sText))
  3005. }
  3006. else
  3007. g_fStartGame = get_gametime()
  3008.  
  3009. return PLUGIN_CONTINUE
  3010. }
  3011.  
  3012. // Round start
  3013. public eventStartRound()
  3014. {
  3015. new iTeam, id, i
  3016.  
  3017. if (read_data(1) >= floatround(get_cvar_float("mp_roundtime") * 60.0,floatround_floor))
  3018. {
  3019.  
  3020. #if defined STATSX_DEBUG
  3021. log_amx("Reset round stats")
  3022. #endif
  3023.  
  3024. // Reset game stats on game start and restart.
  3025. if (g_fStartGame > 0.0 && g_fStartGame <= get_gametime())
  3026. {
  3027. #if defined STATSX_DEBUG
  3028. log_amx("Reset game stats")
  3029. #endif
  3030.  
  3031.  
  3032. g_fStartGame = 0.0
  3033.  
  3034. // Clear team and game stats.
  3035. for (iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  3036. {
  3037. g_izTeamEventScore[iTeam] = 0
  3038.  
  3039. for (i = 0; i < 8; i++)
  3040. g_izTeamGameStats[iTeam][i] = 0
  3041. }
  3042.  
  3043. // Clear game stats, incl '0' that is sum of all users.
  3044. for (id = 0; id < MAX_PLAYERS; id++)
  3045. {
  3046. for (i = 0; i < 8; i++)
  3047. g_izUserGameStats[id][i] = 0
  3048. }
  3049. }
  3050.  
  3051. // Update team score with "TeamScore" event values and
  3052. // clear team round stats.
  3053. for (iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  3054. {
  3055. g_izTeamScore[iTeam] = g_izTeamEventScore[iTeam]
  3056.  
  3057. for (i = 0; i < 8; i++)
  3058. g_izTeamRndStats[iTeam][i] = 0
  3059. }
  3060.  
  3061. // Clear user round stats, incl '0' that is sum of all users.
  3062. for (id = 0; id < MAX_PLAYERS; id++)
  3063. {
  3064. g_izUserRndName[id][0] = 0
  3065.  
  3066. for (i = 0; i < 8; i++)
  3067. g_izUserRndStats[id][i] = 0
  3068.  
  3069. g_fzShowUserStatsTime[id] = 0.0
  3070. }
  3071.  
  3072. // Allow end round stats and reset end round triggered indicator.
  3073. g_iRoundEndTriggered = 0
  3074. g_iRoundEndProcessed = 0
  3075. g_fShowStatsTime = 0.0
  3076.  
  3077. // Update local configuration vars with value in cvars.
  3078. get_config_cvars()
  3079. }
  3080.  
  3081. return PLUGIN_CONTINUE
  3082. }
  3083.  
  3084. // Reset killer info on round restart.
  3085. public eventResetHud(id)
  3086. {
  3087. new args[1]
  3088. args[0] = id
  3089.  
  3090. if (g_iPluginMode & MODE_HUD_DELAY)
  3091. set_task(0.01, "delay_resethud", 200 + id, args, 1)
  3092. else
  3093. delay_resethud(args)
  3094.  
  3095. return PLUGIN_CONTINUE
  3096. }
  3097.  
  3098. public delay_resethud(args[])
  3099. {
  3100. new id = args[0]
  3101. new Float:fGameTime
  3102.  
  3103. // Show user and score round stats after HUD-reset
  3104. #if defined STATSX_DEBUG
  3105. log_amx("Reset HUD for #%d", id)
  3106. #endif
  3107. fGameTime = get_gametime()
  3108. show_user_hudstats(id, fGameTime)
  3109. show_roundend_hudstats(id, fGameTime)
  3110.  
  3111. // Reset round stats
  3112. g_izKilled[id][KILLED_KILLER_ID] = 0
  3113. g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
  3114. g_izShowStatsFlags[id] = -1 // Initialize flags
  3115. g_fzShowUserStatsTime[id] = 0.0
  3116. g_izUserAttackerDistance[id] = 0
  3117.  
  3118. for (new i = 0; i < MAX_PLAYERS; i++)
  3119. g_izUserVictimDistance[id][i] = 0
  3120.  
  3121. return PLUGIN_CONTINUE
  3122. }
  3123.  
  3124. // Save killer info on death.
  3125. public client_death(killer, victim, wpnindex, hitplace, TK)
  3126. {
  3127. // Bail out if no killer.
  3128. if (!killer)
  3129. return PLUGIN_CONTINUE
  3130.  
  3131. if (killer != victim)
  3132. {
  3133. new iaVOrigin[3], iaKOrigin[3]
  3134. new iDistance
  3135.  
  3136. get_user_origin(victim, iaVOrigin)
  3137. get_user_origin(killer, iaKOrigin)
  3138.  
  3139. g_izKilled[victim][KILLED_KILLER_ID] = killer
  3140. g_izKilled[victim][KILLED_KILLER_HEALTH] = get_user_health(killer)
  3141. g_izKilled[victim][KILLED_KILLER_ARMOUR] = get_user_armor(killer)
  3142. g_izKilled[victim][KILLED_KILLER_STATSFIX] = 0
  3143.  
  3144. iDistance = get_distance(iaVOrigin, iaKOrigin)
  3145. g_izUserAttackerDistance[victim] = iDistance
  3146. g_izUserVictimDistance[killer][victim] = iDistance
  3147. }
  3148.  
  3149. g_izKilled[victim][KILLED_TEAM] = get_user_team(victim)
  3150. g_izKilled[victim][KILLED_KILLER_STATSFIX] = 1
  3151.  
  3152. // Display kill stats for the player if round
  3153. // end stats was not processed.
  3154. if (!g_iRoundEndProcessed)
  3155. kill_stats(victim)
  3156.  
  3157. return PLUGIN_CONTINUE
  3158. }
  3159.  
  3160. // Display hudmessage stats on death.
  3161. // This will also update all round and game stats.
  3162. // Must be called at least once per round.
  3163. kill_stats(id)
  3164. {
  3165. // Bail out if user stats timer is non-zero,
  3166. // ie function already called.
  3167. if (g_fzShowUserStatsTime[id] > 0.0)
  3168. {
  3169. return
  3170. }
  3171.  
  3172. new team = get_user_team(id)
  3173. if (team < 1 || team > 2)
  3174. {
  3175. return
  3176. }
  3177.  
  3178. // Flag kill stats displayed for this player.
  3179. g_fzShowUserStatsTime[id] = get_gametime()
  3180.  
  3181. // Add user death stats to user round stats
  3182. new izStats[8], izBody[8]
  3183. new iTeam, i
  3184. new iKiller
  3185.  
  3186. iKiller = g_izKilled[id][KILLED_KILLER_ID]
  3187.  
  3188. // Get user's team (if dead use the saved team)
  3189. if (iKiller)
  3190. iTeam = g_izKilled[id][KILLED_TEAM] - 1
  3191. else
  3192. iTeam = get_user_team(id) - 1
  3193.  
  3194. get_user_name(id, g_izUserRndName[id], MAX_NAME_LENGTH)
  3195.  
  3196. if (get_user_rstats(id, izStats, izBody))
  3197. {
  3198. // Update user's team round stats
  3199. if (iTeam >= 0 && iTeam < MAX_TEAMS)
  3200. {
  3201. for (i = 0; i < 8; i++)
  3202. {
  3203. g_izTeamRndStats[iTeam][i] += izStats[i]
  3204. g_izTeamGameStats[iTeam][i] += izStats[i]
  3205. g_izUserRndStats[0][i] += izStats[i]
  3206. g_izUserGameStats[0][i] += izStats[i]
  3207. }
  3208. }
  3209.  
  3210. // Update user's round stats
  3211. if (g_izUserUserID[id] == get_user_userid(id))
  3212. {
  3213. for (i = 0; i < 8; i++)
  3214. {
  3215. g_izUserRndStats[id][i] += izStats[i]
  3216. g_izUserGameStats[id][i] += izStats[i]
  3217. }
  3218. } else {
  3219. g_izUserUserID[id] = get_user_userid(id)
  3220.  
  3221. for (i = 0; i < 8; i++)
  3222. {
  3223. g_izUserRndStats[id][i] = izStats[i]
  3224. g_izUserGameStats[id][i] = izStats[i]
  3225. }
  3226. }
  3227.  
  3228. } // endif (get_user_rstats())
  3229.  
  3230. // Report stats in the chat section, if player is killed.
  3231. if (KillerChat && iKiller && iKiller != id)
  3232. {
  3233. if (format_kill_ainfo(id, iKiller, g_sBuffer))
  3234. {
  3235. colorChat(id, CHATCOLOR_GREEN, "* %s", g_sBuffer)
  3236. format_kill_vinfo(id, iKiller, g_sBuffer)
  3237. }
  3238.  
  3239. colorChat(id, CHATCOLOR_GREEN, "* %s", g_sBuffer)
  3240. }
  3241.  
  3242. // Display player stats info.
  3243. #if defined STATSX_DEBUG
  3244. log_amx("Kill stats for #%d", id)
  3245. #endif
  3246. show_user_hudstats(id, 0.0)
  3247. }
  3248.  
  3249. public award_cash()
  3250. {
  3251. if(!get_pcvar_num(pcvar_award) || !get_pcvar_num(pcvar_award_cash))
  3252. {
  3253. return PLUGIN_HANDLED
  3254. }
  3255.  
  3256. new izStats[8], izBody[8]
  3257. new szPlayers[32], szName[MAX_NAME_LENGTH], iNumPlayers
  3258. new iAwardCash_Bonus, iAwardCash, iPlace, iAwardChance
  3259.  
  3260. get_players(szPlayers, iNumPlayers)
  3261.  
  3262. for(new i = 0; i < 30; i++)
  3263. {
  3264. iAwardChance = random_num(0, floatround(get_pcvar_float(pcvar_award_chance) * 10.0))
  3265.  
  3266. get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
  3267.  
  3268. for(new k = 0; k < iNumPlayers; k++)
  3269. {
  3270. get_user_name(szPlayers[k], szName, MAX_NAME_LENGTH - 1)
  3271.  
  3272. if(equal(szName, t_sName))
  3273. {
  3274. if(get_pcvar_float(pcvar_award_chance))
  3275. {
  3276. if(!iAwardChance)
  3277. {
  3278. continue
  3279. }
  3280. }
  3281.  
  3282. if (0 < (i + 1) <= 10) iPlace = 1
  3283. if (10 < (i + 1) <= 20) iPlace = 2
  3284. if (20 < (i + 1) <= 30) iPlace = 3
  3285.  
  3286. iAwardCash = get_pcvar_num(pcvar_award_cash) / iPlace
  3287. iAwardCash_Bonus = floatround(get_pcvar_num(pcvar_award_cash) * (((effec(izStats) + accuracy(izStats)) / 2) / 100))
  3288.  
  3289. if((iAwardCash + iAwardCash_Bonus + cs_get_user_money(szPlayers[k])) >= 16000)
  3290. {
  3291. cs_set_user_money(szPlayers[k], 16000)
  3292. }
  3293. else
  3294. {
  3295. cs_set_user_money(szPlayers[k], (iAwardCash + iAwardCash_Bonus + cs_get_user_money(szPlayers[k])))
  3296. }
  3297.  
  3298. if(get_pcvar_num(pcvar_award_anonce_chat))
  3299. {
  3300. if(cs_get_user_team(szPlayers[k]) != CS_TEAM_SPECTATOR && get_pcvar_num(pcvar_pt_bonus_anonce))
  3301. {
  3302. colorChat(szPlayers[k], CHATCOLOR_GREEN, "%L", LANG_SERVER, "MM_AWARD", iAwardCash, iAwardCash_Bonus, i + 1)
  3303. }
  3304. }
  3305. }
  3306. }
  3307. }
  3308.  
  3309. return PLUGIN_CONTINUE
  3310. }
  3311.  
  3312. public time_play_bonus()
  3313. {
  3314. if(!get_pcvar_num(pcvar_pt_bonus) || !get_pcvar_num(pcvar_pt))
  3315. {
  3316. return PLUGIN_HANDLED
  3317. }
  3318.  
  3319. new iCash, iTmpCash, iDay, szDay[5]
  3320. new szPlayers[32], iNum, szName[32]
  3321. new szKey[50], szData[128]
  3322.  
  3323. new iCash_1h = get_pcvar_num(pcvar_pt_bonus_1h)
  3324. new iCash_2h = get_pcvar_num(pcvar_pt_bonus_2h)
  3325. new iCash_3h = get_pcvar_num(pcvar_pt_bonus_3h)
  3326. new iCash_4h = get_pcvar_num(pcvar_pt_bonus_4h)
  3327. new iCash_5h = get_pcvar_num(pcvar_pt_bonus_5h)
  3328.  
  3329. format_time(szDay, sizeof(szDay) - 1, "%d")
  3330. iDay = str_to_num(szDay)
  3331.  
  3332. get_players(szPlayers, iNum)
  3333. for(new i = 0; i < iNum; i++)
  3334. {
  3335. if(cs_get_user_team(szPlayers[i]) == CS_TEAM_SPECTATOR)
  3336. {
  3337. continue
  3338. }
  3339.  
  3340. get_user_name(szPlayers[i], szName, sizeof(szName) - 1)
  3341. formatex(szKey, sizeof(szKey) - 1, "TODAY_PLAY#%s", szName)
  3342. nvault_get(g_Vault2, szKey, szData, sizeof(szData) - 1)
  3343.  
  3344. new szToday[5], szTodayPlay[256]
  3345. parse(szData, szToday, sizeof(szToday), szTodayPlay, sizeof(szTodayPlay))
  3346.  
  3347. if(iDay != str_to_num(szToday))
  3348. {
  3349. formatex(szData, sizeof(szData) - 1, "%d 0", iDay)
  3350. nvault_set(g_Vault2, szKey, szData)
  3351.  
  3352. continue
  3353. }
  3354.  
  3355. new iTime = (get_user_time(szPlayers[i]) + str_to_num(szTodayPlay)) / MM_HOUR
  3356.  
  3357. iCash = cs_get_user_money(szPlayers[i])
  3358.  
  3359. if(!iTime)
  3360. {
  3361. continue
  3362. }
  3363.  
  3364. if(iTime == 1 && iCash_1h != 0)
  3365. {
  3366. if((iCash + iCash_1h) > 16000)
  3367. {
  3368. cs_set_user_money(szPlayers[i], 16000)
  3369. }
  3370. else
  3371. {
  3372. cs_set_user_money(szPlayers[i], iCash + iCash_1h)
  3373. }
  3374. iTmpCash = iCash_1h
  3375. }
  3376.  
  3377. if(iTime == 2 && iCash_2h != 0)
  3378. {
  3379. if((iCash + iCash_2h) > 16000)
  3380. {
  3381. cs_set_user_money(szPlayers[i], 16000)
  3382. }
  3383. else
  3384. {
  3385. cs_set_user_money(szPlayers[i], iCash + iCash_2h)
  3386. }
  3387. iTmpCash = iCash_2h
  3388. }
  3389.  
  3390. if(iTime == 3 && iCash_3h != 0)
  3391. {
  3392. if((iCash + iCash_3h) > 16000)
  3393. {
  3394. cs_set_user_money(szPlayers[i], 16000)
  3395. }
  3396. else
  3397. {
  3398. cs_set_user_money(szPlayers[i], iCash + iCash_3h)
  3399. }
  3400. iTmpCash = iCash_3h
  3401. }
  3402.  
  3403. if(iTime == 4 && iCash_4h != 0)
  3404. {
  3405. if((iCash + iCash_4h) > 16000)
  3406. {
  3407. cs_set_user_money(szPlayers[i], 16000)
  3408. }
  3409. else
  3410. {
  3411. cs_set_user_money(szPlayers[i], iCash + iCash_4h)
  3412. }
  3413. iTmpCash = iCash_4h
  3414. }
  3415.  
  3416. if(iTime > 5 && iCash_5h != 0)
  3417. {
  3418. if((iCash + iCash_5h) > 16000)
  3419. {
  3420. cs_set_user_money(szPlayers[i], 16000)
  3421. }
  3422. else
  3423. {
  3424. cs_set_user_money(szPlayers[i], iCash + iCash_5h)
  3425. }
  3426. iTmpCash = iCash_5h
  3427. }
  3428.  
  3429. colorChat(szPlayers[i], CHATCOLOR_GREEN, "%L", LANG_SERVER, "MM_TIME_PLAY_BONUS", iTime, iTmpCash)
  3430.  
  3431. }
  3432.  
  3433. return PLUGIN_HANDLED
  3434. }
  3435.  
  3436. public eventEndRound()
  3437. {
  3438. award_cash()
  3439.  
  3440. day_stat()
  3441.  
  3442. time_play_bonus()
  3443.  
  3444. // Update local configuration vars with value in cvars.
  3445. get_config_cvars()
  3446.  
  3447. // If first end round event in the round, calculate team score.
  3448. if (!g_iRoundEndTriggered)
  3449. {
  3450. read_data(2, t_sText, MAX_TEXT_LENGTH)
  3451.  
  3452. if (t_sText[7] == 't') // Terrorist wins
  3453. g_izTeamScore[0]++
  3454. else if (t_sText[7] == 'c') // CT wins
  3455. g_izTeamScore[1]++
  3456. }
  3457.  
  3458. set_task(0.3, "ERTask", 997)
  3459.  
  3460. return PLUGIN_CONTINUE
  3461. }
  3462.  
  3463. public client_disconnect(id)
  3464. {
  3465. if(get_pcvar_num(pcvar_pt))
  3466. {
  3467. played_time(id)
  3468. }
  3469. }
  3470.  
  3471. public played_time(id)
  3472. {
  3473. new szPlayers[32], iNum, szKey[32], szData[128], szName[32]
  3474.  
  3475. new szMinute[5], szHour[5], szDay[5], szMonth[5], szYear[5]
  3476. new iMinute, iHour, iDay, iMonth, iYear
  3477.  
  3478. format_time(szMinute, sizeof(szMinute) - 1, "%M")
  3479. format_time(szHour, sizeof(szHour) - 1, "%H")
  3480. format_time(szDay, sizeof(szDay) - 1, "%d")
  3481. format_time(szMonth, sizeof(szMonth) - 1, "%m")
  3482. format_time(szYear, sizeof(szYear) - 1, "%Y")
  3483.  
  3484. iMinute = str_to_num(szMinute)
  3485. iHour = str_to_num(szHour)
  3486. iDay = str_to_num(szDay)
  3487. iMonth = str_to_num(szMonth)
  3488. iYear = str_to_num(szYear)
  3489.  
  3490. get_players(szPlayers, iNum)
  3491.  
  3492. get_user_name(id, szName, sizeof(szName) - 1)
  3493. formatex(szKey, sizeof(szKey) - 1, "PLAYED_TIME#%s", szName)
  3494.  
  3495. nvault_get(g_Vault2, szKey, szData, sizeof(szData) - 1)
  3496.  
  3497. new iTime = str_to_num(szData)
  3498.  
  3499. formatex(szData, sizeof(szData) - 1, "%d", iTime + (get_user_time(id)))
  3500.  
  3501. nvault_set(g_Vault2 , szKey, szData)
  3502.  
  3503. formatex(szKey, sizeof(szKey) - 1, "LAST_VISIT#%s", szName)
  3504. formatex(szData, sizeof(szData) - 1, "%d %d %d %d %d", iDay, iMonth, iYear,iHour, iMinute)
  3505. nvault_set(g_Vault2 , szKey, szData)
  3506.  
  3507. formatex(szKey, sizeof(szKey) - 1, "TODAY_PLAY#%s", szName)
  3508. nvault_get(g_Vault2, szKey, szData, sizeof(szData) - 1)
  3509.  
  3510. new szToday[5], szTodayPlay[256]
  3511. parse(szData, szToday, sizeof(szToday), szTodayPlay, sizeof(szTodayPlay))
  3512.  
  3513. if(str_to_num(szToday) != iDay)
  3514. {
  3515. formatex(szData, sizeof(szData) - 1, "%d 0", iDay)
  3516. nvault_set(g_Vault2 , szKey, szData)
  3517. }
  3518. else
  3519. {
  3520. formatex(szData, sizeof(szData) - 1, "%d %d", iDay, (get_user_time(id) + str_to_num(szTodayPlay)))
  3521. nvault_set(g_Vault2 , szKey, szData)
  3522. }
  3523. }
  3524.  
  3525. public day_stat()
  3526. {
  3527. if(!get_pcvar_num(pcvar_day))
  3528. {
  3529. return PLUGIN_HANDLED
  3530. }
  3531.  
  3532. new g_szData[12], Players[32], iNum, i
  3533. new szDate[5], szTime[5], szKey[6]
  3534.  
  3535. format_time(szDate, sizeof(szDate) - 1, "%d")
  3536. format_time(szTime, sizeof(szTime) - 1, "%H")
  3537.  
  3538. i = str_to_num(szTime)
  3539.  
  3540. nvault_get(g_Vault , "DAY" , g_szData , 11)
  3541.  
  3542. if(str_to_num(g_szData) != str_to_num(szDate))
  3543. {
  3544. day_stat_clear()
  3545. }
  3546.  
  3547. formatex(szKey, 5, "%d-h", i)
  3548. nvault_get(g_Vault , szKey , g_szData , 11 )
  3549.  
  3550. get_players(Players, iNum)
  3551.  
  3552. if(str_to_num(g_szData) < iNum)
  3553. {
  3554. new szStr[5]
  3555.  
  3556. formatex(szStr, 4, "%d", iNum)
  3557. formatex(szKey, 5, "%d-h", i)
  3558.  
  3559. nvault_set(g_Vault , szKey , szStr)
  3560. }
  3561.  
  3562. return PLUGIN_CONTINUE
  3563. }
  3564.  
  3565. public day_stat_clear()
  3566. {
  3567. new szDate[5], szKey[6]
  3568. format_time(szDate, sizeof(szDate) - 1, "%d")
  3569.  
  3570. for(new i = 0; i < 24; i++)
  3571. {
  3572. formatex(szKey, 5, "%d-h", i)
  3573. nvault_set(g_Vault , szKey , "0")
  3574. }
  3575.  
  3576. nvault_set(g_Vault , "DAY" , szDate)
  3577.  
  3578. return PLUGIN_CONTINUE
  3579. }
  3580.  
  3581. public ERTask()
  3582. {
  3583. // Flag round end triggered.
  3584. g_iRoundEndTriggered = 1
  3585.  
  3586. // Display round end stats to all players.
  3587. endround_stats()
  3588. }
  3589.  
  3590. endround_stats()
  3591. {
  3592. // Bail out if end round stats has already been processed
  3593. // or round end not triggered.
  3594. if (g_iRoundEndProcessed || !g_iRoundEndTriggered)
  3595. return
  3596.  
  3597. new iaPlayers[32], iPlayer, iPlayers, id
  3598.  
  3599. get_players(iaPlayers, iPlayers)
  3600.  
  3601. // Display attacker & victim list for all living players.
  3602. // This will also update all round and game stats for all players
  3603. // not killed.
  3604. #if defined STATSX_DEBUG
  3605. log_amx("End round stats")
  3606. #endif
  3607.  
  3608. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  3609. {
  3610. id = iaPlayers[iPlayer]
  3611.  
  3612. if (g_fzShowUserStatsTime[id] == 0.0)
  3613. {
  3614. kill_stats(id)
  3615. }
  3616. }
  3617.  
  3618. g_sAwardAndScore[0] = 0
  3619.  
  3620. // Create round awards.
  3621. if (ShowMostDisruptive)
  3622. add_most_disruptive(g_sAwardAndScore)
  3623. if (ShowBestScore)
  3624. add_best_score(g_sAwardAndScore)
  3625.  
  3626. // Create round score.
  3627. // Compensate HUD message if awards are disabled.
  3628. if (ShowTeamScore || ShowTotalStats)
  3629. {
  3630. if (ShowMostDisruptive && ShowBestScore)
  3631. add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n")
  3632. else if (ShowMostDisruptive || ShowBestScore)
  3633. add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n")
  3634. else
  3635. add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n^n^n")
  3636.  
  3637. if (ShowTeamScore)
  3638. add_team_score(g_sAwardAndScore)
  3639.  
  3640. if (ShowTotalStats)
  3641. add_total_stats(g_sAwardAndScore)
  3642. }
  3643.  
  3644. save_team_chatscore()
  3645.  
  3646. // Get and save round end stats time.
  3647. g_fShowStatsTime = get_gametime()
  3648.  
  3649. // Display round end stats to all players.
  3650. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  3651. {
  3652. id = iaPlayers[iPlayer]
  3653. show_roundend_hudstats(id, 0.0)
  3654. }
  3655.  
  3656. // Flag round end processed.
  3657. g_iRoundEndProcessed = 1
  3658. }
  3659.  
  3660. public eventTeamScore()
  3661. {
  3662. new sTeamID[1 + 1], iTeamScore
  3663. read_data(1, sTeamID, 1)
  3664. iTeamScore = read_data(2)
  3665. g_izTeamEventScore[(sTeamID[0] == 'C') ? 1 : 0] = iTeamScore
  3666.  
  3667. return PLUGIN_CONTINUE
  3668. }
  3669.  
  3670. public eventIntermission()
  3671. {
  3672. if (EndPlayer || EndTop15)
  3673. set_task(1.0, "end_game_stats", 900)
  3674. }
  3675.  
  3676. public end_game_stats()
  3677. {
  3678. new iaPlayers[32], iPlayer, iPlayers, id
  3679.  
  3680. if (EndPlayer)
  3681. {
  3682. get_players(iaPlayers, iPlayers)
  3683.  
  3684. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  3685. {
  3686. id = iaPlayers[iPlayer]
  3687.  
  3688. if (!g_izStatsSwitch[id])
  3689. continue // Do not show any stats
  3690.  
  3691. cmdStatsMe(iaPlayers[iPlayer])
  3692. }
  3693. }
  3694. else if (EndTop15)
  3695. {
  3696. get_players(iaPlayers, iPlayers)
  3697. format_place1(g_sBuffer)
  3698.  
  3699. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  3700. {
  3701. id = iaPlayers[iPlayer]
  3702.  
  3703. if (!g_izStatsSwitch[id])
  3704. continue // Do not show any stats
  3705.  
  3706. new szMotdTitle[30]
  3707. formatex(szMotdTitle, charsmax(szMotdTitle), "1 - %L",id, "MM_PLACE")
  3708. show_motd(iaPlayers[iPlayer], g_sBuffer, szMotdTitle)
  3709. }
  3710. }
  3711.  
  3712. return PLUGIN_CONTINUE
  3713. }
  3714.  
  3715. public eventSpecMode(id)
  3716. {
  3717. new sData[12]
  3718. read_data(2, sData, 11)
  3719. g_izSpecMode[id] = (sData[10] == '2')
  3720.  
  3721. return PLUGIN_CONTINUE
  3722. }
  3723.  
  3724. public eventShowRank(id)
  3725. {
  3726. if (SpecRankInfo && g_izSpecMode[id])
  3727. {
  3728. new iPlayer = read_data(2)
  3729.  
  3730. if (is_user_connected(iPlayer))
  3731. {
  3732. new izStats[8], izBody[8]
  3733. new iRankPos, iRankMax
  3734.  
  3735. get_user_name(iPlayer, t_sName, MAX_NAME_LENGTH)
  3736.  
  3737. iRankPos = get_user_stats(iPlayer, izStats, izBody)
  3738. iRankMax = get_statsnum()
  3739.  
  3740. set_hudtype_specmode()
  3741. ShowSyncHudMsg(id, g_HudSync_SpecInfo, "%L", id, "X_RANK_IS", t_sName, iRankPos, iRankMax)
  3742. }
  3743. }
  3744.  
  3745. return PLUGIN_CONTINUE
  3746. }
  3747.  
  3748. public client_connect(id)
  3749. {
  3750. if (ShowStats)
  3751. {
  3752. get_user_info(id, "_amxstatsx", t_sText, MAX_TEXT_LENGTH)
  3753. g_izStatsSwitch[id] = (t_sText[0]) ? str_to_num(t_sText) : -1
  3754. }
  3755. else
  3756. g_izStatsSwitch[id] = 0
  3757.  
  3758. g_izKilled[id][KILLED_KILLER_ID] = 0
  3759. g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
  3760. g_izShowStatsFlags[id] = 0 // Clear all flags
  3761. g_fzShowUserStatsTime[id] = 0.0
  3762.  
  3763. return PLUGIN_CONTINUE
  3764. }
  3765.  
  3766. new iEffect, iColor_R, iColor_G, iColor_B, g_pcvarColor
  3767. new Float:iFadeIn, Float:iFadeOut, Float:iHoldTime, Float:iPos_X, Float:iPos_Y
  3768.  
  3769. public StatsMarquee(id)
  3770. {
  3771. if(!get_pcvar_num(pcvar_statsmarquee))
  3772. {
  3773. return PLUGIN_HANDLED
  3774. }
  3775.  
  3776. new izStats[8], izBody[8]
  3777.  
  3778. get_stats(marquee_iID, izStats, izBody, m_sName, MAX_NAME_LENGTH)
  3779.  
  3780. switch(get_pcvar_num(pcvar_statsmarquee_position))
  3781. {
  3782. case 1:
  3783. {
  3784. iPos_X = 0.7
  3785. iPos_Y = 0.05
  3786. }
  3787. case 2:
  3788. {
  3789. iPos_X = 0.02
  3790. iPos_Y = 0.7
  3791. }
  3792. case 3:
  3793. {
  3794. iPos_X = 0.02
  3795. iPos_Y = 0.2
  3796. }
  3797. default:
  3798. {
  3799. iPos_X = 0.7
  3800. iPos_Y = 0.78
  3801. }
  3802. }
  3803.  
  3804. g_pcvarColor = get_pcvar_num(pcvar_statsmarquee_color)
  3805.  
  3806. if(g_pcvarColor == 11)
  3807. {
  3808. g_pcvarColor = random_num(1, 9)
  3809. }
  3810.  
  3811. switch(g_pcvarColor)
  3812. {
  3813. case 1:
  3814. {
  3815. // RED
  3816. iColor_R = 255
  3817. iColor_G = 0
  3818. iColor_B = 0
  3819. }
  3820. case 2:
  3821. {
  3822. // GREEN
  3823. iColor_R = 0
  3824. iColor_G = 255
  3825. iColor_B = 0
  3826. }
  3827. case 3:
  3828. {
  3829. // BLUE
  3830. iColor_R = 0
  3831. iColor_G = 0
  3832. iColor_B = 255
  3833. }
  3834. case 4:
  3835. {
  3836. // YELLOW
  3837. iColor_R = 255
  3838. iColor_G = 255
  3839. iColor_B = 0
  3840. }
  3841. case 5:
  3842. {
  3843. // CYAN
  3844. iColor_R = 0
  3845. iColor_G = 255
  3846. iColor_B = 255
  3847. }
  3848. case 6:
  3849. {
  3850. // MAGENTA
  3851. iColor_R = 255
  3852. iColor_G = 0
  3853. iColor_B = 255
  3854. }
  3855. case 7:
  3856. {
  3857. // ORANGE
  3858. iColor_R = 255
  3859. iColor_G = 128
  3860. iColor_B = 0
  3861. }
  3862. case 8:
  3863. {
  3864. // VIOLET
  3865. iColor_R = 0
  3866. iColor_G = 128
  3867. iColor_B = 255
  3868. }
  3869. case 9:
  3870. {
  3871. // GRAY
  3872. iColor_R = 100
  3873. iColor_G = 100
  3874. iColor_B = 100
  3875. }
  3876. case 10:
  3877. {
  3878. // RANDOM
  3879. iColor_R = random_num(0, 255)
  3880. iColor_G = random_num(0, 255)
  3881. iColor_B = random_num(0, 255)
  3882. }
  3883. default:
  3884. {
  3885.  
  3886. }
  3887. }
  3888.  
  3889. if(get_pcvar_num(pcvar_style))
  3890. {
  3891. switch(marquee_iID)
  3892. {
  3893. case 0:
  3894. {
  3895. formatex(marquee_place, charsmax(marquee_place), "%L", id, "MM_FIRSTPLACE")
  3896.  
  3897. if(!g_pcvarColor)
  3898. {
  3899. iColor_R = 0
  3900. iColor_G = 255
  3901. iColor_B = 0
  3902. }
  3903. }
  3904. case 10:
  3905. {
  3906. formatex(marquee_place, charsmax(marquee_place), "%L", id, "MM_SECONDPLACE")
  3907.  
  3908. if(!g_pcvarColor)
  3909. {
  3910. iColor_R = 255
  3911. iColor_G = 255
  3912. iColor_B = 0
  3913. }
  3914. }
  3915. case 20:
  3916. {
  3917. formatex(marquee_place, charsmax(marquee_place), "%L", id, "MM_THIRDPLACE")
  3918.  
  3919. if(!g_pcvarColor)
  3920. {
  3921. iColor_R = 255
  3922. iColor_G = 0
  3923. iColor_B = 0
  3924. }
  3925. }
  3926. }
  3927. }
  3928. else
  3929. {
  3930. formatex(marquee_place, charsmax(marquee_place), "%L", id, "SERVER_STATS")
  3931. }
  3932.  
  3933.  
  3934. switch(get_pcvar_num(pcvar_statsmarquee_effect))
  3935. {
  3936. case 1:
  3937. {
  3938. iEffect = 1
  3939. iFadeIn = 0.2
  3940. iFadeOut = 0.2
  3941. iHoldTime = 5.8
  3942. }
  3943. case 2:
  3944. {
  3945. iEffect = 2
  3946. iFadeIn = 0.05
  3947. iFadeOut = 0.5
  3948. iHoldTime = 2.0
  3949. }
  3950. default:
  3951. {
  3952. iEffect = 0
  3953. iFadeIn = 0.5
  3954. iFadeOut = 0.5
  3955. iHoldTime = 5.5
  3956. }
  3957. }
  3958.  
  3959.  
  3960. set_hudmessage(iColor_R, iColor_G, iColor_B, iPos_X, iPos_Y, iEffect, 0.1, iHoldTime, iFadeIn, iFadeOut, -1)
  3961. show_hudmessage(0,"%L", id, "MM_MARQUEE" , marquee_place, m_sName, marquee_iID + 1, izStats[0], izStats[1])
  3962.  
  3963. marquee_iID++
  3964.  
  3965. if(marquee_iID >= 30)
  3966. {
  3967. marquee_iID = 0
  3968. set_task(300.0, "StatsMarquee", 0, _, 0)
  3969. }
  3970. else
  3971. {
  3972. set_task(6.0, "StatsMarquee", 0, _, 0)
  3973. }
  3974.  
  3975.  
  3976.  
  3977. return PLUGIN_CONTINUE
  3978. }
  3979.  
  3980. /* Thanks for Damaged Soul for finding the information on how to do this.
  3981. http://forums.alliedmods.net/showthread.php?p=79604#post79604
  3982.  
  3983. This is code snippets I find useful.
  3984.  
  3985. ^x01 is Yellow
  3986. ^x03 is Team Color. Ie. Red (Terrorist) or blue (Counter-Terrorist) or grey (SPECTATOR or UNASSIGNED).
  3987. ^x04 is Green
  3988.  
  3989. The colors red, grey, and blue can't be used on the same line. This is not possible at all to do.
  3990.  
  3991. Also there are limitation to using Red or Grey while on the TEAM CT.
  3992. You would have to do for example if they were on CT.
  3993.  
  3994. ColorChat(0, RED, "%s, ^x01This color is yellow. ^x03This color is red. ^x04This color is green.);
  3995.  
  3996. You have to set the Type to RED because of certain messages that need to be sent out so a person on the
  3997. team CT can be sent red colors.
  3998.  
  3999. Some important information. When using MSG_ALL to send color message to all clients and your going to use blue/grey/red
  4000. color sending the TeamInfo Message to tempoary change the player team to achieve this. You must send that message in MSG_ALL
  4001. also. If your going to only send it to one person. You need to MSG_ONE on TeamInfo and SayText. (Thanks to CheapSuit I was able
  4002. to see their was an error and fix it).
  4003.  
  4004. */
  4005.  
  4006. colorChat(id, ChatColor:color, const msg[], {Float,Sql,Result,_}:...)
  4007. {
  4008. new team, index, MSG_Type
  4009. new bool:teamChanged = false
  4010. static message[192]
  4011.  
  4012. switch(color)
  4013. {
  4014. case CHATCOLOR_NORMAL: // Normal
  4015. {
  4016. message[0] = 0x01;
  4017. }
  4018. case CHATCOLOR_GREEN: // Green
  4019. {
  4020. message[0] = 0x04;
  4021. }
  4022. default: // Grey, Red, Blue
  4023. {
  4024. message[0] = 0x03;
  4025. }
  4026. }
  4027.  
  4028. vformat(message[1], 190, msg, 4);
  4029. replace_all(message, 190, "$g", "^x04")
  4030. replace_all(message, 190, "$n", "^x01")
  4031. replace_all(message, 190, "$t", "^x03")
  4032.  
  4033. if(id == 0)
  4034. {
  4035. index = findAnyPlayer();
  4036. MSG_Type = MSG_ALL;
  4037. }
  4038. else
  4039. {
  4040. index = id;
  4041. MSG_Type = MSG_ONE;
  4042. }
  4043. if(index != 0)
  4044. {
  4045. team = get_user_team(index);
  4046. if(color == CHATCOLOR_RED && team != 1)
  4047. {
  4048. messageTeamInfo(index, MSG_Type, g_TeamName[1])
  4049. teamChanged = true
  4050. }
  4051. else
  4052. if(color == CHATCOLOR_BLUE && team != 2)
  4053. {
  4054. messageTeamInfo(index, MSG_Type, g_TeamName[2])
  4055. teamChanged = true
  4056. }
  4057. else
  4058. if(color == CHATCOLOR_GREY && team != 0)
  4059. {
  4060. messageTeamInfo(index, MSG_Type, g_TeamName[0])
  4061. teamChanged = true
  4062. }
  4063. messageSayText(index, MSG_Type, message);
  4064. if(teamChanged)
  4065. {
  4066. messageTeamInfo(index, MSG_Type, g_TeamName[team])
  4067. }
  4068. }
  4069. }
  4070.  
  4071. messageSayText(id, type, message[])
  4072. {
  4073. message_begin(type, g_msgSayText, _, id)
  4074. write_byte(id)
  4075. write_string(message)
  4076. message_end()
  4077. }
  4078.  
  4079. messageTeamInfo(id, type, team[])
  4080. {
  4081. message_begin(type, g_msgTeamInfo, _, id)
  4082. write_byte(id)
  4083. write_string(team)
  4084. message_end()
  4085. }
  4086.  
  4087. findAnyPlayer()
  4088. {
  4089. static players[32], inum, pid
  4090.  
  4091. get_players(players, inum, "ch")
  4092.  
  4093. for (new a = 0; a < inum; a++)
  4094. {
  4095. pid = players[a]
  4096. if(is_user_connected(pid))
  4097. return pid
  4098. }
  4099.  
  4100. return 0
  4101. }
  4102.  
  4103.  
Add Comment
Please, Sign In to add comment