hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.27. 22:58



Jelenlévő felhasználók

Jelenleg 521 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 520 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 12 hozzászólás ]  Oldal 1 2 Következő
Szerző Üzenet
 Hozzászólás témája: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 08:56 
Offline
Beavatott

Csatlakozott: 2014.05.16. 19:44
Hozzászólások: 86
Megköszönt másnak: 14 alkalommal
üdv! szeretnék egy plugin átírásában segítséget kérni,mert eggyik configos ismerősöm se ért hozzá,van egy alap StatsX nevü plugin,amit nemtudok,nemértek hozzá hogy kell át írni ilyenre
http://data.hu/get/7719242/vegsoeredmenyhelp.JPG


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 11:39 
Offline
Felfüggesztve
Avatar

Csatlakozott: 2013.06.09. 18:47
Hozzászólások: 2004
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 220 alkalommal
Kép

_________________
Ha elnyerte valamelyik témában a hozzászólásom a tetszésedet melyet olvastál, akkor egy egyszerű gombnyomással kifejezheted, hogy tetszett.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 11:56 
Offline
Beavatott

Csatlakozott: 2014.05.16. 19:44
Hozzászólások: 86
Megköszönt másnak: 14 alkalommal
ez az error mit takar?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 11:56 
Offline
Beavatott

Csatlakozott: 2014.05.16. 19:44
Hozzászólások: 86
Megköszönt másnak: 14 alkalommal
http://kepfeltoltes.hu/view/140520/vegs ... es.hu_.jpg


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 13:52 
Offline
Őskövület
Avatar

Csatlakozott: 2012.02.27. 09:42
Hozzászólások: 2588
Megköszönt másnak: 25 alkalommal
Megköszönték neki: 418 alkalommal
egyszerűen átkell írni a client_print et ColorChat ra és kész is van posztolj forráskódot bárki átfogja tudni írni.

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 14:36 
Offline
Beavatott

Csatlakozott: 2014.05.16. 19:44
Hozzászólások: 86
Megköszönt másnak: 14 alkalommal
nagyon,de nagyon megköszönném ha segítete valaki ezt a plugint kellene olyanra amit küldtem átirni/átszinezni itt lenne a plugin.megcsinálnám de fingom sincs hogykell :SS
https://forums.alliedmods.net/showthread.php?p=6149


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 14:59 
Offline
Felfüggesztve
Avatar

Csatlakozott: 2013.06.09. 18:47
Hozzászólások: 2004
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 220 alkalommal
Halálkor automatikusan kiírja + zöldel írja. statx.sma -t alakítsd át .amxx é, és cseréld le erre amit átalakítottál.

Tessék :) :

SMA Forráskód: [ Mindet kijelol ]
  1. /* AMX Mod X
  2. * StatsX Plugin
  3. *
  4. * by the AMX Mod X Development Team
  5. * originally developed by OLO
  6. *
  7. * This file is part of AMX Mod X.
  8. *
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * In addition, as a special exception, the author gives permission to
  25. * link the code of this program with the Half-Life Game Engine ("HL
  26. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. * respects for all of the code used other than the HL Engine and MODs
  29. * from Valve. If you modify this file, you may extend this exception
  30. * to your version of the file, but you are not obligated to do so. If
  31. * you do not wish to do so, delete this exception statement from your
  32. * version.
  33. */
  34.  
  35. //--------------------------------
  36. #include <amxmodx>
  37. #include <amxmisc>
  38. #include <csx>
  39. #include <colorchat>
  40. //--------------------------------
  41.  
  42. // Uncomment to activate log debug messages.
  43. //#define STATSX_DEBUG
  44.  
  45. // HUD statistics duration in seconds (minimum 1.0 seconds).
  46. #define HUD_DURATION_CVAR "amx_statsx_duration"
  47. #define HUD_DURATION "12.0"
  48.  
  49. // HUD statistics stop relative freeze end in seconds.
  50. // To stop before freeze end use a negative value.
  51. #define HUD_FREEZE_LIMIT_CVAR "amx_statsx_freeze"
  52. #define HUD_FREEZE_LIMIT "-2.0"
  53.  
  54. // HUD statistics minimum duration, in seconds, to trigger the display logic.
  55. #define HUD_MIN_DURATION 0.2
  56.  
  57. // Config plugin constants.
  58. #define MODE_HUD_DELAY 0 // Make a 0.01 sec delay on HUD reset process.
  59.  
  60. // You can also manualy enable or disable these options by setting them to 1
  61. // For example:
  62. // public ShowAttackers = 1
  63. // However amx_statscfg command is recommended
  64.  
  65. public KillerChat = 0 // displays killer hp&ap to victim console
  66. // and screen
  67.  
  68. public ShowAttackers = 0 // shows attackers
  69. public ShowVictims = 0 // shows victims
  70. public ShowKiller = 0 // shows killer
  71. public ShowTeamScore = 0 // shows team score at round end
  72. public ShowTotalStats = 0 // shows round total stats
  73. public ShowBestScore = 0 // shows rounds best scored player
  74. public ShowMostDisruptive = 0 // shows rounds most disruptive player
  75.  
  76. public EndPlayer = 0 // displays player stats at the end of map
  77. public EndTop15 = 0 // displays top15 at the end of map
  78.  
  79. public SayHP = 0 // displays information about user killer
  80. public SayStatsMe = 0 // displays user's stats and rank
  81. public SayRankStats = 0 // displays user's rank stats
  82. public SayMe = 0 // displays user's stats
  83. public SayRank = 0 // displays user's rank
  84. public SayReport = 0 // report user's weapon status to team
  85. public SayScore = 0 // displays team's map score
  86. public SayTop15 = 0 // displays first 15 players
  87. public SayStatsAll = 0 // displays all players stats and rank
  88.  
  89. public ShowStats = 1 // set client HUD-stats switched off by default
  90. public ShowDistHS = 0 // show distance and HS in attackers and
  91. // victims HUD lists
  92. public ShowFullStats = 0 // show full HUD stats (more than 78 chars)
  93.  
  94. public SpecRankInfo = 0 // displays rank info when spectating
  95.  
  96. // Standard Contstants.
  97. #define MAX_TEAMS 2
  98. #define MAX_PLAYERS 32 + 1
  99.  
  100. #define MAX_NAME_LENGTH 31
  101. #define MAX_WEAPON_LENGTH 31
  102. #define MAX_TEXT_LENGTH 255
  103. #define MAX_BUFFER_LENGTH 2047
  104.  
  105. // User stats parms id
  106. #define STATS_KILLS 0
  107. #define STATS_DEATHS 1
  108. #define STATS_HS 2
  109. #define STATS_TKS 3
  110. #define STATS_SHOTS 4
  111. #define STATS_HITS 5
  112. #define STATS_DAMAGE 6
  113.  
  114. // Global player flags.
  115. new BODY_PART[8][] =
  116. {
  117. "WHOLEBODY",
  118. "HEAD",
  119. "CHEST",
  120. "STOMACH",
  121. "LEFTARM",
  122. "RIGHTARM",
  123. "LEFTLEG",
  124. "RIGHTLEG"
  125. }
  126.  
  127. // Killer information, save killer info at the time when player is killed.
  128. #define KILLED_KILLER_ID 0 // Killer userindex/user-ID
  129. #define KILLED_KILLER_HEALTH 1 // Killer's health
  130. #define KILLED_KILLER_ARMOUR 2 // Killer's armour
  131. #define KILLED_TEAM 3 // Killer's team
  132. #define KILLED_KILLER_STATSFIX 4 // Fix to register the last hit/kill
  133.  
  134. new g_izKilled[MAX_PLAYERS][5]
  135.  
  136. // Menu variables and configuration
  137. #define MAX_PPL_MENU_ACTIONS 2 // Number of player menu actions
  138. #define PPL_MENU_OPTIONS 7 // Number of player options per displayed menu
  139.  
  140. new g_iPluginMode = 0
  141.  
  142. new g_izUserMenuPosition[MAX_PLAYERS] = {0, ...}
  143. new g_izUserMenuAction[MAX_PLAYERS] = {0, ...}
  144. new g_izUserMenuPlayers[MAX_PLAYERS][32]
  145.  
  146. new g_izSpecMode[MAX_PLAYERS] = {0, ...}
  147.  
  148. new g_izShowStatsFlags[MAX_PLAYERS] = {0, ...}
  149. new g_izStatsSwitch[MAX_PLAYERS] = {0, ...}
  150. new Float:g_fzShowUserStatsTime[MAX_PLAYERS] = {0.0, ...}
  151. new Float:g_fShowStatsTime = 0.0
  152. new Float:g_fFreezeTime = 0.0
  153. new Float:g_fFreezeLimitTime = 0.0
  154. new Float:g_fHUDDuration = 0.0
  155.  
  156. new g_iRoundEndTriggered = 0
  157. new g_iRoundEndProcessed = 0
  158.  
  159. new Float:g_fStartGame = 0.0
  160. new g_izTeamScore[MAX_TEAMS] = {0, ...}
  161. new g_izTeamEventScore[MAX_TEAMS] = {0, ...}
  162. new g_izTeamRndStats[MAX_TEAMS][8]
  163. new g_izTeamGameStats[MAX_TEAMS][8]
  164. new g_izUserUserID[MAX_PLAYERS] = {0, ...}
  165. new g_izUserAttackerDistance[MAX_PLAYERS] = {0, ...}
  166. new g_izUserVictimDistance[MAX_PLAYERS][MAX_PLAYERS]
  167. new g_izUserRndName[MAX_PLAYERS][MAX_NAME_LENGTH + 1]
  168. new g_izUserRndStats[MAX_PLAYERS][8]
  169. new g_izUserGameStats[MAX_PLAYERS][8]
  170.  
  171. // Common buffer to improve performance, as Small always zero-initializes all vars
  172. new g_sBuffer[MAX_BUFFER_LENGTH + 1] = ""
  173. new g_sScore[MAX_TEXT_LENGTH + 1] = ""
  174. new g_sAwardAndScore[MAX_BUFFER_LENGTH + 1] = ""
  175.  
  176. new t_sText[MAX_TEXT_LENGTH + 1] = ""
  177. new t_sName[MAX_NAME_LENGTH + 1] = ""
  178. new t_sWpn[MAX_WEAPON_LENGTH + 1] = ""
  179.  
  180. new g_HudSync_EndRound
  181. new g_HudSync_SpecInfo
  182.  
  183. //--------------------------------
  184. // Initialize
  185. //--------------------------------
  186. public plugin_init()
  187. {
  188. // Register plugin.
  189. register_plugin("StatsX", AMXX_VERSION_STR, "AMXX Dev Team")
  190. register_dictionary("statsx.txt")
  191.  
  192. // Register events.
  193. register_event("TextMsg", "eventStartGame", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
  194. register_event("ResetHUD", "eventResetHud", "be")
  195. register_event("RoundTime", "eventStartRound", "bc")
  196. register_event("SendAudio", "eventEndRound", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
  197. register_event("TeamScore", "eventTeamScore", "a")
  198. register_event("30", "eventIntermission", "a")
  199. register_event("TextMsg", "eventSpecMode", "bd", "2&ec_Mod")
  200. register_event("StatusValue", "eventShowRank", "bd", "1=2")
  201. register_event("DeathMsg", "halal", "a")
  202. // Register commands.
  203. register_clcmd("say /hp", "cmdHp", 0, "- display info. about your killer (chat)")
  204. register_clcmd("say /statsme", "cmdStatsMe", 0, "- display your stats (MOTD)")
  205. register_clcmd("say /rankstats", "cmdRankStats", 0, "- display your server stats (MOTD)")
  206. register_clcmd("say /me", "cmdMe", 0, "- display current round stats (chat)")
  207. register_clcmd("say /score", "cmdScore", 0, "- display last score (chat)")
  208. register_clcmd("say /rank", "cmdRank", 0, "- display your rank (chat)")
  209. register_clcmd("say /report", "cmdReport", 0, "- display weapon status (say_team)")
  210. register_clcmd("say /top15", "cmdTop15", 0, "- display top 15 players (MOTD)")
  211. register_clcmd("say /stats", "cmdStats", 0, "- display players stats (menu/MOTD)")
  212. register_clcmd("say /switch", "cmdSwitch", 0, "- switch client's stats on or off")
  213. register_clcmd("say_team /hp", "cmdHp", 0, "- display info. about your killer (chat)")
  214. register_clcmd("say_team /statsme", "cmdStatsMe", 0, "- display your stats (MOTD)")
  215. register_clcmd("say_team /rankstats", "cmdRankStats", 0, "- display your server stats (MOTD)")
  216. register_clcmd("say_team /me", "cmdMe", 0, "- display current round stats (chat)")
  217. register_clcmd("say_team /score", "cmdScore", 0, "- display last score (chat)")
  218. register_clcmd("say_team /rank", "cmdRank", 0, "- display your rank (chat)")
  219. register_clcmd("say_team /report", "cmdReport", 0, "- display weapon status (say_team_team)")
  220. register_clcmd("say_team /top15", "cmdTop15", 0, "- display top 15 players (MOTD)")
  221. register_clcmd("say_team /stats", "cmdStats", 0, "- display players stats (menu/MOTD)")
  222. register_clcmd("say_team /switch", "cmdSwitch", 0, "- switch client's stats on or off")
  223.  
  224. // Register menus.
  225. register_menucmd(register_menuid("Server Stats"), 1023, "actionStatsMenu")
  226.  
  227. // Register special configuration setting and default value.
  228. register_srvcmd("amx_statsx_mode", "cmdPluginMode", ADMIN_CFG, "<flags> - sets plugin options")
  229.  
  230. #if defined STATSX_DEBUG
  231. register_clcmd("say /hudtest", "cmdHudTest")
  232. #endif
  233.  
  234. register_cvar(HUD_DURATION_CVAR, HUD_DURATION)
  235. register_cvar(HUD_FREEZE_LIMIT_CVAR, HUD_FREEZE_LIMIT)
  236.  
  237. // Init buffers and some global vars.
  238. g_sBuffer[0] = 0
  239. save_team_chatscore()
  240.  
  241. g_HudSync_EndRound = CreateHudSyncObj()
  242. g_HudSync_SpecInfo = CreateHudSyncObj()
  243. }
  244.  
  245. public plugin_cfg()
  246. {
  247. new addStast[] = "amx_statscfg add ^"%s^" %s"
  248.  
  249. server_cmd(addStast, "ST_SHOW_KILLER_CHAT", "KillerChat")
  250. server_cmd(addStast, "ST_SHOW_ATTACKERS", "ShowAttackers")
  251. server_cmd(addStast, "ST_SHOW_VICTIMS", "ShowVictims")
  252. server_cmd(addStast, "ST_SHOW_KILLER", "ShowKiller")
  253. server_cmd(addStast, "ST_SHOW_TEAM_SCORE", "ShowTeamScore")
  254. server_cmd(addStast, "ST_SHOW_TOTAL_STATS", "ShowTotalStats")
  255. server_cmd(addStast, "ST_SHOW_BEST_SCORE", "ShowBestScore")
  256. server_cmd(addStast, "ST_SHOW_MOST_DISRUPTIVE", "ShowMostDisruptive")
  257. server_cmd(addStast, "ST_SHOW_HUD_STATS_DEF", "ShowStats")
  258. server_cmd(addStast, "ST_SHOW_DIST_HS_HUD", "ShowDistHS")
  259. server_cmd(addStast, "ST_STATS_PLAYER_MAP_END", "EndPlayer")
  260. server_cmd(addStast, "ST_STATS_TOP15_MAP_END", "EndTop15")
  261. server_cmd(addStast, "ST_SAY_HP", "SayHP")
  262. server_cmd(addStast, "ST_SAY_STATSME", "SayStatsMe")
  263. server_cmd(addStast, "ST_SAY_RANKSTATS", "SayRankStats")
  264. server_cmd(addStast, "ST_SAY_ME", "SayMe")
  265. server_cmd(addStast, "ST_SAY_RANK", "SayRank")
  266. server_cmd(addStast, "ST_SAY_REPORT", "SayReport")
  267. server_cmd(addStast, "ST_SAY_SCORE", "SayScore")
  268. server_cmd(addStast, "ST_SAY_TOP15", "SayTop15")
  269. server_cmd(addStast, "ST_SAY_STATS", "SayStatsAll")
  270. server_cmd(addStast, "ST_SPEC_RANK", "SpecRankInfo")
  271.  
  272. // Update local configuration vars with value in cvars.
  273. get_config_cvars()
  274. }
  275.  
  276. // Set hudmessage format.
  277. set_hudtype_killer(Float:fDuration)
  278. set_hudmessage(220, 80, 0, 0.05, 0.15, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, -1)
  279.  
  280. set_hudtype_endround(Float:fDuration)
  281. {
  282. set_hudmessage(100, 200, 0, 0.05, 0.55, 0, 0.02, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0)
  283. }
  284.  
  285. set_hudtype_attacker(Float:fDuration)
  286. set_hudmessage(220, 80, 0, 0.55, 0.35, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, -1)
  287.  
  288. set_hudtype_victim(Float:fDuration)
  289. set_hudmessage(0, 80, 220, 0.55, 0.60, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, -1)
  290.  
  291. set_hudtype_specmode()
  292. {
  293. set_hudmessage(255, 255, 255, 0.02, 0.96, 2, 0.05, 0.1, 0.01, 3.0, -1)
  294. }
  295.  
  296. #if defined STATSX_DEBUG
  297. public cmdHudTest(id)
  298. {
  299. new i, iLen
  300. iLen = 0
  301.  
  302. for (i = 1; i < 20; i++)
  303. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "....x....1....x....2....x....3....x....4....x....^n")
  304.  
  305. set_hudtype_killer(50.0)
  306. show_hudmessage(id, "%s", g_sBuffer)
  307. }
  308. #endif
  309.  
  310. // Stats formulas
  311. Float:accuracy(izStats[8])
  312. {
  313. if (!izStats[STATS_SHOTS])
  314. return (0.0)
  315.  
  316. return (100.0 * float(izStats[STATS_HITS]) / float(izStats[STATS_SHOTS]))
  317. }
  318.  
  319. Float:effec(izStats[8])
  320. {
  321. if (!izStats[STATS_KILLS])
  322. return (0.0)
  323.  
  324. return (100.0 * float(izStats[STATS_KILLS]) / float(izStats[STATS_KILLS] + izStats[STATS_DEATHS]))
  325. }
  326.  
  327. // Distance formula (metric)
  328. Float:distance(iDistance)
  329. {
  330. return float(iDistance) * 0.0254
  331. }
  332.  
  333. // Get plugin config flags.
  334. set_plugin_mode(id, sFlags[])
  335. {
  336. if (sFlags[0])
  337. g_iPluginMode = read_flags(sFlags)
  338.  
  339. get_flags(g_iPluginMode, t_sText, MAX_TEXT_LENGTH)
  340. console_print(id, "%L", id, "MODE_SET_TO", t_sText)
  341.  
  342. return g_iPluginMode
  343. }
  344.  
  345. // Get config parameters.
  346. get_config_cvars()
  347. {
  348. g_fFreezeTime = get_cvar_float("mp_freezetime")
  349.  
  350. if (g_fFreezeTime < 0.0)
  351. g_fFreezeTime = 0.0
  352.  
  353. g_fHUDDuration = get_cvar_float(HUD_DURATION_CVAR)
  354.  
  355. if (g_fHUDDuration < 1.0)
  356. g_fHUDDuration = 1.0
  357.  
  358. g_fFreezeLimitTime = get_cvar_float(HUD_FREEZE_LIMIT_CVAR)
  359. }
  360.  
  361. // Get and format attackers header and list.
  362. get_attackers(id, sBuffer[MAX_BUFFER_LENGTH + 1])
  363. {
  364. new izStats[8], izBody[8]
  365. new iAttacker
  366. new iFound, iLen
  367. new iMaxPlayer = get_maxplayers()
  368.  
  369. iFound = 0
  370. sBuffer[0] = 0
  371.  
  372. // Get and format header. Add killing attacker statistics if user is dead.
  373. // Make sure shots is greater than zero or division by zero will occur.
  374. // To print a '%', 4 of them must done in a row.
  375. izStats[STATS_SHOTS] = 0
  376. iAttacker = g_izKilled[id][KILLED_KILLER_ID]
  377.  
  378. if (iAttacker)
  379. get_user_astats(id, iAttacker, izStats, izBody)
  380.  
  381. if (izStats[STATS_SHOTS] && ShowFullStats)
  382. {
  383. get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
  384. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %s -- %0.2f%% %L:^n", id, "ATTACKERS", t_sName, accuracy(izStats), id, "ACC")
  385. }
  386. else
  387. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS")
  388.  
  389. // Get and format attacker list.
  390. for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++)
  391. {
  392. if (get_user_astats(id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))
  393. {
  394. iFound = 1
  395. get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
  396.  
  397. if (izStats[STATS_KILLS])
  398. {
  399. if (!ShowDistHS)
  400. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  401. izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
  402. else if (izStats[STATS_HS])
  403. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  404. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id]))
  405. else
  406. 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",
  407. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id]))
  408. }
  409. else
  410. 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")
  411. }
  412. }
  413.  
  414. if (!iFound)
  415. sBuffer[0] = 0
  416.  
  417. return iFound
  418. }
  419.  
  420. // Get and format victims header and list
  421. get_victims(id, sBuffer[MAX_BUFFER_LENGTH + 1])
  422. {
  423. new izStats[8], izBody[8]
  424. new iVictim
  425. new iFound, iLen
  426. new iMaxPlayer = get_maxplayers()
  427.  
  428. iFound = 0
  429. sBuffer[0] = 0
  430.  
  431. // Get and format header.
  432. // Make sure shots is greater than zero or division by zero will occur.
  433. // To print a '%', 4 of them must done in a row.
  434. izStats[STATS_SHOTS] = 0
  435. get_user_vstats(id, 0, izStats, izBody)
  436.  
  437. if (izStats[STATS_SHOTS])
  438. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%% %L:^n", id, "VICTIMS", accuracy(izStats), id, "ACC")
  439. else
  440. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS")
  441.  
  442. for (iVictim = 1; iVictim <= iMaxPlayer; iVictim++)
  443. {
  444. if (get_user_vstats(id, iVictim, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))
  445. {
  446. iFound = 1
  447. get_user_name(iVictim, t_sName, MAX_NAME_LENGTH)
  448.  
  449. if (izStats[STATS_DEATHS])
  450. {
  451. if (!ShowDistHS)
  452. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  453. izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
  454. else if (izStats[STATS_HS])
  455. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
  456. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim]))
  457. else
  458. 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",
  459. izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim]))
  460. }
  461. else
  462. 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")
  463. }
  464. }
  465.  
  466. if (!iFound)
  467. sBuffer[0] = 0
  468.  
  469. return iFound
  470. }
  471.  
  472. // Get and format kill info.
  473. get_kill_info(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
  474. {
  475. new iFound, iLen
  476.  
  477. iFound = 0
  478. sBuffer[0] = 0
  479.  
  480. if (iKiller && iKiller != id)
  481. {
  482. new izAStats[8], izABody[8], izVStats[8], iaVBody[8]
  483.  
  484. iFound = 1
  485. get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
  486.  
  487. izAStats[STATS_HITS] = 0
  488. izAStats[STATS_DAMAGE] = 0
  489. t_sWpn[0] = 0
  490. get_user_astats(id, iKiller, izAStats, izABody, t_sWpn, MAX_WEAPON_LENGTH)
  491.  
  492. izVStats[STATS_HITS] = 0
  493. izVStats[STATS_DAMAGE] = 0
  494. get_user_vstats(id, iKiller, izVStats, iaVBody)
  495.  
  496. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L^n", id, "KILLED_YOU_DIST", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]))
  497. 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])
  498. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "YOU_DID_DMG", izVStats[STATS_DAMAGE], izVStats[STATS_HITS])
  499. }
  500.  
  501. return iFound
  502. }
  503.  
  504. // Get and format most disruptive.
  505. add_most_disruptive(sBuffer[MAX_BUFFER_LENGTH + 1])
  506. {
  507. new id, iMaxDamageId, iMaxDamage, iMaxHeadShots
  508.  
  509. iMaxDamageId = 0
  510. iMaxDamage = 0
  511. iMaxHeadShots = 0
  512.  
  513. // Find player.
  514. for (id = 1; id < MAX_PLAYERS; id++)
  515. {
  516. if (g_izUserRndStats[id][STATS_DAMAGE] >= iMaxDamage && (g_izUserRndStats[id][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots))
  517. {
  518. iMaxDamageId = id
  519. iMaxDamage = g_izUserRndStats[id][STATS_DAMAGE]
  520. iMaxHeadShots = g_izUserRndStats[id][STATS_HS]
  521. }
  522. }
  523.  
  524. // Format statistics.
  525. if (iMaxDamageId)
  526. {
  527. id = iMaxDamageId
  528.  
  529. new Float:fGameEff = effec(g_izUserGameStats[id])
  530. new Float:fRndAcc = accuracy(g_izUserRndStats[id])
  531.  
  532. 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],
  533. g_izUserRndStats[id][STATS_HITS], LANG_SERVER, "HIT_S", iMaxDamage, LANG_SERVER, "DMG", fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC")
  534. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  535. }
  536.  
  537. return iMaxDamageId
  538. }
  539.  
  540. // Get and format best score.
  541. add_best_score(sBuffer[MAX_BUFFER_LENGTH + 1])
  542. {
  543. new id, iMaxKillsId, iMaxKills, iMaxHeadShots
  544.  
  545. iMaxKillsId = 0
  546. iMaxKills = 0
  547. iMaxHeadShots = 0
  548.  
  549. // Find player
  550. for (id = 1; id < MAX_PLAYERS; id++)
  551. {
  552. if (g_izUserRndStats[id][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[id][STATS_KILLS] > iMaxKills || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots))
  553. {
  554. iMaxKillsId = id
  555. iMaxKills = g_izUserRndStats[id][STATS_KILLS]
  556. iMaxHeadShots = g_izUserRndStats[id][STATS_HS]
  557. }
  558. }
  559.  
  560. // Format statistics.
  561. if (iMaxKillsId)
  562. {
  563. id = iMaxKillsId
  564.  
  565. new Float:fGameEff = effec(g_izUserGameStats[id])
  566. new Float:fRndAcc = accuracy(g_izUserRndStats[id])
  567.  
  568. 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],
  569. iMaxKills, LANG_SERVER, "KILL_S", iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC")
  570. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  571. }
  572.  
  573. return iMaxKillsId
  574. }
  575.  
  576. // Get and format team score.
  577. add_team_score(sBuffer[MAX_BUFFER_LENGTH + 1])
  578. {
  579. new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS]
  580.  
  581. // Calculate team stats
  582. for (new iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  583. {
  584. fzMapEff[iTeam] = effec(g_izTeamGameStats[iTeam])
  585. fzMapAcc[iTeam] = accuracy(g_izTeamGameStats[iTeam])
  586. fzRndAcc[iTeam] = accuracy(g_izTeamRndStats[iTeam])
  587. }
  588.  
  589. // Format round team stats, MOTD
  590. 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],
  591. fzMapEff[0], LANG_SERVER, "EFF", fzRndAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzRndAcc[1], LANG_SERVER, "ACC")
  592. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  593. }
  594.  
  595. // Get and format team stats, chat version
  596. save_team_chatscore()
  597. {
  598. new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS]
  599.  
  600. // Calculate team stats
  601. for (new iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  602. {
  603. fzMapEff[iTeam] = effec(g_izTeamGameStats[iTeam])
  604. fzMapAcc[iTeam] = accuracy(g_izTeamGameStats[iTeam])
  605. fzRndAcc[iTeam] = accuracy(g_izTeamRndStats[iTeam])
  606. }
  607.  
  608. // Format game team stats, chat
  609. format(g_sScore, MAX_BUFFER_LENGTH, "TERRORIST %d / %0.2f%% %L / %0.2f%% %L -- CT %d / %0.2f%% %L / %0.2f%% %L", g_izTeamScore[0],
  610. fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC")
  611. }
  612.  
  613. // Get and format total stats.
  614. add_total_stats(sBuffer[MAX_BUFFER_LENGTH + 1])
  615. {
  616. 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",
  617. g_izUserRndStats[0][STATS_HS], g_izUserRndStats[0][STATS_HITS], LANG_SERVER, "HITS", g_izUserRndStats[0][STATS_SHOTS], LANG_SERVER, "SHOT_S")
  618. add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
  619. }
  620.  
  621. // Get and format a user's list of body hits from an attacker.
  622. add_attacker_hits(id, iAttacker, sBuffer[MAX_BUFFER_LENGTH + 1])
  623. {
  624. new iFound = 0
  625.  
  626. if (iAttacker && iAttacker != id)
  627. {
  628. new izStats[8], izBody[8], iLen
  629.  
  630. izStats[STATS_HITS] = 0
  631. get_user_astats(id, iAttacker, izStats, izBody)
  632.  
  633. if (izStats[STATS_HITS])
  634. {
  635. iFound = 1
  636. iLen = strlen(sBuffer)
  637. get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
  638.  
  639. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L:^n", id, "HITS_YOU_IN", t_sName)
  640.  
  641. for (new i = 1; i < 8; i++)
  642. {
  643. if (!izBody[i])
  644. continue
  645.  
  646. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L: %d^n", id, BODY_PART[i], izBody[i])
  647. }
  648. }
  649. }
  650.  
  651. return iFound
  652. }
  653.  
  654. // Get and format killed stats: killer hp, ap, hits.
  655. format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
  656. {
  657. new iFound = 0
  658.  
  659. if (iKiller && iKiller != id)
  660. {
  661. new izStats[8], izBody[8]
  662. new iLen
  663.  
  664. iFound = 1
  665. get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
  666. izStats[STATS_HITS] = 0
  667. get_user_astats(id, iKiller, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH)
  668.  
  669. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L (%dhp, %dap) >>", id, "KILLED_BY_WITH", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]),
  670. g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR])
  671.  
  672. if (izStats[STATS_HITS])
  673. {
  674. for (new i = 1; i < 8; i++)
  675. {
  676. if (!izBody[i])
  677. continue
  678.  
  679. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
  680. }
  681. }
  682. else
  683. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
  684. }
  685. else
  686. format(sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER")
  687.  
  688. return iFound
  689. }
  690.  
  691. // Get and format killed stats: hits, damage on killer.
  692. format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
  693. {
  694. new iFound = 0
  695. new izStats[8]
  696. new izBody[8]
  697. new iLen
  698.  
  699. izStats[STATS_HITS] = 0
  700. izStats[STATS_DAMAGE] = 0
  701. get_user_vstats(id, iKiller, izStats, izBody)
  702.  
  703. if (iKiller && iKiller != id)
  704. {
  705. iFound = 1
  706. get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
  707. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "YOU_HIT", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE])
  708. }
  709. else
  710. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "LAST_RES", izStats[STATS_HITS], izStats[STATS_DAMAGE])
  711.  
  712. if (izStats[STATS_HITS])
  713. {
  714. for (new i = 1; i < 8; i++)
  715. {
  716. if (!izBody[i])
  717. continue
  718.  
  719. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
  720. }
  721. }
  722. else
  723. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
  724.  
  725. return iFound
  726. }
  727.  
  728. // Get and format top 15.
  729. format_top15(sBuffer[MAX_BUFFER_LENGTH + 1])
  730. {
  731. new iMax = get_statsnum()
  732. new izStats[8], izBody[8]
  733. new iLen = 0
  734.  
  735. if (iMax > 15)
  736. iMax = 15
  737.  
  738. new lKills[16], lDeaths[16], lHits[16], lShots[16], lEff[16], lAcc[16]
  739.  
  740. format(lKills, 15, "%L", LANG_SERVER, "KILLS")
  741. format(lDeaths, 15, "%L", LANG_SERVER, "DEATHS")
  742. format(lHits, 15, "%L", LANG_SERVER, "HITS")
  743. format(lShots, 15, "%L", LANG_SERVER, "SHOTS")
  744. format(lEff, 15, "%L", LANG_SERVER, "EFF")
  745. format(lAcc, 15, "%L", LANG_SERVER, "ACC")
  746.  
  747. ucfirst(lEff)
  748. ucfirst(lAcc)
  749.  
  750. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>")
  751. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2s %-22.22s %6s %6s %6s %6s %4s %4s %4s^n", "#", "Nick", lKills, lDeaths, lHits, lShots, "HS", lEff, lAcc)
  752.  
  753. for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
  754. {
  755. get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
  756. replace_all(t_sName, MAX_NAME_LENGTH, "<", "[")
  757. replace_all(t_sName, MAX_NAME_LENGTH, ">", "]")
  758. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i + 1, t_sName, izStats[STATS_KILLS],
  759. izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_HS], effec(izStats), accuracy(izStats))
  760. }
  761. }
  762.  
  763. // Get and format rank stats.
  764. format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
  765. {
  766. new izStats[8] = {0, ...}
  767. new izBody[8]
  768. new iRankPos, iLen
  769. new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16]
  770.  
  771. format(lKills, 15, "%L", id, "KILLS")
  772. format(lDeaths, 15, "%L", id, "DEATHS")
  773. format(lHits, 15, "%L", id, "HITS")
  774. format(lShots, 15, "%L", id, "SHOTS")
  775. format(lDamage, 15, "%L", id, "DAMAGE")
  776. format(lEff, 15, "%L", id, "EFF")
  777. format(lAcc, 15, "%L", id, "ACC")
  778.  
  779. ucfirst(lEff)
  780. ucfirst(lAcc)
  781.  
  782. iRankPos = get_user_stats(id, izStats, izBody)
  783. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>")
  784. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L %L^n^n", id, (!iMyId || iMyId == id) ? "YOUR" : "PLAYERS", id, "RANK_IS", iRankPos, get_statsnum())
  785. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
  786. lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS],
  787. lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
  788.  
  789. new L_BODY_PART[8][32]
  790.  
  791. for (new i = 1; i < 8; i++)
  792. {
  793. format(L_BODY_PART[i], 31, "%L", id, BODY_PART[i])
  794. }
  795.  
  796. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d", "HITS",
  797. 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],
  798. izBody[5], L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7])
  799. }
  800.  
  801. // Get and format stats.
  802. format_stats(id, sBuffer[MAX_BUFFER_LENGTH + 1])
  803. {
  804. new izStats[8] = {0, ...}
  805. new izBody[8]
  806. new iWeapon, iLen
  807. new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16], lWeapon[16]
  808.  
  809. format(lKills, 15, "%L", id, "KILLS")
  810. format(lDeaths, 15, "%L", id, "DEATHS")
  811. format(lHits, 15, "%L", id, "HITS")
  812. format(lShots, 15, "%L", id, "SHOTS")
  813. format(lDamage, 15, "%L", id, "DAMAGE")
  814. format(lEff, 15, "%L", id, "EFF")
  815. format(lAcc, 15, "%L", id, "ACC")
  816. format(lWeapon, 15, "%L", id, "WEAPON")
  817.  
  818. ucfirst(lEff)
  819. ucfirst(lAcc)
  820.  
  821. get_user_wstats(id, 0, izStats, izBody)
  822.  
  823. iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>")
  824. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
  825. lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS],
  826. lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
  827. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6s %6s %6s %6s %6s %4s^n", lWeapon, lKills, lDeaths, lHits, lShots, lDamage, lAcc)
  828.  
  829. for (iWeapon = 1; iWeapon < xmod_get_maxweapons() && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++)
  830. {
  831. if (get_user_wstats(id, iWeapon, izStats, izBody))
  832. {
  833. xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH)
  834. iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6d %6d %6d %6d %6d %3.0f%%^n", t_sWpn, izStats[STATS_KILLS], izStats[STATS_DEATHS],
  835. izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_DAMAGE], accuracy(izStats))
  836. }
  837. }
  838. }
  839.  
  840. // Show round end stats. If gametime is zero then use default duration time.
  841. show_roundend_hudstats(id, Float:fGameTime)
  842. {
  843. // Bail out if there no HUD stats should be shown
  844. // for this player or end round stats not created.
  845. if (!g_izStatsSwitch[id]) return
  846. if (!g_sAwardAndScore[0]) return
  847.  
  848. // If round end timer is zero clear round end stats.
  849. if (g_fShowStatsTime == 0.0)
  850. {
  851. ClearSyncHud(id, g_HudSync_EndRound)
  852. #if defined STATSX_DEBUG
  853. log_amx("Clear round end HUD stats for #%d", id)
  854. #endif
  855. }
  856.  
  857. // Set HUD-duration to default or remaining time.
  858. new Float:fDuration
  859.  
  860. if (fGameTime == 0.0)
  861. fDuration = g_fHUDDuration
  862. else
  863. {
  864. fDuration = g_fShowStatsTime + g_fHUDDuration - fGameTime
  865.  
  866. if (fDuration > g_fFreezeTime + g_fFreezeLimitTime)
  867. fDuration = g_fFreezeTime + g_fFreezeLimitTime
  868. }
  869.  
  870. // Show stats only if more time left than coded minimum.
  871. if (fDuration >= HUD_MIN_DURATION)
  872. {
  873. set_hudtype_endround(fDuration)
  874. ShowSyncHudMsg(id, g_HudSync_EndRound, "%s", g_sAwardAndScore)
  875. #if defined STATSX_DEBUG
  876. log_amx("Show %1.2fs round end HUD stats for #%d", fDuration, id)
  877. #endif
  878. }
  879. }
  880.  
  881. // Show round end stats.
  882. show_user_hudstats(id, Float:fGameTime)
  883. {
  884. // Bail out if there no HUD stats should be shown
  885. // for this player or user stats timer is zero.
  886. if (!g_izStatsSwitch[id]) return
  887. if (g_fzShowUserStatsTime[id] == 0.0) return
  888.  
  889. // Set HUD-duration to default or remaining time.
  890. new Float:fDuration
  891.  
  892. if (fGameTime == 0.0)
  893. fDuration = g_fHUDDuration
  894. else
  895. {
  896. fDuration = g_fzShowUserStatsTime[id] + g_fHUDDuration - fGameTime
  897.  
  898. if (fDuration > g_fFreezeTime + g_fFreezeLimitTime)
  899. fDuration = g_fFreezeTime + g_fFreezeLimitTime
  900. }
  901.  
  902. // Show stats only if more time left than coded minimum.
  903. if (fDuration >= HUD_MIN_DURATION)
  904. {
  905. if (ShowKiller)
  906. {
  907. new iKiller
  908.  
  909. iKiller = g_izKilled[id][KILLED_KILLER_ID]
  910. get_kill_info(id, iKiller, g_sBuffer)
  911. add_attacker_hits(id, iKiller, g_sBuffer)
  912. set_hudtype_killer(fDuration)
  913. show_hudmessage(id, "%s", g_sBuffer)
  914. #if defined STATSX_DEBUG
  915. log_amx("Show %1.2fs %suser HUD k-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
  916. #endif
  917. }
  918.  
  919. if (ShowVictims)
  920. {
  921. get_victims(id, g_sBuffer)
  922. set_hudtype_victim(fDuration)
  923. show_hudmessage(id, "%s", g_sBuffer)
  924. #if defined STATSX_DEBUG
  925. log_amx("Show %1.2fs %suser HUD v-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
  926. #endif
  927. }
  928.  
  929. if (ShowAttackers)
  930. {
  931. get_attackers(id, g_sBuffer)
  932. set_hudtype_attacker(fDuration)
  933. show_hudmessage(id, "%s", g_sBuffer)
  934. #if defined STATSX_DEBUG
  935. log_amx("Show %1.2fs %suser HUD a-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
  936. #endif
  937. }
  938. }
  939. }
  940.  
  941. //------------------------------------------------------------
  942. // Plugin commands
  943. //------------------------------------------------------------
  944.  
  945. // Set or get plugin config flags.
  946. public cmdPluginMode(id, level, cid)
  947. {
  948. if (!cmd_access(id, level, cid, 1))
  949. return PLUGIN_HANDLED
  950.  
  951. if (read_argc() > 1)
  952. read_argv(1, g_sBuffer, MAX_BUFFER_LENGTH)
  953. else
  954. g_sBuffer[0] = 0
  955.  
  956. set_plugin_mode(id, g_sBuffer)
  957.  
  958. return PLUGIN_HANDLED
  959. }
  960.  
  961. // Display MOTD stats.
  962. public cmdStatsMe(id)
  963. {
  964. if (!SayStatsMe)
  965. {
  966. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  967. return PLUGIN_HANDLED
  968. }
  969.  
  970. format_stats(id, g_sBuffer)
  971. get_user_name(id, t_sName, MAX_NAME_LENGTH)
  972. show_motd(id, g_sBuffer, t_sName)
  973.  
  974. return PLUGIN_CONTINUE
  975. }
  976.  
  977. // Display MOTD rank.
  978. public cmdRankStats(id)
  979. {
  980. if (!SayRankStats)
  981. {
  982. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  983. return PLUGIN_HANDLED
  984. }
  985.  
  986. format_rankstats(id, g_sBuffer)
  987. get_user_name(id, t_sName, MAX_NAME_LENGTH)
  988. show_motd(id, g_sBuffer, t_sName)
  989.  
  990. return PLUGIN_CONTINUE
  991. }
  992.  
  993. // Display MOTD top15 ranked.
  994. public cmdTop15(id)
  995. {
  996. if (!SayTop15)
  997. {
  998. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  999. return PLUGIN_HANDLED
  1000. }
  1001.  
  1002. format_top15(g_sBuffer)
  1003. show_motd(id, g_sBuffer, "Top 15")
  1004.  
  1005. return PLUGIN_CONTINUE
  1006. }
  1007.  
  1008. // Display killer information.
  1009. public cmdHp(id)
  1010. {
  1011. if (!SayHP)
  1012. {
  1013. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  1014. return PLUGIN_HANDLED
  1015. }
  1016.  
  1017. new iKiller = g_izKilled[id][KILLED_KILLER_ID]
  1018.  
  1019. format_kill_ainfo(id, iKiller, g_sBuffer)
  1020. client_print(id, print_chat, "* %s", g_sBuffer)
  1021.  
  1022. return PLUGIN_CONTINUE
  1023. }
  1024. public halal()
  1025. {
  1026. new id = read_data(2)
  1027. cmdMe(id)
  1028. }
  1029. // Display user stats.
  1030. public cmdMe(id)
  1031. {
  1032. if (!SayMe)
  1033. {
  1034. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  1035. return PLUGIN_HANDLED
  1036. }
  1037.  
  1038. format_kill_vinfo(id, 0, g_sBuffer)
  1039. ColorChat(id, GREEN, "* %s", g_sBuffer)
  1040.  
  1041. return PLUGIN_CONTINUE
  1042. }
  1043.  
  1044. // Display user rank
  1045. public cmdRank(id)
  1046. {
  1047. if (!SayRank)
  1048. {
  1049. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  1050. return PLUGIN_HANDLED
  1051. }
  1052.  
  1053. new izStats[8], izBody[8]
  1054. new iRankPos, iRankMax
  1055. new Float:fEff, Float:fAcc
  1056.  
  1057. iRankPos = get_user_stats(id, izStats, izBody)
  1058. iRankMax = get_statsnum()
  1059.  
  1060. fEff = effec(izStats)
  1061. fAcc = accuracy(izStats)
  1062.  
  1063. client_print(id, print_chat, "* %L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS], fEff, fAcc)
  1064.  
  1065. return PLUGIN_CONTINUE
  1066. }
  1067.  
  1068. // Report user weapon status to team.
  1069. public cmdReport(id)
  1070. {
  1071. if (!SayReport)
  1072. {
  1073. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  1074. return PLUGIN_HANDLED
  1075. }
  1076.  
  1077. new iWeapon, iClip, iAmmo, iHealth, iArmor
  1078.  
  1079. iWeapon = get_user_weapon(id, iClip, iAmmo)
  1080.  
  1081. if (iWeapon != 0)
  1082. xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH)
  1083.  
  1084. iHealth = get_user_health(id)
  1085. iArmor = get_user_armor(id)
  1086.  
  1087. new lWeapon[16]
  1088.  
  1089. format(lWeapon, 15, "%L", id, "WEAPON")
  1090. strtolower(lWeapon)
  1091.  
  1092. if (iClip >= 0)
  1093. {
  1094. format(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d/%d, %L: %d, %L: %d", lWeapon, t_sWpn, LANG_SERVER, "AMMO", iClip, iAmmo, LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor)
  1095. }
  1096. else
  1097. format(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d, %L: %d", lWeapon, t_sWpn[7], LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor)
  1098.  
  1099. engclient_cmd(id, "say_team", g_sBuffer)
  1100.  
  1101. return PLUGIN_CONTINUE
  1102. }
  1103.  
  1104. // Display team map score
  1105. public cmdScore(id)
  1106. {
  1107. if (!SayScore)
  1108. {
  1109. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  1110. return PLUGIN_HANDLED
  1111. }
  1112.  
  1113. client_print(id, print_chat, "%L: %s", id, "GAME_SCORE", g_sScore)
  1114.  
  1115. return PLUGIN_CONTINUE
  1116. }
  1117.  
  1118. // Client switch to enable or disable stats announcements.
  1119. public cmdSwitch(id)
  1120. {
  1121. g_izStatsSwitch[id] = (g_izStatsSwitch[id]) ? 0 : -1
  1122. num_to_str(g_izStatsSwitch[id], t_sText, MAX_TEXT_LENGTH)
  1123. client_cmd(id, "setinfo _amxstatsx %s", t_sText)
  1124.  
  1125. new lEnDis[32]
  1126.  
  1127. format(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
  1128. client_print(id, print_chat, "* %L", id, "STATS_ANNOUNCE", lEnDis)
  1129.  
  1130. return PLUGIN_CONTINUE
  1131. }
  1132.  
  1133. // Player stats menu.
  1134. public cmdStats(id)
  1135. {
  1136. if (!SayStatsAll)
  1137. {
  1138. client_print(id, print_chat, "%L", id, "DISABLED_MSG")
  1139. return PLUGIN_HANDLED
  1140. }
  1141.  
  1142. showStatsMenu(id, g_izUserMenuPosition[id] = 0)
  1143.  
  1144. return PLUGIN_CONTINUE
  1145. }
  1146.  
  1147. //--------------------------------
  1148. // Menu
  1149. //--------------------------------
  1150.  
  1151. public actionStatsMenu(id, key)
  1152. {
  1153. switch (key)
  1154. {
  1155. // Key '1' to '7', execute action on this option
  1156. case 0..6:
  1157. {
  1158. new iOption, iIndex
  1159. iOption = (g_izUserMenuPosition[id] * PPL_MENU_OPTIONS) + key
  1160.  
  1161. if (iOption >= 0 && iOption < 32)
  1162. {
  1163. iIndex = g_izUserMenuPlayers[id][iOption]
  1164.  
  1165. if (is_user_connected(iIndex))
  1166. {
  1167. switch (g_izUserMenuAction[id])
  1168. {
  1169. case 0: format_stats(iIndex, g_sBuffer)
  1170. case 1: format_rankstats(iIndex, g_sBuffer, id)
  1171. default: g_sBuffer[0] = 0
  1172. }
  1173.  
  1174. if (g_sBuffer[0])
  1175. {
  1176. get_user_name(iIndex, t_sName, MAX_NAME_LENGTH)
  1177. show_motd(id, g_sBuffer, t_sName)
  1178. }
  1179. }
  1180. }
  1181.  
  1182. showStatsMenu(id, g_izUserMenuPosition[id])
  1183. }
  1184. // Key '8', change action
  1185. case 7:
  1186. {
  1187. g_izUserMenuAction[id]++
  1188.  
  1189. if (g_izUserMenuAction[id] >= MAX_PPL_MENU_ACTIONS)
  1190. g_izUserMenuAction[id] = 0
  1191.  
  1192. showStatsMenu(id, g_izUserMenuPosition[id])
  1193. }
  1194. // Key '9', select next page of options
  1195. case 8: showStatsMenu(id, ++g_izUserMenuPosition[id])
  1196. // Key '10', cancel or go back to previous menu
  1197. case 9:
  1198. {
  1199. if (g_izUserMenuPosition[id] > 0)
  1200. showStatsMenu(id, --g_izUserMenuPosition[id])
  1201. }
  1202. }
  1203.  
  1204. return PLUGIN_HANDLED
  1205. }
  1206.  
  1207. new g_izUserMenuActionText[MAX_PPL_MENU_ACTIONS][] = {"Show stats", "Show rank stats"}
  1208.  
  1209. showStatsMenu(id, iMenuPos)
  1210. {
  1211. new iLen, iKeyMask, iPlayers
  1212. new iUserIndex, iMenuPosMax, iMenuOption, iMenuOptionMax
  1213.  
  1214. get_players(g_izUserMenuPlayers[id], iPlayers)
  1215. iMenuPosMax = ((iPlayers - 1) / PPL_MENU_OPTIONS) + 1
  1216.  
  1217. // If menu pos does not excist use last menu (if players has left)
  1218. if (iMenuPos >= iMenuPosMax)
  1219. iMenuPos = iMenuPosMax - 1
  1220.  
  1221. iUserIndex = iMenuPos * PPL_MENU_OPTIONS
  1222. iLen = format(g_sBuffer, MAX_BUFFER_LENGTH, "\y%L\R%d/%d^n\w^n", id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax)
  1223. iMenuOptionMax = iPlayers - iUserIndex
  1224.  
  1225. if (iMenuOptionMax > PPL_MENU_OPTIONS)
  1226. iMenuOptionMax = PPL_MENU_OPTIONS
  1227.  
  1228. for (iMenuOption = 0; iMenuOption < iMenuOptionMax; iMenuOption++)
  1229. {
  1230. get_user_name(g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH)
  1231. iKeyMask |= (1<<iMenuOption)
  1232. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%d. %s^n\w", iMenuOption + 1, t_sName)
  1233. }
  1234.  
  1235. iKeyMask |= MENU_KEY_8|MENU_KEY_0
  1236. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n8. %s^n\w", g_izUserMenuActionText[g_izUserMenuAction[id]])
  1237.  
  1238. if (iPlayers > iUserIndex)
  1239. {
  1240. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE")
  1241. iKeyMask |= MENU_KEY_9
  1242. }
  1243.  
  1244. if (iMenuPos > 0)
  1245. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK")
  1246. else
  1247. iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "EXIT")
  1248.  
  1249. show_menu(id, iKeyMask, g_sBuffer, -1, "Server Stats")
  1250.  
  1251. return PLUGIN_HANDLED
  1252. }
  1253.  
  1254. //------------------------------------------------------------
  1255. // Plugin events
  1256. //------------------------------------------------------------
  1257.  
  1258. // Reset game stats on game start and restart.
  1259. public eventStartGame()
  1260. {
  1261. read_data(2, t_sText, MAX_TEXT_LENGTH)
  1262.  
  1263. if (t_sText[6] == 'w')
  1264. {
  1265. read_data(3, t_sText, MAX_TEXT_LENGTH)
  1266. g_fStartGame = get_gametime() + float(str_to_num(t_sText))
  1267. }
  1268. else
  1269. g_fStartGame = get_gametime()
  1270.  
  1271. return PLUGIN_CONTINUE
  1272. }
  1273.  
  1274. // Round start
  1275. public eventStartRound()
  1276. {
  1277. new iTeam, id, i
  1278.  
  1279. new Float:roundtime = get_cvar_float("mp_roundtime");
  1280. if (read_data(1) >= floatround(roundtime * 60.0,floatround_floor) || (roundtime == 2.3 && read_data(1) == 137)) // these round too weird for it to work through pawn, have to add an exception for it
  1281. {
  1282. #if defined STATSX_DEBUG
  1283. log_amx("Reset round stats")
  1284. #endif
  1285.  
  1286. // Reset game stats on game start and restart.
  1287. if (g_fStartGame > 0.0 && g_fStartGame <= get_gametime())
  1288. {
  1289. #if defined STATSX_DEBUG
  1290. log_amx("Reset game stats")
  1291. #endif
  1292. g_fStartGame = 0.0
  1293.  
  1294. // Clear team and game stats.
  1295. for (iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  1296. {
  1297. g_izTeamEventScore[iTeam] = 0
  1298.  
  1299. for (i = 0; i < 8; i++)
  1300. g_izTeamGameStats[iTeam][i] = 0
  1301. }
  1302.  
  1303. // Clear game stats, incl '0' that is sum of all users.
  1304. for (id = 0; id < MAX_PLAYERS; id++)
  1305. {
  1306. for (i = 0; i < 8; i++)
  1307. g_izUserGameStats[id][i] = 0
  1308. }
  1309. }
  1310.  
  1311. // Update team score with "TeamScore" event values and
  1312. // clear team round stats.
  1313. for (iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
  1314. {
  1315. g_izTeamScore[iTeam] = g_izTeamEventScore[iTeam]
  1316.  
  1317. for (i = 0; i < 8; i++)
  1318. g_izTeamRndStats[iTeam][i] = 0
  1319. }
  1320.  
  1321. // Clear user round stats, incl '0' that is sum of all users.
  1322. for (id = 0; id < MAX_PLAYERS; id++)
  1323. {
  1324. g_izUserRndName[id][0] = 0
  1325.  
  1326. for (i = 0; i < 8; i++)
  1327. g_izUserRndStats[id][i] = 0
  1328.  
  1329. g_fzShowUserStatsTime[id] = 0.0
  1330. }
  1331.  
  1332. // Allow end round stats and reset end round triggered indicator.
  1333. g_iRoundEndTriggered = 0
  1334. g_iRoundEndProcessed = 0
  1335. g_fShowStatsTime = 0.0
  1336.  
  1337. // Update local configuration vars with value in cvars.
  1338. get_config_cvars()
  1339. }
  1340.  
  1341. return PLUGIN_CONTINUE
  1342. }
  1343.  
  1344. // Reset killer info on round restart.
  1345. public eventResetHud(id)
  1346. {
  1347. new args[1]
  1348. args[0] = id
  1349.  
  1350. if (g_iPluginMode & MODE_HUD_DELAY)
  1351. set_task(0.01, "delay_resethud", 200 + id, args, 1)
  1352. else
  1353. delay_resethud(args)
  1354.  
  1355. return PLUGIN_CONTINUE
  1356. }
  1357.  
  1358. public delay_resethud(args[])
  1359. {
  1360. new id = args[0]
  1361. new Float:fGameTime
  1362.  
  1363. // Show user and score round stats after HUD-reset
  1364. #if defined STATSX_DEBUG
  1365. log_amx("Reset HUD for #%d", id)
  1366. #endif
  1367. fGameTime = get_gametime()
  1368. show_user_hudstats(id, fGameTime)
  1369. show_roundend_hudstats(id, fGameTime)
  1370.  
  1371. // Reset round stats
  1372. g_izKilled[id][KILLED_KILLER_ID] = 0
  1373. g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
  1374. g_izShowStatsFlags[id] = -1 // Initialize flags
  1375. g_fzShowUserStatsTime[id] = 0.0
  1376. g_izUserAttackerDistance[id] = 0
  1377.  
  1378. for (new i = 0; i < MAX_PLAYERS; i++)
  1379. g_izUserVictimDistance[id][i] = 0
  1380.  
  1381. return PLUGIN_CONTINUE
  1382. }
  1383.  
  1384. // Save killer info on death.
  1385. public client_death(killer, victim, wpnindex, hitplace, TK)
  1386. {
  1387. // Bail out if no killer.
  1388. if (!killer)
  1389. return PLUGIN_CONTINUE
  1390.  
  1391. if (killer != victim)
  1392. {
  1393. new iaVOrigin[3], iaKOrigin[3]
  1394. new iDistance
  1395.  
  1396. get_user_origin(victim, iaVOrigin)
  1397. get_user_origin(killer, iaKOrigin)
  1398.  
  1399. g_izKilled[victim][KILLED_KILLER_ID] = killer
  1400. g_izKilled[victim][KILLED_KILLER_HEALTH] = get_user_health(killer)
  1401. g_izKilled[victim][KILLED_KILLER_ARMOUR] = get_user_armor(killer)
  1402. g_izKilled[victim][KILLED_KILLER_STATSFIX] = 0
  1403.  
  1404. iDistance = get_distance(iaVOrigin, iaKOrigin)
  1405. g_izUserAttackerDistance[victim] = iDistance
  1406. g_izUserVictimDistance[killer][victim] = iDistance
  1407. }
  1408.  
  1409. g_izKilled[victim][KILLED_TEAM] = get_user_team(victim)
  1410. g_izKilled[victim][KILLED_KILLER_STATSFIX] = 1
  1411.  
  1412. // Display kill stats for the player if round
  1413. // end stats was not processed.
  1414. if (!g_iRoundEndProcessed)
  1415. kill_stats(victim)
  1416.  
  1417. return PLUGIN_CONTINUE
  1418. }
  1419.  
  1420. // Display hudmessage stats on death.
  1421. // This will also update all round and game stats.
  1422. // Must be called at least once per round.
  1423. kill_stats(id)
  1424. {
  1425. // Bail out if user stats timer is non-zero,
  1426. // ie function already called.
  1427. if (g_fzShowUserStatsTime[id] > 0.0)
  1428. {
  1429. return
  1430. }
  1431.  
  1432. new team = get_user_team(id)
  1433. if (team < 1 || team > 2)
  1434. {
  1435. return
  1436. }
  1437.  
  1438. // Flag kill stats displayed for this player.
  1439. g_fzShowUserStatsTime[id] = get_gametime()
  1440.  
  1441. // Add user death stats to user round stats
  1442. new izStats[8], izBody[8]
  1443. new iTeam, i
  1444. new iKiller
  1445.  
  1446. iKiller = g_izKilled[id][KILLED_KILLER_ID]
  1447.  
  1448. // Get user's team (if dead use the saved team)
  1449. if (iKiller)
  1450. iTeam = g_izKilled[id][KILLED_TEAM] - 1
  1451. else
  1452. iTeam = get_user_team(id) - 1
  1453.  
  1454. get_user_name(id, g_izUserRndName[id], MAX_NAME_LENGTH)
  1455.  
  1456. if (get_user_rstats(id, izStats, izBody))
  1457. {
  1458. // Update user's team round stats
  1459. if (iTeam >= 0 && iTeam < MAX_TEAMS)
  1460. {
  1461. for (i = 0; i < 8; i++)
  1462. {
  1463. g_izTeamRndStats[iTeam][i] += izStats[i]
  1464. g_izTeamGameStats[iTeam][i] += izStats[i]
  1465. g_izUserRndStats[0][i] += izStats[i]
  1466. g_izUserGameStats[0][i] += izStats[i]
  1467. }
  1468. }
  1469.  
  1470. // Update user's round stats
  1471. if (g_izUserUserID[id] == get_user_userid(id))
  1472. {
  1473. for (i = 0; i < 8; i++)
  1474. {
  1475. g_izUserRndStats[id][i] += izStats[i]
  1476. g_izUserGameStats[id][i] += izStats[i]
  1477. }
  1478. } else {
  1479. g_izUserUserID[id] = get_user_userid(id)
  1480.  
  1481. for (i = 0; i < 8; i++)
  1482. {
  1483. g_izUserRndStats[id][i] = izStats[i]
  1484. g_izUserGameStats[id][i] = izStats[i]
  1485. }
  1486. }
  1487.  
  1488. } // endif (get_user_rstats())
  1489.  
  1490. // Report stats in the chat section, if player is killed.
  1491. if (KillerChat && iKiller && iKiller != id)
  1492. {
  1493. if (format_kill_ainfo(id, iKiller, g_sBuffer))
  1494. {
  1495. client_print(id, print_chat, "* %s", g_sBuffer)
  1496. format_kill_vinfo(id, iKiller, g_sBuffer)
  1497. }
  1498.  
  1499. client_print(id, print_chat, "* %s", g_sBuffer)
  1500. }
  1501.  
  1502. // Display player stats info.
  1503. #if defined STATSX_DEBUG
  1504. log_amx("Kill stats for #%d", id)
  1505. #endif
  1506. show_user_hudstats(id, 0.0)
  1507. }
  1508.  
  1509. public eventEndRound()
  1510. {
  1511. // Update local configuration vars with value in cvars.
  1512. get_config_cvars()
  1513.  
  1514. // If first end round event in the round, calculate team score.
  1515. if (!g_iRoundEndTriggered)
  1516. {
  1517. read_data(2, t_sText, MAX_TEXT_LENGTH)
  1518.  
  1519. if (t_sText[7] == 't') // Terrorist wins
  1520. g_izTeamScore[0]++
  1521. else if (t_sText[7] == 'c') // CT wins
  1522. g_izTeamScore[1]++
  1523. }
  1524.  
  1525. set_task(0.3, "ERTask", 997)
  1526.  
  1527. return PLUGIN_CONTINUE
  1528. }
  1529.  
  1530. public ERTask()
  1531. {
  1532. // Flag round end triggered.
  1533. g_iRoundEndTriggered = 1
  1534.  
  1535. // Display round end stats to all players.
  1536. endround_stats()
  1537. }
  1538.  
  1539. endround_stats()
  1540. {
  1541. // Bail out if end round stats has already been processed
  1542. // or round end not triggered.
  1543. if (g_iRoundEndProcessed || !g_iRoundEndTriggered)
  1544. return
  1545.  
  1546. new iaPlayers[32], iPlayer, iPlayers, id
  1547.  
  1548. get_players(iaPlayers, iPlayers)
  1549.  
  1550. // Display attacker & victim list for all living players.
  1551. // This will also update all round and game stats for all players
  1552. // not killed.
  1553. #if defined STATSX_DEBUG
  1554. log_amx("End round stats")
  1555. #endif
  1556.  
  1557. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  1558. {
  1559. id = iaPlayers[iPlayer]
  1560.  
  1561. if (g_fzShowUserStatsTime[id] == 0.0)
  1562. {
  1563. kill_stats(id)
  1564. }
  1565. }
  1566.  
  1567. g_sAwardAndScore[0] = 0
  1568.  
  1569. // Create round awards.
  1570. if (ShowMostDisruptive)
  1571. add_most_disruptive(g_sAwardAndScore)
  1572. if (ShowBestScore)
  1573. add_best_score(g_sAwardAndScore)
  1574.  
  1575. // Create round score.
  1576. // Compensate HUD message if awards are disabled.
  1577. if (ShowTeamScore || ShowTotalStats)
  1578. {
  1579. if (ShowMostDisruptive && ShowBestScore)
  1580. add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n")
  1581. else if (ShowMostDisruptive || ShowBestScore)
  1582. add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n")
  1583. else
  1584. add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n^n^n")
  1585.  
  1586. if (ShowTeamScore)
  1587. add_team_score(g_sAwardAndScore)
  1588.  
  1589. if (ShowTotalStats)
  1590. add_total_stats(g_sAwardAndScore)
  1591. }
  1592.  
  1593. save_team_chatscore()
  1594.  
  1595. // Get and save round end stats time.
  1596. g_fShowStatsTime = get_gametime()
  1597.  
  1598. // Display round end stats to all players.
  1599. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  1600. {
  1601. id = iaPlayers[iPlayer]
  1602. show_roundend_hudstats(id, 0.0)
  1603. }
  1604.  
  1605. // Flag round end processed.
  1606. g_iRoundEndProcessed = 1
  1607. }
  1608.  
  1609. public eventTeamScore()
  1610. {
  1611. new sTeamID[1 + 1], iTeamScore
  1612. read_data(1, sTeamID, 1)
  1613. iTeamScore = read_data(2)
  1614. g_izTeamEventScore[(sTeamID[0] == 'C') ? 1 : 0] = iTeamScore
  1615.  
  1616. return PLUGIN_CONTINUE
  1617. }
  1618.  
  1619. public eventIntermission()
  1620. {
  1621. if (EndPlayer || EndTop15)
  1622. set_task(1.0, "end_game_stats", 900)
  1623. }
  1624.  
  1625. public end_game_stats()
  1626. {
  1627. new iaPlayers[32], iPlayer, iPlayers, id
  1628.  
  1629. if (EndPlayer)
  1630. {
  1631. get_players(iaPlayers, iPlayers)
  1632.  
  1633. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  1634. {
  1635. id = iaPlayers[iPlayer]
  1636.  
  1637. if (!g_izStatsSwitch[id])
  1638. continue // Do not show any stats
  1639.  
  1640. cmdStatsMe(iaPlayers[iPlayer])
  1641. }
  1642. }
  1643. else if (EndTop15)
  1644. {
  1645. get_players(iaPlayers, iPlayers)
  1646. format_top15(g_sBuffer)
  1647.  
  1648. for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
  1649. {
  1650. id = iaPlayers[iPlayer]
  1651.  
  1652. if (!g_izStatsSwitch[id])
  1653. continue // Do not show any stats
  1654.  
  1655. show_motd(iaPlayers[iPlayer], g_sBuffer, "Top 15")
  1656. }
  1657. }
  1658.  
  1659. return PLUGIN_CONTINUE
  1660. }
  1661.  
  1662. public eventSpecMode(id)
  1663. {
  1664. new sData[12]
  1665. read_data(2, sData, 11)
  1666. g_izSpecMode[id] = (sData[10] == '2')
  1667.  
  1668. return PLUGIN_CONTINUE
  1669. }
  1670.  
  1671. public eventShowRank(id)
  1672. {
  1673. if (SpecRankInfo && g_izSpecMode[id])
  1674. {
  1675. new iPlayer = read_data(2)
  1676.  
  1677. if (is_user_connected(iPlayer))
  1678. {
  1679. new izStats[8], izBody[8]
  1680. new iRankPos, iRankMax
  1681.  
  1682. get_user_name(iPlayer, t_sName, MAX_NAME_LENGTH)
  1683.  
  1684. iRankPos = get_user_stats(iPlayer, izStats, izBody)
  1685. iRankMax = get_statsnum()
  1686.  
  1687. set_hudtype_specmode()
  1688. ShowSyncHudMsg(id, g_HudSync_SpecInfo, "%L", id, "X_RANK_IS", t_sName, iRankPos, iRankMax)
  1689. }
  1690. }
  1691.  
  1692. return PLUGIN_CONTINUE
  1693. }
  1694.  
  1695. public client_connect(id)
  1696. {
  1697. if (ShowStats)
  1698. {
  1699. get_user_info(id, "_amxstatsx", t_sText, MAX_TEXT_LENGTH)
  1700. g_izStatsSwitch[id] = (t_sText[0]) ? str_to_num(t_sText) : -1
  1701. }
  1702. else
  1703. g_izStatsSwitch[id] = 0
  1704.  
  1705. g_izKilled[id][KILLED_KILLER_ID] = 0
  1706. g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
  1707. g_izShowStatsFlags[id] = 0 // Clear all flags
  1708. g_fzShowUserStatsTime[id] = 0.0
  1709.  
  1710. return PLUGIN_CONTINUE
  1711. }
  1712.  


kovacsgergononame írta:
nagyon,de nagyon megköszönném ha segítete valaki ezt a plugint kellene olyanra amit küldtem átirni/átszinezni itt lenne a plugin.megcsinálnám de fingom sincs hogykell :SS
https://forums.alliedmods.net/showthread.php?p=6149

_________________
Ha elnyerte valamelyik témában a hozzászólásom a tetszésedet melyet olvastál, akkor egy egyszerű gombnyomással kifejezheted, hogy tetszett.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 19:44 
Offline
Beavatott

Csatlakozott: 2014.05.16. 19:44
Hozzászólások: 86
Megköszönt másnak: 14 alkalommal
marhára köszönöm!!!! :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 19:45 
Offline
Beavatott

Csatlakozott: 2014.05.16. 19:44
Hozzászólások: 86
Megköszönt másnak: 14 alkalommal
akkor most leszedem a plugint és átírom az egészet arra mit te irtál,és átalakítom amxre ? :)


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vegso eredmeny
HozzászólásElküldve: 2014.05.20. 20:00 
Offline
Beavatott

Csatlakozott: 2014.05.16. 19:44
Hozzászólások: 86
Megköszönt másnak: 14 alkalommal
letöltöttem az alap statsx plutint kitöröltem a szöveget,bemásoltam amit te irtál az egészet,mentettem,és nem engedi átrakni amxx.re ezt írja ki : Your plugin failed to compile!

Read the errors below:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

statsx.sma(1039) : error 017: undefined symbol "GREEN"
statsx.sma(1039) : warning 215: expression has no effect
statsx.sma(1039) : warning 215: expression has no effect
statsx.sma(1039) : error 001: expected token: ";", but found ")"
statsx.sma(1039) : error 029: invalid expression, assumed zero
statsx.sma(1039) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.
Could not locate output file statsx.amx (compile failed).


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 12 hozzászólás ]  Oldal 1 2 Következő


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 34 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole