Advertisement
Guest User

KH_L4D_Gameme

a guest
Jan 1st, 2019
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 232.92 KB | None | 0 0
  1. /**
  2. * gameME Plugin
  3. * http://www.gameme.com
  4. * Copyright (C) 2007-2018 TTS Oetzel & Goerz GmbH
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20.  
  21.  
  22. #pragma semicolon 1
  23.  
  24. #define REQUIRE_EXTENSIONS
  25. #include <lang>
  26. #include <sourcemod>
  27. #include <keyvalues>
  28. #include <menus>
  29. #include <sdktools>
  30. #include <gameme>
  31. #undef REQUIRE_EXTENSIONS
  32. #include <cstrike>
  33. #include <clientprefs>
  34. #include <sdkhooks>
  35. #include <tf2_stocks>
  36. #include <socket>
  37.  
  38.  
  39. // plugin information
  40. #define GAMEME_PLUGIN_VERSION "4.9.0"
  41. public Plugin:myinfo = {
  42. name = "gameME Plugin",
  43. author = "TTS Oetzel & Goerz GmbH",
  44. description = "gameME Plugin",
  45. version = GAMEME_PLUGIN_VERSION,
  46. url = "http://www.gameme.com"
  47. };
  48.  
  49.  
  50. // mod information
  51. #define MOD_CSS 1
  52. #define MOD_DODS 2
  53. #define MOD_HL2MP 3
  54. #define MOD_TF2 4
  55. #define MOD_L4D 5
  56. #define MOD_L4DII 6
  57. #define MOD_INSMOD 7
  58. #define MOD_FF 8
  59. #define MOD_CSP 9
  60. #define MOD_ZPS 10
  61. #define MOD_CSGO 11
  62.  
  63. new String: team_list[16][32];
  64.  
  65. // gameME Stats
  66. #define GAMEME_TAG "gameME"
  67. enum gameme_plugin_data {
  68. mod_id,
  69. String: game_mod[32],
  70. Handle: block_chat_commands,
  71. Handle: blocked_commands,
  72. Handle: block_chat_commands_values,
  73. Handle: message_prefix,
  74. String: message_prefix_value[32],
  75. Handle: protect_address,
  76. String: protect_address_value[32],
  77. String: protect_address_port,
  78. Handle: display_spectatorinfo,
  79. Handle: menu_main,
  80. Handle: menu_auto,
  81. Handle: menu_events,
  82. Handle: player_color_array,
  83. Handle: message_recipients,
  84. Handle: enable_log_locations,
  85. Handle: enable_damage_display,
  86. Handle: enable_gameme_live,
  87. Handle: gameme_live_address,
  88. String: gameme_live_address_value[32],
  89. String: gameme_live_address_port,
  90. log_locations,
  91. damage_display,
  92. damage_display_type,
  93. live_active,
  94. Float: live_interval,
  95. display_spectator,
  96. bool: sdkhook_available,
  97. EngineVersion: engine_version,
  98. bool: ignore_next_tag_change,
  99. Handle: custom_tags,
  100. Handle: sv_tags,
  101. Handle: live_socket,
  102. server_port,
  103. protobuf
  104. }
  105. new gameme_plugin[gameme_plugin_data];
  106.  
  107.  
  108. /**
  109. * Spectator Info Display
  110. */
  111.  
  112. #define SPECTATOR_TIMER_INTERVAL 0.5
  113. #define SPECTATOR_NONE 0
  114. #define SPECTATOR_FIRSTPERSON 4
  115. #define SPECTATOR_3RDPERSON 5
  116. #define SPECTATOR_FREELOOK 6
  117. #define QUERY_TYPE_UNKNOWN 0
  118. #define QUERY_TYPE_SPECTATOR 1001
  119.  
  120. enum player_display_messages {
  121. String: smessage[255],
  122. supdated
  123. }
  124.  
  125. new player_messages[MAXPLAYERS + 1][MAXPLAYERS + 1][player_display_messages];
  126.  
  127. enum spectator_data {
  128. Handle: stimer,
  129. Float: srequested,
  130. starget
  131. }
  132.  
  133.  
  134. /**
  135. * gameME Stats Players
  136. */
  137.  
  138. enum gameme_data {
  139. prole, parmor, phealth, ploc1, ploc2, ploc3, pangle, pmoney, palive, pweapon, pgglevel,
  140. pspectator[spectator_data]
  141. }
  142.  
  143. new gameme_players[MAXPLAYERS + 1][gameme_data];
  144.  
  145.  
  146. /**
  147. * Hit location tracking
  148. */
  149.  
  150. #define HITGROUP_GENERIC 0
  151. #define HITGROUP_HEAD 1
  152. #define HITGROUP_CHEST 2
  153. #define HITGROUP_STOMACH 3
  154. #define HITGROUP_LEFTARM 4
  155. #define HITGROUP_RIGHTARM 5
  156. #define HITGROUP_LEFTLEG 6
  157. #define HITGROUP_RIGHTLEG 7
  158.  
  159. #define MAX_LOG_WEAPONS 64
  160. #define LOG_HIT_OFFSET 8
  161. enum weapon_data {wshots, whits, wkills, wheadshots, wteamkills, wdamage, wdeaths, whealth, wgeneric, whead, wchest, wstomach, wleftarm, wrightarm, wleftleg, wrightleg}
  162.  
  163. new player_weapons[MAXPLAYERS + 1][MAX_LOG_WEAPONS][weapon_data];
  164.  
  165.  
  166. /**
  167. * Damage tracking
  168. */
  169.  
  170. #define DAMAGE_HITS 0
  171. #define DAMAGE_KILLED 1
  172. #define DAMAGE_HEADSHOT 2
  173. #define DAMAGE_DAMAGE 3
  174. #define DAMAGE_KILLER 4
  175. #define DAMAGE_HPLEFT 5
  176. #define DAMAGE_TEAMKILL 6
  177. #define DAMAGE_WEAPON 7
  178. #define DAMAGE_WEAPONKILLER 8
  179.  
  180. enum damage_data {dhits, dkills, dheadshots, ddamage, dkiller, dhpleft, dteamkill, dweapon}
  181.  
  182. new player_damage[MAXPLAYERS + 1][MAXPLAYERS + 1][damage_data];
  183.  
  184.  
  185. /**
  186. * Misc Handling
  187. */
  188.  
  189. new ColorSlotArray[] = { -1, -1, -1, -1, -1, -1 };
  190.  
  191.  
  192. /**
  193. * Counter-Strike: Global Offensive
  194. */
  195.  
  196.  
  197. #define MAX_CSGO_CODE_MODELS 15
  198. new const String: csgo_code_models[15][] = {"leet",
  199. "phoenix",
  200. "balkan",
  201. "st6",
  202. "gign",
  203. "gsg9",
  204. "anarchist",
  205. "pirate",
  206. "professional",
  207. "separatist",
  208. "fbi",
  209. "idf",
  210. "sas",
  211. "swat",
  212. "zombie"};
  213.  
  214.  
  215. #define MAX_CSGO_WEAPON_COUNT 53
  216. new const String: csgo_weapon_list[][] = { "ak47", "m4a1", "deagle", "awp", "p90", "bizon", "hkp2000",
  217. "glock", "nova", "galilar", "ump45", "famas", "aug", "ssg08",
  218. "p250", "mp7", "elite", "sg556", "knife", "fiveseven", "sawedoff",
  219. "mag7", "hegrenade", "tec9", "scar20", "mp9", "xm1014", "negev",
  220. "g3sg1", "mac10", "m249", "taser", "inferno", "decoy", "flashbang",
  221. "smokegrenade", "molotov", "incgrenade", "knifegg", "usp_silencer",
  222. "m4a1_silencer", "bayonet", "knife_m9_bayonet", "knife_karambit",
  223. "knife_flip", "knife_gut", "cz75a", "knife_tactical", "knife_butterfly",
  224. "knife_falchion", "knife_push", "revolver", "knife_survival_bowie" };
  225.  
  226.  
  227. /**
  228. * Counter-Strike: Source
  229. */
  230.  
  231. new const String: css_code_models[8][] = {"phoenix",
  232. "leet",
  233. "arctic",
  234. "guerilla",
  235. "urban",
  236. "gsg9",
  237. "sas",
  238. "gign"};
  239.  
  240. #define MAX_CSS_CT_MODELS 4
  241. new const String: css_ct_models[4][] = {"models/player/ct_urban.mdl",
  242. "models/player/ct_gsg9.mdl",
  243. "models/player/ct_sas.mdl",
  244. "models/player/ct_gign.mdl"};
  245.  
  246. #define MAX_CSS_TS_MODELS 4
  247. new const String: css_ts_models[4][] = {"models/player/t_phoenix.mdl",
  248. "models/player/t_leet.mdl",
  249. "models/player/t_arctic.mdl",
  250. "models/player/t_guerilla.mdl"};
  251.  
  252.  
  253.  
  254. #define MAX_CSS_WEAPON_COUNT 28
  255. new const String: css_weapon_list[][] = { "ak47", "m4a1", "awp", "deagle", "mp5navy", "aug", "p90",
  256. "famas", "galil", "scout", "g3sg1", "hegrenade", "usp",
  257. "glock", "m249", "m3", "elite", "fiveseven", "mac10",
  258. "p228", "sg550", "sg552", "tmp", "ump45", "xm1014", "knife",
  259. "smokegrenade", "flashbang" };
  260.  
  261. enum css_plugin_data {
  262. money_offset
  263. }
  264.  
  265. new css_data[css_plugin_data];
  266.  
  267.  
  268. /**
  269. * Day of Defeat: Source
  270. */
  271.  
  272. #define MAX_DODS_WEAPON_COUNT 26
  273. new const String: dods_weapon_list[][] = {
  274. "thompson", // 11
  275. "m1carbine", // 7
  276. "k98", // 8
  277. "k98_scoped", // 10 // 34
  278. "mp40", // 12
  279. "mg42", // 16 // 36
  280. "mp44", // 13 // 38
  281. "colt", // 3
  282. "garand", // 31 // 6
  283. "spring", // 9 // 33
  284. "c96", // 5
  285. "bar", // 14
  286. "30cal", // 15 // 35
  287. "bazooka", // 17
  288. "pschreck", // 18
  289. "p38", // 4
  290. "spade", // 2
  291. "frag_ger", // 20
  292. "punch", // 30 // 29
  293. "frag_us", // 19
  294. "amerknife", // 1
  295. "riflegren_ger", // 26
  296. "riflegren_us", // 25
  297. "smoke_ger", // 24
  298. "smoke_us", // 23
  299. "dod_bomb_target"
  300. };
  301.  
  302.  
  303. /**
  304. * Left4Dead
  305. */
  306.  
  307. #define MAX_L4D_WEAPON_COUNT 23
  308. new const String: l4d_weapon_list[][] = { "rifle", "autoshotgun", "pumpshotgun", "smg", "dual_pistols",
  309. "pipe_bomb", "hunting_rifle", "pistol", "prop_minigun",
  310. "tank_claw", "hunter_claw", "smoker_claw", "boomer_claw",
  311. "smg_silenced", "pistol_magnum", "rifle_ak47", "rifle_desert",
  312. "shotgun_chrome", "shotgun_spas", "sniper_military", "jockey_claw",
  313. "splitter_claw", "charger_claw"
  314. };
  315.  
  316. enum l4dii_plugin_data {
  317. active_weapon_offset
  318. }
  319.  
  320. new l4dii_data[l4dii_plugin_data];
  321.  
  322.  
  323. /**
  324. * Half-Life 2: Deathmatch
  325. */
  326.  
  327. #define MAX_HL2MP_WEAPON_COUNT 6
  328. new const String: hl2mp_weapon_list[][] = { "crossbow_bolt", "smg1", "357", "shotgun", "ar2", "pistol" };
  329.  
  330. #define HL2MP_CROSSBOW 0
  331.  
  332. enum hl2mp_plugin_data {
  333. Handle: teamplay,
  334. bool: teamplay_enabled,
  335. Handle: boltchecks,
  336. crossbow_owner_offset
  337. }
  338.  
  339. new hl2mp_data[hl2mp_plugin_data];
  340.  
  341. enum hl2mp_player {
  342. next_hitgroup,
  343. nextbow_hitgroup
  344. }
  345.  
  346. new hl2mp_players[MAXPLAYERS + 1][hl2mp_player];
  347.  
  348.  
  349. /**
  350. * Zombie Panic! Source
  351. */
  352.  
  353. #define MAX_ZPS_WEAPON_COUNT 11
  354. new const String: zps_weapon_list[][] = { "870", "revolver", "ak47", "usp", "glock18c", "glock", "mp5", "m4", "supershorty", "winchester", "ppk"};
  355.  
  356. enum zps_player {
  357. next_hitgroup
  358. }
  359.  
  360. new zps_players[MAXPLAYERS + 1][zps_player];
  361.  
  362.  
  363. /**
  364. * Insurgency 2014
  365. */
  366.  
  367. #define MAX_INSMOD_WEAPON_COUNT 30
  368. new const String: insmod_weapon_list[][] = {"ak74", "akm", "aks74u", "fal", "m14", "m16a4", "m1911", "m1a1", "m249", "m40a1", "m45", "m4a1", "m590", "m9", "makarov", "mini14", "mk18", "mosin", "mp40", "mp5", "rpk", "sks", "toz", "ump45", "galil", "galil_sar", "sterling", "model10", "l1a1", "gurkha"};
  369.  
  370. enum insmod_player {
  371. String: last_role[64]
  372. }
  373.  
  374. new insmod_players[MAXPLAYERS + 1][insmod_player];
  375.  
  376.  
  377. /**
  378. * Team Fortress 2
  379. */
  380.  
  381. #define TF2_UNLOCKABLE_BIT (1<<30)
  382. #define TF2_WEAPON_PREFIX_LENGTH 10
  383. #define TF2_MAX_LOADOUT_SLOTS 8
  384. #define TF2_OBJ_DISPENSER 0
  385. #define TF2_OBJ_TELEPORTER 1
  386. #define TF2_OBJ_SENTRYGUN 2
  387. #define TF2_OBJ_SENTRYGUN_MINI 20
  388. #define TF2_ITEMINDEX_DEMOSHIELD 131
  389. #define TF2_ITEMINDEX_GUNBOATS 133
  390. #define TF2_JUMP_NONE 0
  391. #define TF2_JUMP_ROCKET_START 1
  392. #define TF2_JUMP_ROCKET 2
  393. #define TF2_JUMP_STICKY 3
  394. #define TF2_LUNCHBOX_CHOCOLATE 159
  395. #define TF2_LUNCHBOX_STEAK 311
  396.  
  397. #define MAX_TF2_WEAPON_COUNT 28
  398. new const String: tf2_weapon_list[MAX_TF2_WEAPON_COUNT][] = {
  399. "ball",
  400. "flaregun",
  401. "minigun",
  402. "natascha",
  403. "pistol",
  404. "pistol_scout",
  405. "revolver",
  406. "ambassador",
  407. "scattergun",
  408. "force_a_nature",
  409. "shotgun_hwg",
  410. "shotgun_primary",
  411. "shotgun_pyro",
  412. "shotgun_soldier",
  413. "smg",
  414. "sniperrifle",
  415. "syringegun_medic",
  416. "blutsauger",
  417. "tf_projectile_arrow",
  418. "tf_projectile_pipe",
  419. "tf_projectile_pipe_remote",
  420. "sticky_resistance",
  421. "tf_projectile_rocket",
  422. "rocketlauncher_directhit",
  423. "deflect_rocket",
  424. "deflect_promode",
  425. "deflect_flare",
  426. "deflect_arrow"
  427. };
  428.  
  429.  
  430. enum tf2_plugin_data {
  431. Handle: weapons_trie,
  432. Handle: items_kv,
  433. Handle: slots_trie,
  434. stun_ball_id,
  435. Handle: stun_balls,
  436. Handle: wearables,
  437. carry_offset,
  438. Handle: critical_hits,
  439. critical_hits_enabled,
  440. bool: block_next_logging
  441. }
  442.  
  443. new tf2_data[tf2_plugin_data];
  444.  
  445.  
  446. enum tf2_player {
  447. player_loadout0[TF2_MAX_LOADOUT_SLOTS],
  448. player_loadout1[TF2_MAX_LOADOUT_SLOTS],
  449. bool: player_loadout_updated,
  450. Handle: object_list,
  451. Float: object_removed,
  452. jump_status,
  453. Float: dalokohs,
  454. TFClassType: player_class,
  455. bool: carry_object
  456. }
  457.  
  458. new tf2_players[MAXPLAYERS + 1][tf2_player];
  459.  
  460.  
  461. /**
  462. * Raw Messages Interface
  463. */
  464.  
  465. #define RAW_MESSAGE_RANK 1
  466. #define RAW_MESSAGE_PLACE 2
  467. #define RAW_MESSAGE_KDEATH 3
  468. #define RAW_MESSAGE_SESSION_DATA 4
  469. #define RAW_MESSAGE_TOP10 5
  470. #define RAW_MESSAGE_NEXT 6
  471.  
  472. // callbacks
  473. #define RAW_MESSAGE_CALLBACK_PLAYER 101
  474. #define RAW_MESSAGE_CALLBACK_TOP10 102
  475. #define RAW_MESSAGE_CALLBACK_NEXT 103
  476.  
  477. // internal usage
  478. #define RAW_MESSAGE_CALLBACK_INT_CLOSE 1000
  479. #define RAW_MESSAGE_CALLBACK_INT_SPECTATOR 1001
  480.  
  481.  
  482. new Handle: gameMEStatsRankForward;
  483. new Handle: gameMEStatsPublicCommandForward;
  484. new Handle: gameMEStatsTop10Forward;
  485. new Handle: gameMEStatsNextForward;
  486.  
  487. new global_query_id = 0;
  488. new Handle: QueryCallbackArray;
  489.  
  490. #define CALLBACK_DATA_SIZE 7
  491. enum callback_data {callback_data_id, Float: callback_data_time, callback_data_client, Handle: callback_data_plugin, Function: callback_data_function, callback_data_payload, callback_data_limit};
  492.  
  493.  
  494. public OnPluginStart()
  495. {
  496. LogToGame("gameME Plugin %s (http://www.gameme.com), copyright (c) 2007-2016 TTS Oetzel & Goerz GmbH", GAMEME_PLUGIN_VERSION);
  497.  
  498. // setup default values
  499. gameme_plugin[log_locations] = 1;
  500. gameme_plugin[damage_display] = 0;
  501. gameme_plugin[damage_display_type] = 1;
  502. gameme_plugin[live_active] = 0;
  503. gameme_plugin[live_interval] = 0.2;
  504. gameme_plugin[protobuf] = 0;
  505.  
  506. LoadTranslations("gameme.phrases");
  507.  
  508. // block origin gameME Stats command setup by default
  509. gameme_plugin[blocked_commands] = CreateTrie();
  510. SetTrieValue(gameme_plugin[blocked_commands], "rank", 1);
  511. SetTrieValue(gameme_plugin[blocked_commands], "/rank", 1);
  512. SetTrieValue(gameme_plugin[blocked_commands], "!rank", 1);
  513. SetTrieValue(gameme_plugin[blocked_commands], "skill", 1);
  514. SetTrieValue(gameme_plugin[blocked_commands], "/skill", 1);
  515. SetTrieValue(gameme_plugin[blocked_commands], "!skill", 1);
  516. SetTrieValue(gameme_plugin[blocked_commands], "points", 1);
  517. SetTrieValue(gameme_plugin[blocked_commands], "/points", 1);
  518. SetTrieValue(gameme_plugin[blocked_commands], "!points", 1);
  519. SetTrieValue(gameme_plugin[blocked_commands], "place", 1);
  520. SetTrieValue(gameme_plugin[blocked_commands], "/place", 1);
  521. SetTrieValue(gameme_plugin[blocked_commands], "!place", 1);
  522. SetTrieValue(gameme_plugin[blocked_commands], "session", 1);
  523. SetTrieValue(gameme_plugin[blocked_commands], "/session", 1);
  524. SetTrieValue(gameme_plugin[blocked_commands], "!session", 1);
  525. SetTrieValue(gameme_plugin[blocked_commands], "sdata", 1);
  526. SetTrieValue(gameme_plugin[blocked_commands], "/sdata", 1);
  527. SetTrieValue(gameme_plugin[blocked_commands], "!sdata", 1);
  528. SetTrieValue(gameme_plugin[blocked_commands], "kpd", 1);
  529. SetTrieValue(gameme_plugin[blocked_commands], "/kpd", 1);
  530. SetTrieValue(gameme_plugin[blocked_commands], "!kpd", 1);
  531. SetTrieValue(gameme_plugin[blocked_commands], "kdratio", 1);
  532. SetTrieValue(gameme_plugin[blocked_commands], "/kdratio", 1);
  533. SetTrieValue(gameme_plugin[blocked_commands], "!kdratio", 1);
  534. SetTrieValue(gameme_plugin[blocked_commands], "kdeath", 1);
  535. SetTrieValue(gameme_plugin[blocked_commands], "/kdeath", 1);
  536. SetTrieValue(gameme_plugin[blocked_commands], "!kdeath", 1);
  537. SetTrieValue(gameme_plugin[blocked_commands], "next", 1);
  538. SetTrieValue(gameme_plugin[blocked_commands], "/next", 1);
  539. SetTrieValue(gameme_plugin[blocked_commands], "!next", 1);
  540. SetTrieValue(gameme_plugin[blocked_commands], "load", 1);
  541. SetTrieValue(gameme_plugin[blocked_commands], "/load", 1);
  542. SetTrieValue(gameme_plugin[blocked_commands], "!load", 1);
  543. SetTrieValue(gameme_plugin[blocked_commands], "status", 1);
  544. SetTrieValue(gameme_plugin[blocked_commands], "/status", 1);
  545. SetTrieValue(gameme_plugin[blocked_commands], "!status", 1);
  546. SetTrieValue(gameme_plugin[blocked_commands], "top20", 1);
  547. SetTrieValue(gameme_plugin[blocked_commands], "/top20", 1);
  548. SetTrieValue(gameme_plugin[blocked_commands], "!top20", 1);
  549. SetTrieValue(gameme_plugin[blocked_commands], "top10", 1);
  550. SetTrieValue(gameme_plugin[blocked_commands], "/top10", 1);
  551. SetTrieValue(gameme_plugin[blocked_commands], "!top10", 1);
  552. SetTrieValue(gameme_plugin[blocked_commands], "top5", 1);
  553. SetTrieValue(gameme_plugin[blocked_commands], "/top5", 1);
  554. SetTrieValue(gameme_plugin[blocked_commands], "!top5", 1);
  555. SetTrieValue(gameme_plugin[blocked_commands], "maps", 1);
  556. SetTrieValue(gameme_plugin[blocked_commands], "/maps", 1);
  557. SetTrieValue(gameme_plugin[blocked_commands], "!maps", 1);
  558. SetTrieValue(gameme_plugin[blocked_commands], "map_stats", 1);
  559. SetTrieValue(gameme_plugin[blocked_commands], "/map_stats", 1);
  560. SetTrieValue(gameme_plugin[blocked_commands], "!map_stats", 1);
  561. SetTrieValue(gameme_plugin[blocked_commands], "clans", 1);
  562. SetTrieValue(gameme_plugin[blocked_commands], "/clans", 1);
  563. SetTrieValue(gameme_plugin[blocked_commands], "!clans", 1);
  564. SetTrieValue(gameme_plugin[blocked_commands], "cheaters", 1);
  565. SetTrieValue(gameme_plugin[blocked_commands], "/cheaters", 1);
  566. SetTrieValue(gameme_plugin[blocked_commands], "!cheaters", 1);
  567. SetTrieValue(gameme_plugin[blocked_commands], "statsme", 1);
  568. SetTrieValue(gameme_plugin[blocked_commands], "/statsme", 1);
  569. SetTrieValue(gameme_plugin[blocked_commands], "!statsme", 1);
  570. SetTrieValue(gameme_plugin[blocked_commands], "weapons", 1);
  571. SetTrieValue(gameme_plugin[blocked_commands], "/weapons", 1);
  572. SetTrieValue(gameme_plugin[blocked_commands], "!weapons", 1);
  573. SetTrieValue(gameme_plugin[blocked_commands], "weapon", 1);
  574. SetTrieValue(gameme_plugin[blocked_commands], "/weapon", 1);
  575. SetTrieValue(gameme_plugin[blocked_commands], "!weapon", 1);
  576. SetTrieValue(gameme_plugin[blocked_commands], "action", 1);
  577. SetTrieValue(gameme_plugin[blocked_commands], "/action", 1);
  578. SetTrieValue(gameme_plugin[blocked_commands], "!action", 1);
  579. SetTrieValue(gameme_plugin[blocked_commands], "actions", 1);
  580. SetTrieValue(gameme_plugin[blocked_commands], "/actions", 1);
  581. SetTrieValue(gameme_plugin[blocked_commands], "!actions", 1);
  582. SetTrieValue(gameme_plugin[blocked_commands], "accuracy", 1);
  583. SetTrieValue(gameme_plugin[blocked_commands], "/accuracy", 1);
  584. SetTrieValue(gameme_plugin[blocked_commands], "!accuracy", 1);
  585. SetTrieValue(gameme_plugin[blocked_commands], "targets", 1);
  586. SetTrieValue(gameme_plugin[blocked_commands], "/targets", 1);
  587. SetTrieValue(gameme_plugin[blocked_commands], "!targets", 1);
  588. SetTrieValue(gameme_plugin[blocked_commands], "target", 1);
  589. SetTrieValue(gameme_plugin[blocked_commands], "/target", 1);
  590. SetTrieValue(gameme_plugin[blocked_commands], "!target", 1);
  591. SetTrieValue(gameme_plugin[blocked_commands], "kills", 1);
  592. SetTrieValue(gameme_plugin[blocked_commands], "/kills", 1);
  593. SetTrieValue(gameme_plugin[blocked_commands], "!kills", 1);
  594. SetTrieValue(gameme_plugin[blocked_commands], "kill", 1);
  595. SetTrieValue(gameme_plugin[blocked_commands], "/kill", 1);
  596. SetTrieValue(gameme_plugin[blocked_commands], "!kill", 1);
  597. SetTrieValue(gameme_plugin[blocked_commands], "player_kills", 1);
  598. SetTrieValue(gameme_plugin[blocked_commands], "/player_kills", 1);
  599. SetTrieValue(gameme_plugin[blocked_commands], "!player_kills", 1);
  600. SetTrieValue(gameme_plugin[blocked_commands], "cmds", 1);
  601. SetTrieValue(gameme_plugin[blocked_commands], "/cmds", 1);
  602. SetTrieValue(gameme_plugin[blocked_commands], "!cmds", 1);
  603. SetTrieValue(gameme_plugin[blocked_commands], "commands", 1);
  604. SetTrieValue(gameme_plugin[blocked_commands], "/commands", 1);
  605. SetTrieValue(gameme_plugin[blocked_commands], "!commands", 1);
  606. SetTrieValue(gameme_plugin[blocked_commands], "gameme_display 0", 1);
  607. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_display 0", 1);
  608. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_display 0", 1);
  609. SetTrieValue(gameme_plugin[blocked_commands], "gameme_display 1", 1);
  610. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_display 1", 1);
  611. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_display 1", 1);
  612. SetTrieValue(gameme_plugin[blocked_commands], "gameme_atb 0", 1);
  613. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_atb 0", 1);
  614. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_atb 0", 1);
  615. SetTrieValue(gameme_plugin[blocked_commands], "gameme_atb 1", 1);
  616. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_atb 1", 1);
  617. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_atb 1", 1);
  618. SetTrieValue(gameme_plugin[blocked_commands], "gameme_hideranking", 1);
  619. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_hideranking", 1);
  620. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_hideranking", 1);
  621. SetTrieValue(gameme_plugin[blocked_commands], "gameme_reset", 1);
  622. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_reset", 1);
  623. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_reset", 1);
  624. SetTrieValue(gameme_plugin[blocked_commands], "gameme_chat 0", 1);
  625. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_chat 0", 1);
  626. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_chat 0", 1);
  627. SetTrieValue(gameme_plugin[blocked_commands], "gameme_chat 1", 1);
  628. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_chat 1", 1);
  629. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_chat 1", 1);
  630. SetTrieValue(gameme_plugin[blocked_commands], "gstats", 1);
  631. SetTrieValue(gameme_plugin[blocked_commands], "/gstats", 1);
  632. SetTrieValue(gameme_plugin[blocked_commands], "!gstats", 1);
  633. SetTrieValue(gameme_plugin[blocked_commands], "global_stats", 1);
  634. SetTrieValue(gameme_plugin[blocked_commands], "/global_stats", 1);
  635. SetTrieValue(gameme_plugin[blocked_commands], "!global_stats", 1);
  636. SetTrieValue(gameme_plugin[blocked_commands], "gameme", 1);
  637. SetTrieValue(gameme_plugin[blocked_commands], "/gameme", 1);
  638. SetTrieValue(gameme_plugin[blocked_commands], "!gameme", 1);
  639. SetTrieValue(gameme_plugin[blocked_commands], "gameme_menu", 1);
  640. SetTrieValue(gameme_plugin[blocked_commands], "/gameme_menu", 1);
  641. SetTrieValue(gameme_plugin[blocked_commands], "!gameme_menu", 1);
  642.  
  643. CreateConVar("gameme_plugin_version", GAMEME_PLUGIN_VERSION, "gameME Plugin", FCVAR_NOTIFY);
  644. CreateConVar("gameme_webpage", "http://www.gameme.com", "http://www.gameme.com", FCVAR_NOTIFY);
  645. gameme_plugin[block_chat_commands] = CreateConVar("gameme_block_commands", "1", "If activated gameME commands are blocked from the chat area");
  646. gameme_plugin[block_chat_commands_values] = CreateConVar("gameme_block_commands_values", "", "Define which commands should be blocked from the chat area");
  647. HookConVarChange(gameme_plugin[block_chat_commands_values], OnBlockChatCommandsValuesChange);
  648. gameme_plugin[message_prefix] = CreateConVar("gameme_message_prefix", "", "Define the prefix displayed on every gameME ingame message");
  649. HookConVarChange(gameme_plugin[message_prefix], OnMessagePrefixChange);
  650. gameme_plugin[protect_address] = CreateConVar("gameme_protect_address", "", "Address to be protected for logging/forwarding");
  651. HookConVarChange(gameme_plugin[protect_address], OnProtectAddressChange);
  652. gameme_plugin[enable_log_locations] = CreateConVar("gameme_log_locations", "1", "If activated the gameserver logs players locations");
  653. HookConVarChange(gameme_plugin[enable_log_locations], OnLogLocationsChange);
  654. gameme_plugin[display_spectatorinfo] = CreateConVar("gameme_display_spectatorinfo", "0", "If activated gameME Stats data are displayed while spectating a player");
  655. HookConVarChange(gameme_plugin[display_spectatorinfo], OnDisplaySpectatorinfoChange);
  656. gameme_plugin[enable_damage_display] = CreateConVar("gameme_damage_display", "0", "If activated the damage summary is display on player_death (1 = menu, 2 = chat)");
  657. HookConVarChange(gameme_plugin[enable_damage_display], OnDamageDisplayChange);
  658. gameme_plugin[enable_gameme_live] = CreateConVar("gameme_live", "0", "If activated gameME Live! is enabled");
  659. HookConVarChange(gameme_plugin[enable_gameme_live], OngameMELiveChange);
  660. gameme_plugin[gameme_live_address] = CreateConVar("gameme_live_address", "", "Network address of gameME Live!");
  661. HookConVarChange(gameme_plugin[gameme_live_address], OnLiveAddressChange);
  662.  
  663. get_server_mod();
  664. if (gameme_plugin[mod_id] == MOD_CSGO) {
  665. if (GetUserMessageType() == UM_Protobuf) {
  666. gameme_plugin[protobuf] = 1;
  667. LogToGame("gameME Protobuf user messages detected");
  668. }
  669. }
  670.  
  671. CreateGameMEMenuMain(gameme_plugin[menu_main]);
  672. CreateGameMEMenuAuto(gameme_plugin[menu_auto]);
  673. CreateGameMEMenuEvents(gameme_plugin[menu_events]);
  674.  
  675. RegServerCmd("gameme_raw_message", gameme_raw_message);
  676. RegServerCmd("gameme_psay", gameme_psay);
  677. RegServerCmd("gameme_csay", gameme_csay);
  678. RegServerCmd("gameme_msay", gameme_msay);
  679. RegServerCmd("gameme_tsay", gameme_tsay);
  680. RegServerCmd("gameme_hint", gameme_hint);
  681. RegServerCmd("gameme_khint", gameme_khint);
  682. RegServerCmd("gameme_browse", gameme_browse);
  683. RegServerCmd("gameme_swap", gameme_swap);
  684. RegServerCmd("gameme_redirect", gameme_redirect);
  685. RegServerCmd("gameme_player_action", gameme_player_action);
  686. RegServerCmd("gameme_team_action", gameme_team_action);
  687. RegServerCmd("gameme_world_action", gameme_world_action);
  688.  
  689. RegConsoleCmd("say", gameme_block_commands);
  690. RegConsoleCmd("say_team", gameme_block_commands);
  691.  
  692. if (gameme_plugin[mod_id] == MOD_INSMOD) {
  693. RegConsoleCmd("say2", gameme_block_commands);
  694. }
  695.  
  696. RegServerCmd("log", ProtectLoggingChange);
  697. RegServerCmd("logaddress_del", ProtectForwardingChange);
  698. RegServerCmd("logaddress_delall", ProtectForwardingDelallChange);
  699. RegServerCmd("gameme_message_prefix_clear", MessagePrefixClear);
  700.  
  701. gameme_plugin[custom_tags] = CreateArray(128);
  702. gameme_plugin[sv_tags] = FindConVar("sv_tags");
  703. gameme_plugin[engine_version] = GetEngineVersion();
  704. if (gameme_plugin[sv_tags] != INVALID_HANDLE) {
  705. AddPluginServerTag(GAMEME_TAG);
  706. HookConVarChange(gameme_plugin[sv_tags], OnTagsChange);
  707. }
  708.  
  709.  
  710. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_HL2MP) || (gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) || (gameme_plugin[mod_id] == MOD_INSMOD)) {
  711. HookEvent("player_team", gameME_Event_PlyTeamChange, EventHookMode_Pre);
  712. }
  713.  
  714. switch (gameme_plugin[mod_id]) {
  715. case MOD_L4DII: {
  716. l4dii_data[active_weapon_offset] = FindSendPropInfo("CTerrorPlayer", "m_hActiveWeapon");
  717. }
  718. case MOD_HL2MP: {
  719. hl2mp_data[crossbow_owner_offset] = FindSendPropInfo("CCrossbowBolt", "m_hOwnerEntity");
  720. hl2mp_data[teamplay] = FindConVar("mp_teamplay");
  721. if (hl2mp_data[teamplay] != INVALID_HANDLE) {
  722. hl2mp_data[teamplay_enabled] = GetConVarBool(hl2mp_data[teamplay]);
  723. HookConVarChange(hl2mp_data[teamplay], OnTeamPlayChange);
  724. }
  725. hl2mp_data[boltchecks] = CreateStack();
  726. }
  727. case MOD_TF2: {
  728. tf2_data[critical_hits] = FindConVar("tf_weapon_criticals");
  729. HookConVarChange(tf2_data[critical_hits], OnTF2CriticalHitsChange);
  730.  
  731. tf2_data[stun_balls] = CreateStack();
  732. tf2_data[wearables] = CreateStack();
  733. tf2_data[items_kv] = CreateKeyValues("items_game");
  734. if (FileToKeyValues(tf2_data[items_kv], "scripts/items/items_game.txt")) {
  735. KvJumpToKey(tf2_data[items_kv], "items");
  736. }
  737. tf2_data[slots_trie] = CreateTrie();
  738. SetTrieValue(tf2_data[slots_trie], "primary", 0);
  739. SetTrieValue(tf2_data[slots_trie], "secondary", 1);
  740. SetTrieValue(tf2_data[slots_trie], "melee", 2);
  741. SetTrieValue(tf2_data[slots_trie], "pda", 3);
  742. SetTrieValue(tf2_data[slots_trie], "pda2", 4);
  743. SetTrieValue(tf2_data[slots_trie], "building", 5);
  744. SetTrieValue(tf2_data[slots_trie], "head", 6);
  745. SetTrieValue(tf2_data[slots_trie], "misc", 7);
  746.  
  747. for (new i = 0; (i <= MAXPLAYERS); i++) {
  748. tf2_players[i][object_list] = CreateStack();
  749. tf2_players[i][carry_object] = false;
  750. tf2_players[i][jump_status] = 0;
  751. }
  752.  
  753. init_tf2_weapon_trie();
  754. AddGameLogHook(OnTF2GameLog);
  755. }
  756. }
  757.  
  758.  
  759. GetConVarString(gameme_plugin[message_prefix], gameme_plugin[message_prefix_value], 32);
  760. color_gameme_entities(gameme_plugin[message_prefix_value]);
  761.  
  762. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  763. decl String: protect_address_cvar_value[32];
  764. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 32);
  765. if (strcmp(protect_address_cvar_value, "") != 0) {
  766. decl String: ProtectSplitArray[2][16];
  767. new protect_split_count = ExplodeString(protect_address_cvar_value, ":", ProtectSplitArray, 2, 16);
  768. if (protect_split_count == 2) {
  769. strcopy(gameme_plugin[protect_address_value], 32, ProtectSplitArray[0]);
  770. gameme_plugin[protect_address_port] = StringToInt(ProtectSplitArray[1]);
  771. }
  772. }
  773. }
  774.  
  775.  
  776. if (gameme_plugin[gameme_live_address] != INVALID_HANDLE) {
  777. decl String: gameme_live_address_cvar_value[32];
  778. GetConVarString(gameme_plugin[gameme_live_address], gameme_live_address_cvar_value, 32);
  779. if (strcmp(gameme_live_address_cvar_value, "") != 0) {
  780. decl String: LiveSplitArray[2][16];
  781. new live_split_count = ExplodeString(gameme_live_address_cvar_value, ":", LiveSplitArray, 2, 16);
  782. if (live_split_count == 2) {
  783. strcopy(gameme_plugin[gameme_live_address_value], 32, LiveSplitArray[0]);
  784. gameme_plugin[gameme_live_address_port] = StringToInt(LiveSplitArray[1]);
  785. }
  786. }
  787. }
  788.  
  789. new Handle: server_hostport = FindConVar("hostport");
  790. if (server_hostport != INVALID_HANDLE) {
  791. decl String: temp_port[16];
  792. GetConVarString(server_hostport, temp_port, 16);
  793. gameme_plugin[server_port] = StringToInt(temp_port);
  794. }
  795.  
  796. gameme_plugin[player_color_array] = CreateArray();
  797. gameme_plugin[message_recipients] = CreateStack();
  798. QueryCallbackArray = CreateArray(CALLBACK_DATA_SIZE);
  799.  
  800. gameMEStatsRankForward = CreateGlobalForward("onGameMEStatsRank", ET_Event, Param_Cell, Param_Cell, Param_String, Param_Array, Param_Array, Param_Array, Param_Array, Param_String, Param_Array, Param_Array, Param_String);
  801. gameMEStatsPublicCommandForward = CreateGlobalForward("onGameMEStatsPublicCommand", ET_Event, Param_Cell, Param_Cell, Param_String, Param_Array, Param_Array, Param_Array, Param_Array, Param_String, Param_Array, Param_Array, Param_String);
  802. gameMEStatsTop10Forward = CreateGlobalForward("onGameMEStatsTop10", ET_Event, Param_Cell, Param_Cell, Param_String, Param_Array, Param_Array, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String);
  803. gameMEStatsNextForward = CreateGlobalForward("onGameMEStatsNext", ET_Event, Param_Cell, Param_Cell, Param_String, Param_Array, Param_Array, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String, Param_String);
  804.  
  805. }
  806.  
  807.  
  808. public OnPluginEnd()
  809. {
  810. if (gameme_plugin[player_color_array] != INVALID_HANDLE) {
  811. CloseHandle(gameme_plugin[player_color_array]);
  812. }
  813. if (gameme_plugin[message_recipients] != INVALID_HANDLE) {
  814. CloseHandle(gameme_plugin[message_recipients]);
  815. }
  816. if (QueryCallbackArray != INVALID_HANDLE) {
  817. CloseHandle(QueryCallbackArray);
  818. }
  819. if (gameme_plugin[blocked_commands] != INVALID_HANDLE) {
  820. CloseHandle(gameme_plugin[blocked_commands]);
  821. }
  822.  
  823. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) {
  824. for (new i = 1; (i <= MaxClients); i++) {
  825. if (gameme_players[i][pspectator][stimer] != INVALID_HANDLE) {
  826. KillTimer(gameme_players[i][pspectator][stimer]);
  827. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  828. }
  829. }
  830. }
  831. }
  832.  
  833.  
  834. public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
  835. {
  836. RegPluginLibrary("gameme");
  837.  
  838. CreateNative("DisplayGameMEStatsMenu", native_display_menu);
  839. CreateNative("QueryGameMEStats", native_query_gameme_stats);
  840. CreateNative("QueryGameMEStatsTop10", native_query_gameme_stats);
  841. CreateNative("QueryGameMEStatsNext", native_query_gameme_stats);
  842. CreateNative("QueryIntGameMEStats", native_query_gameme_stats);
  843. CreateNative("gameMEStatsColorEntities", native_color_gameme_entities);
  844.  
  845. MarkNativeAsOptional("CS_SwitchTeam");
  846. MarkNativeAsOptional("CS_RespawnPlayer");
  847. MarkNativeAsOptional("SetCookieMenuItem");
  848. MarkNativeAsOptional("SDKHook");
  849. MarkNativeAsOptional("SocketCreate");
  850. MarkNativeAsOptional("SocketSendTo");
  851.  
  852. MarkNativeAsOptional("GetUserMessageType");
  853. MarkNativeAsOptional("PbSetInt");
  854. MarkNativeAsOptional("PbSetBool");
  855. MarkNativeAsOptional("PbSetString");
  856. MarkNativeAsOptional("PbAddString");
  857.  
  858. #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 3
  859. return APLRes_Success;
  860. #else
  861. return true;
  862. #endif
  863. }
  864.  
  865.  
  866. public OnAllPluginsLoaded()
  867. {
  868. if (LibraryExists("clientprefs")) {
  869. SetCookieMenuItem(gameMESettingsMenu, 0, "gameME Settings");
  870. }
  871.  
  872. if (LibraryExists("sdkhooks")) {
  873. LogToGame("gameME Extension SDK Hooks is available");
  874. gameme_plugin[sdkhook_available] = true;
  875. }
  876.  
  877.  
  878. if ((gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_CSGO)) {
  879. if ((strcmp(gameme_plugin[gameme_live_address_value], "") != 0) &&
  880. (strcmp(gameme_plugin[gameme_live_address_port], "") != 0)) {
  881. new enable_gameme_live_cvar = GetConVarInt(gameme_plugin[enable_gameme_live]);
  882. if (enable_gameme_live_cvar == 1) {
  883. gameme_plugin[live_active] = 1;
  884. start_gameme_live();
  885. LogToGame("gameME Live! activated");
  886. } else if (enable_gameme_live_cvar == 0) {
  887. gameme_plugin[live_active] = 0;
  888. LogToGame("gameME Live! not active");
  889. }
  890. } else {
  891. gameme_plugin[live_active] = 0;
  892. LogToGame("gameME Live! cannot be activated, no gameME Live! address assigned");
  893. }
  894. }
  895.  
  896.  
  897. for (new i = 1; i <= MaxClients; i++) {
  898. if (IsClientInGame(i)) {
  899. if (gameme_plugin[sdkhook_available]) {
  900. switch (gameme_plugin[mod_id]) {
  901. case MOD_HL2MP: {
  902. SDKHook(i, SDKHook_FireBulletsPost, OnHL2MPFireBullets);
  903. SDKHook(i, SDKHook_TraceAttackPost, OnHL2MPTraceAttack);
  904. SDKHook(i, SDKHook_OnTakeDamagePost, OnHL2MPTakeDamage);
  905. }
  906. case MOD_ZPS: {
  907. SDKHook(i, SDKHook_FireBulletsPost, OnZPSFireBullets);
  908. SDKHook(i, SDKHook_TraceAttackPost, OnZPSTraceAttack);
  909. SDKHook(i, SDKHook_OnTakeDamagePost, OnZPSTakeDamage);
  910. }
  911. case MOD_TF2: {
  912. SDKHook(i, SDKHook_OnTakeDamagePost, OnTF2TakeDamage_Post);
  913. SDKHook(i, SDKHook_OnTakeDamage, OnTF2TakeDamage);
  914.  
  915. tf2_players[i][player_loadout_updated] = true;
  916. tf2_players[i][carry_object] = false;
  917. tf2_players[i][object_removed] = 0.0;
  918. tf2_players[i][player_class] = TFClass_Unknown;
  919.  
  920. for (new j = 0; j < TF2_MAX_LOADOUT_SLOTS; j++) {
  921. tf2_players[i][player_loadout0][j] = -1;
  922. tf2_players[i][player_loadout1][j] = -1;
  923. }
  924.  
  925. }
  926. }
  927. }
  928.  
  929. if (!IsFakeClient(i)) {
  930. QueryClientConVar(i, "cl_language", ConVarQueryFinished: ClientConVar, i);
  931. if ((gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_DODS) || (gameme_plugin[mod_id] == MOD_HL2MP)) {
  932. QueryClientConVar(i, "cl_connectmethod", ConVarQueryFinished: ClientConVar, i);
  933. }
  934. }
  935.  
  936. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) {
  937. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  938. for (new j = 0; (j <= MAXPLAYERS); j++) {
  939. player_messages[j][i][supdated] = 1;
  940. strcopy(player_messages[j][i][smessage], 255, "");
  941. }
  942. }
  943. }
  944. }
  945. }
  946.  
  947.  
  948. public gameMESettingsMenu(client, CookieMenuAction: action, any:info, String:buffer[], maxlen)
  949. {
  950. if (action == CookieMenuAction_SelectOption) {
  951. DisplayMenu(gameme_plugin[menu_main], client, MENU_TIME_FOREVER);
  952. }
  953. }
  954.  
  955.  
  956. public OnMapStart()
  957. {
  958.  
  959. get_server_mod();
  960.  
  961. for (new i = 0; (i <= MAXPLAYERS); i++) {
  962. reset_player_data(i);
  963. gameme_players[i][prole] = -1;
  964. gameme_players[i][pgglevel] = 0;
  965. }
  966.  
  967. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_DODS) || (gameme_plugin[mod_id] == MOD_HL2MP) ||
  968. (gameme_plugin[mod_id] == MOD_INSMOD) || (gameme_plugin[mod_id] == MOD_FF) || (gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) ||
  969. (gameme_plugin[mod_id] == MOD_CSP)) {
  970.  
  971. decl String: map_name[64];
  972. GetCurrentMap(map_name, 64);
  973.  
  974. new max_teams_count = GetTeamCount();
  975. for (new team_index = 0; (team_index < max_teams_count); team_index++) {
  976. decl String: team_name[32];
  977. GetTeamName(team_index, team_name, 32);
  978.  
  979. if (strcmp(team_name, "") != 0) {
  980. team_list[team_index] = team_name;
  981. }
  982. }
  983. }
  984.  
  985. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_HL2MP) || (gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) || (gameme_plugin[mod_id] == MOD_INSMOD)) {
  986. find_player_team_slot(2);
  987. find_player_team_slot(3);
  988. }
  989.  
  990. ClearArray(QueryCallbackArray);
  991. }
  992.  
  993.  
  994. get_server_mod()
  995. {
  996. if (strcmp(gameme_plugin[game_mod], "") == 0) {
  997. new String: game_description[64];
  998. GetGameDescription(game_description, 64, true);
  999.  
  1000. if (StrContains(game_description, "Counter-Strike", false) != -1) {
  1001. strcopy(gameme_plugin[game_mod], 32, "CSS");
  1002. gameme_plugin[mod_id] = MOD_CSS;
  1003. }
  1004. if (StrContains(game_description, "Counter-Strike: Global Offensive", false) != -1) {
  1005. strcopy(gameme_plugin[game_mod], 32, "CSGO");
  1006. gameme_plugin[mod_id] = MOD_CSGO;
  1007. }
  1008. if (StrContains(game_description, "Day of Defeat", false) != -1) {
  1009. strcopy(gameme_plugin[game_mod], 32, "DODS");
  1010. gameme_plugin[mod_id] = MOD_DODS;
  1011. }
  1012. if (StrContains(game_description, "Half-Life 2 Deathmatch", false) != -1) {
  1013. strcopy(gameme_plugin[game_mod], 32, "HL2MP");
  1014. gameme_plugin[mod_id] = MOD_HL2MP;
  1015. }
  1016. if (StrContains(game_description, "Team Fortress", false) != -1) {
  1017. strcopy(gameme_plugin[game_mod], 32, "TF2");
  1018. gameme_plugin[mod_id] = MOD_TF2;
  1019. }
  1020. if (StrContains(game_description, "Insurgency", false) != -1) {
  1021. strcopy(gameme_plugin[game_mod], 32, "INSMOD");
  1022. gameme_plugin[mod_id] = MOD_INSMOD;
  1023. }
  1024. if (StrContains(game_description, "L4D", false) != -1) {
  1025. strcopy(gameme_plugin[game_mod], 32, "L4D");
  1026. gameme_plugin[mod_id] = MOD_L4D;
  1027. }
  1028. if (StrContains(game_description, "Left 4 Dead 2", false) != -1) {
  1029. strcopy(gameme_plugin[game_mod], 32, "L4DII");
  1030. gameme_plugin[mod_id] = MOD_L4DII;
  1031. }
  1032. if (StrContains(game_description, "Fortress Forever", false) != -1) {
  1033. strcopy(gameme_plugin[game_mod], 32, "FF");
  1034. gameme_plugin[mod_id] = MOD_FF;
  1035. }
  1036. if (StrContains(game_description, "CSPromod", false) != -1) {
  1037. strcopy(gameme_plugin[game_mod], 32, "CSP");
  1038. gameme_plugin[mod_id] = MOD_CSP;
  1039. }
  1040. if (StrContains(game_description, "ZPS", false) != -1) {
  1041. strcopy(gameme_plugin[game_mod], 32, "ZPS");
  1042. gameme_plugin[mod_id] = MOD_ZPS;
  1043. }
  1044.  
  1045. // game mod could not detected, try further
  1046. if (strcmp(gameme_plugin[game_mod], "") == 0) {
  1047. new String: game_folder[64];
  1048. GetGameFolderName(game_folder, 64);
  1049.  
  1050. if (StrContains(game_folder, "cstrike", false) != -1) {
  1051. strcopy(gameme_plugin[game_mod], 32, "CSS");
  1052. gameme_plugin[mod_id] = MOD_CSS;
  1053. }
  1054. if (StrContains(game_folder, "csgo", false) != -1) {
  1055. strcopy(gameme_plugin[game_mod], 32, "CSGO");
  1056. gameme_plugin[mod_id] = MOD_CSGO;
  1057. }
  1058. if (StrContains(game_folder, "dod", false) != -1) {
  1059. strcopy(gameme_plugin[game_mod], 32, "DODS");
  1060. gameme_plugin[mod_id] = MOD_DODS;
  1061. }
  1062. if (StrContains(game_folder, "hl2mp", false) != -1) {
  1063. strcopy(gameme_plugin[game_mod], 32, "HL2MP");
  1064. gameme_plugin[mod_id] = MOD_HL2MP;
  1065. }
  1066. if (StrContains(game_folder, "tf", false) != -1) {
  1067. strcopy(gameme_plugin[game_mod], 32, "TF2");
  1068. gameme_plugin[mod_id] = MOD_TF2;
  1069. }
  1070. if (StrContains(game_folder, "insurgency", false) != -1) {
  1071. strcopy(gameme_plugin[game_mod], 32, "INSMOD");
  1072. gameme_plugin[mod_id] = MOD_INSMOD;
  1073. }
  1074. if (StrContains(game_folder, "left4dead", false) != -1) {
  1075. strcopy(gameme_plugin[game_mod], 32, "L4D");
  1076. gameme_plugin[mod_id] = MOD_L4D;
  1077. }
  1078. if (StrContains(game_folder, "left4dead2", false) != -1) {
  1079. strcopy(gameme_plugin[game_mod], 32, "L4DII");
  1080. gameme_plugin[mod_id] = MOD_L4DII;
  1081. }
  1082. if (StrContains(game_folder, "FortressForever", false) != -1) {
  1083. strcopy(gameme_plugin[game_mod], 32, "FF");
  1084. gameme_plugin[mod_id] = MOD_FF;
  1085. }
  1086. if (StrContains(game_folder, "cspromod", false) != -1) {
  1087. strcopy(gameme_plugin[game_mod], 32, "CSP");
  1088. gameme_plugin[mod_id] = MOD_CSP;
  1089. }
  1090. if (StrContains(game_folder, "zps", false) != -1) {
  1091. strcopy(gameme_plugin[game_mod], 32, "ZPS");
  1092. gameme_plugin[mod_id] = MOD_ZPS;
  1093. }
  1094. if (strcmp(gameme_plugin[game_mod], "") == 0) {
  1095. LogToGame("gameME Game Detection: Failed (%s, %s)", game_description, game_folder);
  1096. }
  1097. }
  1098.  
  1099. // setup hooks
  1100. switch (gameme_plugin[mod_id]) {
  1101. case MOD_CSGO: {
  1102. HookEvent("weapon_fire", Event_CSGOPlayerFire);
  1103. HookEvent("weapon_fire_on_empty", Event_CSGOPlayerFire);
  1104. HookEvent("player_hurt", Event_CSGOPlayerHurt);
  1105. HookEvent("player_death", Event_CSGOPlayerDeath);
  1106. HookEvent("player_spawn", Event_CSGOPlayerSpawn);
  1107. HookEvent("round_start", Event_CSGORoundStart);
  1108. HookEvent("round_end", Event_CSGORoundEnd);
  1109. HookEvent("round_announce_warmup", Event_CSGOAnnounceWarmup);
  1110. HookEvent("round_announce_match_start", Event_CSGOAnnounceMatchStart);
  1111. HookEvent("gg_player_levelup", Event_CSGOGGLevelUp);
  1112. HookEvent("ggtr_player_levelup", Event_CSGOGGLevelUp);
  1113. HookEvent("ggprogressive_player_levelup", Event_CSGOGGLevelUp);
  1114. HookEvent("gg_final_weapon_achieved", Event_CSGOGGWin);
  1115. HookEvent("gg_leader", Event_CSGOGGLeader);
  1116. HookEvent("round_mvp", Event_RoundMVP);
  1117.  
  1118. HookEvent("bomb_dropped", gameME_Event_PlyBombDropped, EventHookMode_Pre);
  1119. HookEvent("player_given_c4", gameME_Event_PlyBombPickup, EventHookMode_Pre);
  1120. HookEvent("bomb_planted", gameME_Event_PlyBombPlanted, EventHookMode_Pre);
  1121. HookEvent("bomb_defused", gameME_Event_PlyBombDefused, EventHookMode_Pre);
  1122. HookEvent("hostage_killed", gameME_Event_PlyHostageKill, EventHookMode_Pre);
  1123. HookEvent("hostage_rescued", gameME_Event_PlyHostageResc, EventHookMode_Pre);
  1124.  
  1125. }
  1126. case MOD_CSS: {
  1127. HookEvent("weapon_fire", Event_CSSPlayerFire);
  1128. HookEvent("player_hurt", Event_CSSPlayerHurt);
  1129. HookEvent("player_death", Event_CSSPlayerDeath);
  1130. HookEvent("player_spawn", Event_CSSPlayerSpawn);
  1131. HookEvent("round_start", Event_CSSRoundStart);
  1132. HookEvent("round_end", Event_CSSRoundEnd);
  1133. HookEvent("round_mvp", Event_RoundMVP);
  1134.  
  1135. HookEvent("bomb_dropped", gameME_Event_PlyBombDropped, EventHookMode_Pre);
  1136. HookEvent("bomb_pickup", gameME_Event_PlyBombPickup, EventHookMode_Pre);
  1137. HookEvent("bomb_planted", gameME_Event_PlyBombPlanted, EventHookMode_Pre);
  1138. HookEvent("bomb_defused", gameME_Event_PlyBombDefused, EventHookMode_Pre);
  1139. HookEvent("hostage_killed", gameME_Event_PlyHostageKill, EventHookMode_Pre);
  1140. HookEvent("hostage_rescued", gameME_Event_PlyHostageResc, EventHookMode_Pre);
  1141. }
  1142. case MOD_DODS: {
  1143. HookEvent("dod_stats_weapon_attack", Event_DODSWeaponAttack);
  1144. HookEvent("player_hurt", Event_DODSPlayerHurt);
  1145. HookEvent("player_death", Event_DODSPlayerDeath);
  1146. HookEvent("round_end", Event_DODSRoundEnd);
  1147. }
  1148. case MOD_TF2: {
  1149. HookEvent("player_death", Event_TF2PlayerDeath);
  1150.  
  1151. HookEvent("object_destroyed", Event_TF2ObjectDestroyedPre, EventHookMode_Pre);
  1152. HookEvent("player_builtobject", Event_TF2PlayerBuiltObjectPre, EventHookMode_Pre);
  1153. HookEvent("player_spawn", Event_TF2PlayerSpawn);
  1154. HookEvent("round_start", Event_TF2RoundStart);
  1155. HookEvent("round_end", Event_TF2RoundEnd);
  1156. HookEvent("object_removed", Event_TF2ObjectRemoved);
  1157. HookEvent("post_inventory_application", Event_TF2PostInvApp);
  1158. HookEvent("teamplay_win_panel", Event_TF2WinPanel);
  1159. HookEvent("arena_win_panel", Event_TF2WinPanel);
  1160. HookEvent("player_teleported", Event_TF2PlayerTeleported);
  1161.  
  1162. HookEvent("rocket_jump", Event_TF2RocketJump);
  1163. HookEvent("rocket_jump_landed", Event_TF2JumpLanded);
  1164. HookEvent("sticky_jump", Event_TF2StickyJump);
  1165. HookEvent("sticky_jump_landed", Event_TF2JumpLanded);
  1166. HookEvent("object_deflected", Event_TF2ObjectDeflected);
  1167.  
  1168. HookEvent("player_stealsandvich", Event_TF2StealSandvich);
  1169. HookEvent("player_stunned", Event_TF2Stunned);
  1170. HookEvent("player_escort_score", Event_TF2EscortScore);
  1171. HookEvent("deploy_buff_banner", Event_TF2DeployBuffBanner);
  1172. HookEvent("medic_defended", Event_TF2MedicDefended);
  1173.  
  1174. HookUserMessage(GetUserMessageId("PlayerJarated"), Event_TF2Jarated);
  1175. HookUserMessage(GetUserMessageId("PlayerShieldBlocked"), Event_TF2ShieldBlocked);
  1176.  
  1177. AddNormalSoundHook(NormalSHook: Event_TF2SoundHook);
  1178.  
  1179. tf2_data[carry_offset] = FindSendPropInfo("CTFPlayer", "m_bCarryingObject");
  1180. }
  1181. case MOD_L4D, MOD_L4DII: {
  1182. HookEvent("weapon_fire", Event_L4DPlayerFire);
  1183. HookEvent("weapon_fire_on_empty", Event_L4DPlayerFire);
  1184. HookEvent("player_hurt", Event_L4DPlayerHurt);
  1185. HookEvent("infected_hurt", Event_L4DInfectedHurt);
  1186. HookEvent("player_death", Event_L4DPlayerDeath);
  1187. HookEvent("player_spawn", Event_L4DPlayerSpawn);
  1188. HookEvent("round_end_message", Event_L4DRoundEnd, EventHookMode_PostNoCopy);
  1189.  
  1190. HookEvent("survivor_rescued", Event_L4DRescueSurvivor);
  1191. HookEvent("heal_success", Event_L4DHeal);
  1192. HookEvent("revive_success", Event_L4DRevive);
  1193. HookEvent("witch_harasser_set", Event_L4DStartleWitch);
  1194. HookEvent("lunge_pounce", Event_L4DPounce);
  1195. HookEvent("player_now_it", Event_L4DBoomered);
  1196. HookEvent("friendly_fire", Event_L4DFF);
  1197. HookEvent("witch_killed", Event_L4DWitchKilled);
  1198. HookEvent("award_earned", Event_L4DAward);
  1199.  
  1200. if (gameme_plugin[mod_id] == MOD_L4DII) {
  1201. HookEvent("defibrillator_used", Event_L4DDefib);
  1202. HookEvent("adrenaline_used", Event_L4DAdrenaline);
  1203. HookEvent("upgrade_pack_used", Event_L4DUpgrade);
  1204. HookEvent("pills_used", Event_L4DPills);
  1205. HookEvent("jockey_ride", Event_L4DJockeyRide);
  1206. HookEvent("charger_pummel_start", Event_L4DChargerPummelStart);
  1207. HookEvent("vomit_bomb_tank", Event_L4DVomitBombTank);
  1208. HookEvent("scavenge_match_finished", Event_L4DScavengeEnd);
  1209. HookEvent("versus_match_finished", Event_L4DVersusEnd);
  1210. HookEvent("charger_killed", Event_L4dChargerKilled);
  1211. HookEvent("player_incapacitated", Event_L4DIncap);
  1212. HookEvent("melee_kill"), Event_L4DShove);
  1213. HookEvent("zombie_ignited"), Event_L4DInfIg);
  1214. HookEvent("item_pickup"), Event_L4DScav);
  1215. HookEvent("hunter_headshot"), Event_L4DHskeet);
  1216. HookEvent("break_breakable"), Event_L4DBreak);
  1217. HookEvent("triggered_car_alarm"), Event_L4DCarTrig);
  1218. }
  1219.  
  1220. }
  1221. case MOD_INSMOD: {
  1222. HookEvent("player_death", Event_INSMODPlayerDeath);
  1223. HookEvent("player_hurt", Event_INSMODPlayerHurt);
  1224. HookEvent("weapon_fire", Event_INSMODEventFired);
  1225. HookEvent("player_spawn", Event_INSMODPlayerSpawn);
  1226. HookEvent("player_pick_squad", Event_INSMODPlayerPickSquad);
  1227. HookEvent("round_end", Event_INSMODRoundEnd);
  1228. HookEvent("object_destroyed", Event_INSMODObjectiveDestroyed);
  1229. HookEvent("controlpoint_captured", Event_INSMODControlpointCapped);
  1230. }
  1231. case MOD_HL2MP: {
  1232. HookEvent("player_death", Event_HL2MPPlayerDeath);
  1233. HookEvent("player_spawn", Event_HL2MPPlayerSpawn);
  1234. HookEvent("round_end", Event_HL2MPRoundEnd, EventHookMode_PostNoCopy);
  1235. }
  1236. case MOD_ZPS: {
  1237. HookEvent("player_death", Event_ZPSPlayerDeath);
  1238. HookEvent("player_spawn", Event_ZPSPlayerSpawn);
  1239. HookEvent("round_end", Event_ZPSRoundEnd, EventHookMode_PostNoCopy);
  1240. }
  1241. case MOD_CSP: {
  1242. HookEvent("round_start", Event_CSPRoundStart);
  1243. HookEvent("round_end", Event_CSPRoundEnd);
  1244. }
  1245. } // end switch
  1246.  
  1247. // generic death event hook
  1248. HookEvent("player_death", gameME_Event_PlyDeath, EventHookMode_Pre);
  1249.  
  1250. if ((gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) || (gameme_plugin[mod_id] == MOD_INSMOD)) {
  1251. // since almost no deaths occurs force the data to be logged at least every 180 seconds
  1252. CreateTimer(180.0, flush_weapon_logs, 0, TIMER_REPEAT);
  1253. }
  1254.  
  1255. // player location logging
  1256. if (gameme_plugin[enable_log_locations] != INVALID_HANDLE) {
  1257. new enable_log_locations_cvar = GetConVarInt(gameme_plugin[enable_log_locations]);
  1258. if (enable_log_locations_cvar == 1) {
  1259. gameme_plugin[log_locations] = 1;
  1260. LogToGame("gameME location logging activated");
  1261. } else if (enable_log_locations_cvar == 0) {
  1262. gameme_plugin[log_locations] = 0;
  1263. LogToGame("gameME location logging deactivated");
  1264. }
  1265. } else {
  1266. gameme_plugin[log_locations] = 0;
  1267. }
  1268.  
  1269. LogToGame("gameME Game Detection: %s [%s]", game_description, gameme_plugin[game_mod]);
  1270.  
  1271. }
  1272. }
  1273.  
  1274.  
  1275. public OnClientPutInServer(client)
  1276. {
  1277. if (client > 0) {
  1278. if (gameme_plugin[sdkhook_available]) {
  1279. switch (gameme_plugin[mod_id]) {
  1280. case MOD_HL2MP: {
  1281. SDKHook(client, SDKHook_FireBulletsPost, OnHL2MPFireBullets);
  1282. SDKHook(client, SDKHook_TraceAttackPost, OnHL2MPTraceAttack);
  1283. SDKHook(client, SDKHook_OnTakeDamagePost, OnHL2MPTakeDamage);
  1284. }
  1285. case MOD_ZPS: {
  1286. SDKHook(client, SDKHook_FireBulletsPost, OnZPSFireBullets);
  1287. SDKHook(client, SDKHook_TraceAttackPost, OnZPSTraceAttack);
  1288. SDKHook(client, SDKHook_OnTakeDamagePost, OnZPSTakeDamage);
  1289. }
  1290. case MOD_TF2: {
  1291. SDKHook(client, SDKHook_OnTakeDamagePost, OnTF2TakeDamage_Post);
  1292. SDKHook(client, SDKHook_OnTakeDamage, OnTF2TakeDamage);
  1293.  
  1294. tf2_players[client][player_loadout_updated] = true;
  1295. tf2_players[client][carry_object] = false;
  1296. tf2_players[client][object_removed] = 0.0;
  1297. tf2_players[client][player_class] = TFClass_Unknown;
  1298.  
  1299. for (new i = 0; (i < TF2_MAX_LOADOUT_SLOTS); i++) {
  1300. tf2_players[client][player_loadout0][i] = -1;
  1301. tf2_players[client][player_loadout1][i] = -1;
  1302. }
  1303. }
  1304. }
  1305. }
  1306.  
  1307. reset_player_data(client);
  1308. gameme_players[client][prole] = -1;
  1309. gameme_players[client][pgglevel] = 0;
  1310.  
  1311. if (!IsFakeClient(client)) {
  1312. QueryClientConVar(client, "cl_language", ConVarQueryFinished:ClientConVar, client);
  1313. if ((gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_DODS) || (gameme_plugin[mod_id] == MOD_HL2MP)) {
  1314. QueryClientConVar(client, "cl_connectmethod", ConVarQueryFinished: ClientConVar, client);
  1315. }
  1316. }
  1317.  
  1318. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) {
  1319. if (gameme_plugin[display_spectator] == 1) {
  1320. gameme_players[client][pspectator][stimer] = INVALID_HANDLE;
  1321. for (new j = 0; (j <= MAXPLAYERS); j++) {
  1322. player_messages[j][client][supdated] = 1;
  1323. strcopy(player_messages[j][client][smessage], 255, "");
  1324. }
  1325. }
  1326. }
  1327.  
  1328. }
  1329. }
  1330.  
  1331.  
  1332. public ClientConVar(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[]) {
  1333. if (IsClientConnected(client)) {
  1334. log_player_settings(client, "setup", cvarName, cvarValue);
  1335. }
  1336. }
  1337.  
  1338.  
  1339. start_gameme_live()
  1340. {
  1341. if ((gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_CSGO)) {
  1342. if (gameme_plugin[live_active] == 1) {
  1343. if (GetExtensionFileStatus("socket.ext") == 1) {
  1344. LogToGame("Extension Socket is available");
  1345. if (gameme_plugin[mod_id] == MOD_CSS) {
  1346. css_data[money_offset] = FindSendPropInfo("CCSPlayer", "m_iAccount");
  1347. }
  1348. gameme_plugin[live_socket] = SocketCreate(SOCKET_UDP, OnSocketError);
  1349.  
  1350. CreateTimer(gameme_plugin[live_interval], CollectData, 0, TIMER_REPEAT);
  1351. } else {
  1352. LogToGame("gameME Live! not activated, Socket extension not available");
  1353. }
  1354. }
  1355. } else {
  1356. LogToGame("gameME Live! not enabled, not supported yet");
  1357. gameme_plugin[live_active] = 0;
  1358. }
  1359.  
  1360. }
  1361.  
  1362.  
  1363. get_weapon_index(const String: weapon_list[][], weapon_list_count, const String: weapon_name[])
  1364. {
  1365. new loop_break = 0;
  1366. new index = 0;
  1367.  
  1368. while ((loop_break == 0) && (index < weapon_list_count)) {
  1369. if (strcmp(weapon_name, weapon_list[index], true) == 0) {
  1370. loop_break++;
  1371. } else {
  1372. index++;
  1373. }
  1374. }
  1375.  
  1376. if (loop_break == 0) {
  1377. return -1;
  1378. }
  1379. return index;
  1380. }
  1381.  
  1382.  
  1383. init_tf2_weapon_trie()
  1384. {
  1385.  
  1386. tf2_data[weapons_trie] = CreateTrie();
  1387. for (new i = 0; i < MAX_TF2_WEAPON_COUNT; i++) {
  1388. SetTrieValue(tf2_data[weapons_trie], tf2_weapon_list[i], i);
  1389. }
  1390.  
  1391. new index;
  1392. if(GetTrieValue(tf2_data[weapons_trie], "ball", index)) {
  1393. SetTrieValue(tf2_data[weapons_trie], "tf_projectile_stun_ball", index);
  1394. tf2_data[stun_ball_id] = index;
  1395. }
  1396. }
  1397.  
  1398.  
  1399. get_tf2_weapon_index(const String: weapon_name[], client = 0, weapon = -1)
  1400. {
  1401. new weapon_index = -1;
  1402. new bool: unlockable_weapon;
  1403. new reflect_index = -1;
  1404.  
  1405. if (strlen(weapon_name) < 15) {
  1406. return -1;
  1407. }
  1408.  
  1409. if(GetTrieValue(tf2_data[weapons_trie], weapon_name, weapon_index)) {
  1410. if (weapon_index & TF2_UNLOCKABLE_BIT) {
  1411. weapon_index &= ~TF2_UNLOCKABLE_BIT;
  1412. unlockable_weapon = true;
  1413. }
  1414.  
  1415. if ((weapon_name[3] == 'p') && (weapon > -1)) {
  1416. if (client == GetEntProp(weapon, Prop_Send, "m_iDeflected")) {
  1417. switch(weapon_name[14]) {
  1418. case 'a':
  1419. reflect_index = get_tf2_weapon_index("deflect_arrow");
  1420. case 'f':
  1421. reflect_index = get_tf2_weapon_index("deflect_flare");
  1422. case 'p': {
  1423. if (weapon_name[19] == 0) {
  1424. reflect_index = get_tf2_weapon_index("deflect_promode");
  1425. }
  1426. }
  1427. case 'r':
  1428. reflect_index = get_tf2_weapon_index("deflect_rocket");
  1429. }
  1430. }
  1431. }
  1432.  
  1433. if (reflect_index > -1) {
  1434. return reflect_index;
  1435. }
  1436.  
  1437. if ((unlockable_weapon) && (client > 0)) {
  1438. new slot = 0;
  1439. if (tf2_players[client][player_class] == TFClass_DemoMan) {
  1440. slot = 1;
  1441. }
  1442. new item_index = tf2_players[client][player_loadout0][slot];
  1443. switch (item_index) {
  1444. case 36, 41, 45, 61, 127, 130:
  1445. weapon_index++;
  1446. }
  1447. }
  1448. }
  1449. return weapon_index;
  1450. }
  1451.  
  1452.  
  1453.  
  1454. reset_player_data(player_index)
  1455. {
  1456. for (new i = 0; (i < MAX_LOG_WEAPONS); i++) {
  1457. player_weapons[player_index][i][wshots] = 0;
  1458. player_weapons[player_index][i][whits] = 0;
  1459. player_weapons[player_index][i][wkills] = 0;
  1460. player_weapons[player_index][i][wheadshots] = 0;
  1461. player_weapons[player_index][i][wteamkills] = 0;
  1462. player_weapons[player_index][i][wdamage] = 0;
  1463. player_weapons[player_index][i][wdeaths] = 0;
  1464. player_weapons[player_index][i][wgeneric] = 0;
  1465. player_weapons[player_index][i][whead] = 0;
  1466. player_weapons[player_index][i][wchest] = 0;
  1467. player_weapons[player_index][i][wstomach] = 0;
  1468. player_weapons[player_index][i][wleftarm] = 0;
  1469. player_weapons[player_index][i][wrightarm] = 0;
  1470. player_weapons[player_index][i][wleftleg] = 0;
  1471. player_weapons[player_index][i][wrightleg] = 0;
  1472.  
  1473. }
  1474.  
  1475.  
  1476. if (gameme_plugin[damage_display] == 1) {
  1477. for (new i = 1; (i <= MaxClients); i++) {
  1478. player_damage[player_index][i][dhits] = 0;
  1479. player_damage[player_index][i][dkills] = 0;
  1480. player_damage[player_index][i][dheadshots] = 0;
  1481. player_damage[player_index][i][ddamage] = 0;
  1482. player_damage[player_index][i][dkiller] = 0;
  1483. player_damage[player_index][i][dhpleft] = 0;
  1484. player_damage[player_index][i][dteamkill] = 0;
  1485. player_damage[player_index][i][dweapon] = 0;
  1486. }
  1487. }
  1488.  
  1489. if (gameme_plugin[live_active] == 1) {
  1490. gameme_players[player_index][parmor] = 0;
  1491. gameme_players[player_index][phealth] = 0;
  1492. gameme_players[player_index][ploc1] = 0;
  1493. gameme_players[player_index][ploc2] = 0;
  1494. gameme_players[player_index][ploc3] = 0;
  1495. gameme_players[player_index][pangle] = 0;
  1496. gameme_players[player_index][pmoney] = 0;
  1497. gameme_players[player_index][palive] = 0;
  1498. }
  1499.  
  1500. }
  1501.  
  1502.  
  1503. dump_player_data(player_index)
  1504. {
  1505. if (IsClientInGame(player_index)) {
  1506. new is_logged = 0;
  1507. for (new i = 0; (i < MAX_LOG_WEAPONS); i++) {
  1508. if (player_weapons[player_index][i][wshots] > 0) {
  1509. switch (gameme_plugin[mod_id]) {
  1510. case MOD_CSGO: {
  1511. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, csgo_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1512. if (player_weapons[player_index][i][whits] > 0) {
  1513. LogToGame("\"%L\" triggered \"weaponstats2\" (weapon \"%s\") (head \"%d\") (chest \"%d\") (stomach \"%d\") (leftarm \"%d\") (rightarm \"%d\") (leftleg \"%d\") (rightleg \"%d\")", player_index, csgo_weapon_list[i], player_weapons[player_index][i][whead], player_weapons[player_index][i][wchest], player_weapons[player_index][i][wstomach], player_weapons[player_index][i][wleftarm], player_weapons[player_index][i][wrightarm], player_weapons[player_index][i][wleftleg], player_weapons[player_index][i][wrightleg]);
  1514. }
  1515. }
  1516. case MOD_CSS: {
  1517. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, css_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1518. if (player_weapons[player_index][i][whits] > 0) {
  1519. LogToGame("\"%L\" triggered \"weaponstats2\" (weapon \"%s\") (head \"%d\") (chest \"%d\") (stomach \"%d\") (leftarm \"%d\") (rightarm \"%d\") (leftleg \"%d\") (rightleg \"%d\")", player_index, css_weapon_list[i], player_weapons[player_index][i][whead], player_weapons[player_index][i][wchest], player_weapons[player_index][i][wstomach], player_weapons[player_index][i][wleftarm], player_weapons[player_index][i][wrightarm], player_weapons[player_index][i][wleftleg], player_weapons[player_index][i][wrightleg]);
  1520. }
  1521. }
  1522. case MOD_DODS: {
  1523. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, dods_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1524. if (player_weapons[player_index][i][whits] > 0) {
  1525. LogToGame("\"%L\" triggered \"weaponstats2\" (weapon \"%s\") (head \"%d\") (chest \"%d\") (stomach \"%d\") (leftarm \"%d\") (rightarm \"%d\") (leftleg \"%d\") (rightleg \"%d\")", player_index, dods_weapon_list[i], player_weapons[player_index][i][whead], player_weapons[player_index][i][wchest], player_weapons[player_index][i][wstomach], player_weapons[player_index][i][wleftarm], player_weapons[player_index][i][wrightarm], player_weapons[player_index][i][wleftleg], player_weapons[player_index][i][wrightleg]);
  1526. }
  1527. }
  1528. case MOD_L4D, MOD_L4DII: {
  1529. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, l4d_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1530. if (player_weapons[player_index][i][whits] > 0) {
  1531. LogToGame("\"%L\" triggered \"weaponstats2\" (weapon \"%s\") (head \"%d\") (chest \"%d\") (stomach \"%d\") (leftarm \"%d\") (rightarm \"%d\") (leftleg \"%d\") (rightleg \"%d\")", player_index, l4d_weapon_list[i], player_weapons[player_index][i][whead], player_weapons[player_index][i][wchest], player_weapons[player_index][i][wstomach], player_weapons[player_index][i][wleftarm], player_weapons[player_index][i][wrightarm], player_weapons[player_index][i][wleftleg], player_weapons[player_index][i][wrightleg]);
  1532. }
  1533. }
  1534. case MOD_INSMOD: {
  1535. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, insmod_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1536. if (player_weapons[player_index][i][whits] > 0) {
  1537. LogToGame("\"%L\" triggered \"weaponstats2\" (weapon \"%s\") (head \"%d\") (chest \"%d\") (stomach \"%d\") (leftarm \"%d\") (rightarm \"%d\") (leftleg \"%d\") (rightleg \"%d\")", player_index, insmod_weapon_list[i], player_weapons[player_index][i][whead], player_weapons[player_index][i][wchest], player_weapons[player_index][i][wstomach], player_weapons[player_index][i][wleftarm], player_weapons[player_index][i][wrightarm], player_weapons[player_index][i][wleftleg], player_weapons[player_index][i][wrightleg]);
  1538. }
  1539. }
  1540. case MOD_HL2MP: {
  1541. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, hl2mp_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1542. if (player_weapons[player_index][i][whits] > 0) {
  1543. LogToGame("\"%L\" triggered \"weaponstats2\" (weapon \"%s\") (head \"%d\") (chest \"%d\") (stomach \"%d\") (leftarm \"%d\") (rightarm \"%d\") (leftleg \"%d\") (rightleg \"%d\")", player_index, hl2mp_weapon_list[i], player_weapons[player_index][i][whead], player_weapons[player_index][i][wchest], player_weapons[player_index][i][wstomach], player_weapons[player_index][i][wleftarm], player_weapons[player_index][i][wrightarm], player_weapons[player_index][i][wleftleg], player_weapons[player_index][i][wrightleg]);
  1544. }
  1545. }
  1546. case MOD_ZPS: {
  1547. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, zps_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1548. if (player_weapons[player_index][i][whits] > 0) {
  1549. LogToGame("\"%L\" triggered \"weaponstats2\" (weapon \"%s\") (head \"%d\") (chest \"%d\") (stomach \"%d\") (leftarm \"%d\") (rightarm \"%d\") (leftleg \"%d\") (rightleg \"%d\")", player_index, zps_weapon_list[i], player_weapons[player_index][i][whead], player_weapons[player_index][i][wchest], player_weapons[player_index][i][wstomach], player_weapons[player_index][i][wleftarm], player_weapons[player_index][i][wrightarm], player_weapons[player_index][i][wleftleg], player_weapons[player_index][i][wrightleg]);
  1550. }
  1551. }
  1552. case MOD_TF2: {
  1553. LogToGame("\"%L\" triggered \"weaponstats\" (weapon \"%s\") (shots \"%d\") (hits \"%d\") (kills \"%d\") (headshots \"%d\") (tks \"%d\") (damage \"%d\") (deaths \"%d\")", player_index, tf2_weapon_list[i], player_weapons[player_index][i][wshots], player_weapons[player_index][i][whits], player_weapons[player_index][i][wkills], player_weapons[player_index][i][wheadshots], player_weapons[player_index][i][wteamkills], player_weapons[player_index][i][wdamage], player_weapons[player_index][i][wdeaths]);
  1554. }
  1555. } // switch
  1556. is_logged++;
  1557. }
  1558. }
  1559. if (is_logged > 0) {
  1560. reset_player_data(player_index);
  1561. }
  1562. }
  1563.  
  1564. }
  1565.  
  1566.  
  1567. public Action: flush_weapon_logs(Handle:timer, any:index)
  1568. {
  1569. for (new i = 1; (i <= MaxClients); i++) {
  1570. dump_player_data(i);
  1571. }
  1572. }
  1573.  
  1574.  
  1575. public Action: spectator_player_timer(Handle:timer, any: caller)
  1576. {
  1577. if (((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) && (IsValidEntity(caller))) {
  1578. new observer_mode = GetEntProp(caller, Prop_Send, "m_iObserverMode");
  1579. if ((!IsFakeClient(caller)) && ((observer_mode == SPECTATOR_FIRSTPERSON) || (observer_mode == SPECTATOR_3RDPERSON))) {
  1580. new target = GetEntPropEnt(caller, Prop_Send, "m_hObserverTarget");
  1581. if ((target > 0) && (target <= MaxClients) && (IsClientInGame(target))) {
  1582.  
  1583. if ((player_messages[caller][target][supdated] == 1) || (gameme_players[caller][pspectator][starget] == 0)) {
  1584. for (new i = 0; (i <= MAXPLAYERS); i++) {
  1585. player_messages[i][target][supdated] = 0;
  1586. }
  1587. QueryIntGameMEStats("spectatorinfo", target, QuerygameMEStatsIntCallback, QUERY_TYPE_SPECTATOR);
  1588. }
  1589.  
  1590. if (target != gameme_players[caller][pspectator][starget]) {
  1591. gameme_players[caller][pspectator][srequested] = 0.0;
  1592. }
  1593.  
  1594. if (strcmp(player_messages[caller][target][smessage], "") != 0) {
  1595. if ((caller > 0) && (caller <= MaxClients) && (!IsFakeClient(caller)) && (IsClientInGame(caller))) {
  1596. if ((GetGameTime() - gameme_players[caller][pspectator][srequested]) > 5) {
  1597. new Handle: message_handle = StartMessageOne("KeyHintText", caller);
  1598. if (message_handle != INVALID_HANDLE) {
  1599. if (gameme_plugin[protobuf] == 1) {
  1600. PbAddString(message_handle, "hints", player_messages[caller][target][smessage]);
  1601. } else {
  1602. BfWriteByte(message_handle, 1);
  1603. BfWriteString(message_handle, player_messages[caller][target][smessage]);
  1604. }
  1605. EndMessage();
  1606. }
  1607. gameme_players[caller][pspectator][srequested] = GetGameTime();
  1608. }
  1609. }
  1610. } else {
  1611. if (target != gameme_players[caller][pspectator][starget]) {
  1612. if (gameme_plugin[mod_id] != MOD_CSGO) {
  1613. new Handle: message_handle = StartMessageOne("KeyHintText", caller);
  1614. if (message_handle != INVALID_HANDLE) {
  1615. if (gameme_plugin[protobuf] == 1) {
  1616. PbAddString(message_handle, "hints", "");
  1617. } else {
  1618. BfWriteByte(message_handle, 1);
  1619. BfWriteString(message_handle, "");
  1620. }
  1621. EndMessage();
  1622. }
  1623. }
  1624. gameme_players[caller][pspectator][srequested] = GetGameTime();
  1625. }
  1626. }
  1627. gameme_players[caller][pspectator][starget] = target;
  1628. }
  1629. }
  1630. }
  1631. }
  1632.  
  1633.  
  1634. public QuerygameMEStatsIntCallback(query_command, query_payload, query_caller[MAXPLAYERS + 1], query_target[MAXPLAYERS + 1], const String: query_message_prefix[], const String: query_message[])
  1635. {
  1636. if ((query_caller[0] > 0) && (query_command == RAW_MESSAGE_CALLBACK_INT_SPECTATOR)) {
  1637. if ((query_payload == QUERY_TYPE_SPECTATOR) && (query_target[0] > 0)) {
  1638. for (new i = 0; (i <= MAXPLAYERS); i++) {
  1639. if (query_caller[i] > -1) {
  1640. strcopy(player_messages[query_caller[i]][query_target[0]][smessage], 255, query_message);
  1641. ReplaceString(player_messages[query_caller[i]][query_target[0]][smessage], 255, "\\n", "\10");
  1642. gameme_players[query_caller[i]][pspectator][srequested] = 0.0;
  1643. }
  1644. }
  1645. }
  1646. }
  1647. }
  1648.  
  1649.  
  1650. public OnSocketError(Handle:socket, const errorType, const errorNum, any: arg) {
  1651. LogError("socket error %d (errno %d)", errorType, errorNum);
  1652. CloseHandle(socket);
  1653. gameme_plugin[live_socket] = SocketCreate(SOCKET_UDP, OnSocketError);
  1654. }
  1655.  
  1656.  
  1657. public Action:CollectData(Handle:timer, any:index)
  1658. {
  1659.  
  1660. if ((gameme_plugin[live_active] == 1) && (gameme_plugin[live_socket] != INVALID_HANDLE)) {
  1661. new String: network_packet[1500];
  1662.  
  1663. for(new i = 1; i <= MaxClients; i++) {
  1664. new player_index = i;
  1665. if (IsClientInGame(player_index)) {
  1666.  
  1667. if (gameme_players[player_index][palive] == 1) {
  1668.  
  1669. new Float: player_origin_float[3];
  1670. GetClientAbsOrigin(player_index, player_origin_float);
  1671.  
  1672. new player_origin[3];
  1673. player_origin[0] = RoundFloat(player_origin_float[0]);
  1674. player_origin[1] = RoundFloat(player_origin_float[1]);
  1675. player_origin[2] = RoundFloat(player_origin_float[2]);
  1676.  
  1677. new Float: player_angles_float[3];
  1678. GetClientAbsAngles(player_index, player_angles_float);
  1679. new player_angle;
  1680. player_angle = RoundFloat(player_angles_float[1]);
  1681.  
  1682. // player movement
  1683. if ((player_origin[0] != gameme_players[player_index][ploc1]) ||
  1684. (player_origin[1] != gameme_players[player_index][ploc2]) ||
  1685. (player_origin[2] != gameme_players[player_index][ploc3]) ||
  1686. (player_angle != gameme_players[player_index][pangle])) {
  1687.  
  1688. gameme_players[player_index][ploc1] = player_origin[0];
  1689. gameme_players[player_index][ploc2] = player_origin[1];
  1690. gameme_players[player_index][ploc3] = player_origin[2];
  1691. gameme_players[player_index][pangle] = player_angle;
  1692.  
  1693. decl String: send_message[128];
  1694. Format(send_message, 128, "\255\255R\254%d\254%d\254%d\254%d\254\%d\254%d\254", gameme_plugin[server_port], GetClientUserId(player_index), gameme_players[player_index][ploc1], gameme_players[player_index][ploc2], gameme_players[player_index][ploc3], gameme_players[player_index][pangle]);
  1695. // LogToGame("|%s|", send_message);
  1696.  
  1697. new send_message_len = strlen(send_message);
  1698. new network_packet_len = strlen(network_packet);
  1699. if ((network_packet_len + send_message_len) <= 1500) {
  1700. strcopy(network_packet[network_packet_len], 1500, send_message);
  1701. } else {
  1702. if (strcmp(network_packet, "") != 0) {
  1703. SocketSendTo(gameme_plugin[live_socket], network_packet, strlen(network_packet), gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port]);
  1704. // LogToGame("Send [%s:%d]: |%s|", gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port], network_packet);
  1705. network_packet[0] = '\0';
  1706. if (strcmp(send_message, "") != 0) {
  1707. strcopy(network_packet[1], 1500, send_message);
  1708. }
  1709. }
  1710. }
  1711.  
  1712. }
  1713.  
  1714.  
  1715. new health = GetClientHealth(player_index);
  1716. new armor = GetClientArmor(player_index);
  1717. decl String: player_weapon[32];
  1718. GetClientWeapon(player_index, player_weapon, 32);
  1719. new weapon_index;
  1720. if (gameme_plugin[mod_id] == MOD_CSS) {
  1721. weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, player_weapon[7]);
  1722. } else if (gameme_plugin[mod_id] == MOD_CSGO) {
  1723. weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, player_weapon[7]);
  1724. } else {
  1725. weapon_index = -1;
  1726. }
  1727.  
  1728. new money;
  1729. if (gameme_plugin[mod_id] == MOD_CSS) {
  1730. if (css_data[money_offset] != -1) {
  1731. money = GetEntData(player_index, css_data[money_offset]);
  1732. }
  1733. } else if (gameme_plugin[mod_id] == MOD_CSGO) {
  1734. money = 0;
  1735. } else {
  1736. money = 0;
  1737. }
  1738.  
  1739.  
  1740.  
  1741. // player equipment
  1742. if ((health != gameme_players[player_index][phealth]) ||
  1743. (armor != gameme_players[player_index][parmor]) ||
  1744. (money != gameme_players[player_index][pmoney]) ||
  1745. ((weapon_index > -1) && (weapon_index != gameme_players[player_index][pweapon]))) {
  1746.  
  1747. // LogToGame("Health (%d): %d, %d", player_index, health, gameme_players[player_index][phealth]);
  1748. // LogToGame("Armor (%d): %d, %d", player_index, armor, gameme_players[player_index][parmor]);
  1749. // LogToGame("Money (%d): %d, %d", player_index, money, gameme_players[player_index][pmoney]);
  1750. // LogToGame("Weapon (%d): %d, %d", player_index, weapon_index, gameme_players[player_index][pweapon]);
  1751.  
  1752. gameme_players[player_index][phealth] = health;
  1753. gameme_players[player_index][parmor] = armor;
  1754. gameme_players[player_index][pmoney] = money;
  1755. gameme_players[player_index][pweapon] = weapon_index;
  1756.  
  1757. new String: weapon_name[32];
  1758. if (gameme_players[player_index][pweapon] > -1) {
  1759. if (gameme_plugin[mod_id] == MOD_CSS) {
  1760. Format(weapon_name, 32, css_weapon_list[gameme_players[player_index][pweapon]]);
  1761. } else if (gameme_plugin[mod_id] == MOD_CSGO) {
  1762. Format(weapon_name, 32, csgo_weapon_list[gameme_players[player_index][pweapon]]);
  1763. }
  1764. }
  1765.  
  1766. decl String: send_message[128];
  1767. Format(send_message, 128, "\255\255S\254%d\254%d\254%d\254%d\254%s\254%d\254", gameme_plugin[server_port], GetClientUserId(player_index), gameme_players[player_index][phealth], gameme_players[player_index][parmor], weapon_name, gameme_players[player_index][pmoney]);
  1768. // LogToGame("|%s|", send_message);
  1769.  
  1770. new send_message_len = strlen(send_message);
  1771. new network_packet_len = strlen(network_packet);
  1772. if ((network_packet_len + send_message_len) <= 1500) {
  1773. strcopy(network_packet[network_packet_len], 1500, send_message);
  1774. } else {
  1775. if (strcmp(network_packet, "") != 0) {
  1776. SocketSendTo(gameme_plugin[live_socket], network_packet, strlen(network_packet), gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port]);
  1777. // LogToGame("Send [%s:%d]: |%s|", gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port], network_packet);
  1778. network_packet[0] = '\0';
  1779. if (strcmp(send_message, "") != 0) {
  1780. strcopy(network_packet[1], 1500, send_message);
  1781. }
  1782. }
  1783. }
  1784.  
  1785. }
  1786. }
  1787. }
  1788. }
  1789.  
  1790. if (strcmp(network_packet, "") != 0) {
  1791. SocketSendTo(gameme_plugin[live_socket], network_packet, strlen(network_packet), gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port]);
  1792. // LogToGame("Send [%s:%d]: |%s|", gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port], network_packet);
  1793. }
  1794.  
  1795. }
  1796.  
  1797. }
  1798.  
  1799.  
  1800. public PanelDamageHandler(Handle:menu, MenuAction:action, param1, param2)
  1801. {
  1802. }
  1803.  
  1804.  
  1805. public build_damage_panel(player_index)
  1806. {
  1807.  
  1808. if ((gameme_plugin[damage_display] == 0) || ((!IsClientInGame(player_index)) || (IsFakeClient(player_index)))) {
  1809. return ;
  1810. }
  1811.  
  1812. new max_clients = GetMaxClients();
  1813.  
  1814. new String: attacked[8][128];
  1815. new attacked_index = 0;
  1816. new String: wounded[8][128];
  1817. new wounded_index = 0;
  1818. new String: killed[8][128];
  1819. new killed_index = 0;
  1820. new String: killer[8][128];
  1821. new killer_index = 0;
  1822.  
  1823. for (new i = 1; (i <= max_clients); i++) {
  1824. if (player_index == i) {
  1825. for (new j = 1; (j <= max_clients); j++) {
  1826. new wounded_damage = 0;
  1827. new wounded_hits = 0;
  1828. new is_kill = 0;
  1829. if (player_damage[i][j][DAMAGE_HITS] > 0) {
  1830. wounded_hits = player_damage[i][j][DAMAGE_HITS];
  1831. wounded_damage = player_damage[i][j][DAMAGE_DAMAGE];
  1832. if (player_damage[i][j][DAMAGE_KILLED] > 0) {
  1833. is_kill++;
  1834. }
  1835. }
  1836. if (wounded_hits > 0) {
  1837. if (IsClientConnected(j)) {
  1838. if (is_kill == 0) {
  1839. decl String: victim_name[64];
  1840. GetClientName(j, victim_name, 64);
  1841. if (wounded_index < sizeof(wounded)) {
  1842. if (wounded_hits == 1) {
  1843. Format(wounded[wounded_index], 128, " %s - %d %T, %d Hit", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hit", player_index);
  1844. } else {
  1845. Format(wounded[wounded_index], 128, " %s - %d %T, %d Hits", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hits", player_index);
  1846. }
  1847. wounded_index++;
  1848. }
  1849. } else {
  1850. decl String: victim_name[32];
  1851. GetClientName(j, victim_name, 32);
  1852. if (killed_index < sizeof(killed)) {
  1853. if (wounded_hits == 1) {
  1854. Format(killed[killed_index], 128, " %s - %d %T, %d %T", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hit", player_index);
  1855. } else {
  1856. Format(killed[killed_index], 128, " %s - %d %T, %d %T", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hits", player_index);
  1857. }
  1858. killed_index++;
  1859. }
  1860. }
  1861. }
  1862. }
  1863. }
  1864. } else {
  1865. for (new j = 1; (j <= max_clients); j++) {
  1866. if (j == player_index) {
  1867. new attacked_damage = 0;
  1868. new attacked_hits = 0;
  1869. new is_killer = 0;
  1870. new killer_hpleft = 0;
  1871. new killer_weapon = 0;
  1872. if (player_damage[i][j][DAMAGE_HITS] > 0) {
  1873. attacked_hits = player_damage[i][j][DAMAGE_HITS];
  1874. attacked_damage = player_damage[i][j][DAMAGE_DAMAGE];
  1875. if (player_damage[i][j][DAMAGE_KILLER] > 0) {
  1876. is_killer++;
  1877. killer_hpleft = player_damage[i][j][DAMAGE_HPLEFT];
  1878. killer_weapon = player_damage[i][j][DAMAGE_WEAPON];
  1879.  
  1880. player_damage[i][j][DAMAGE_KILLER] = 0;
  1881. player_damage[i][j][DAMAGE_HPLEFT] = 0;
  1882. player_damage[i][j][DAMAGE_WEAPON] = -1;
  1883. }
  1884. }
  1885. if (attacked_hits > 0) {
  1886. if (IsClientConnected(i)) {
  1887. if (is_killer == 0) {
  1888. decl String: attacker_name[64];
  1889. GetClientName(i, attacker_name, 64);
  1890. if (attacked_index < sizeof(attacked)) {
  1891. if (attacked_hits == 1) {
  1892. Format(attacked[attacked_index], 128, " %s - %d %T, %d %T", attacker_name, attacked_damage, "DamagePanel_Dmg", player_index, attacked_hits, "DamagePanel_Hit", player_index);
  1893. } else {
  1894. Format(attacked[attacked_index], 128, " %s - %d %T, %d %T", attacker_name, attacked_damage, "DamagePanel_Dmg", player_index, attacked_hits, "DamagePanel_Hits", player_index);
  1895. }
  1896. attacked_index++;
  1897. }
  1898. } else {
  1899. decl String: killer_name[64];
  1900. GetClientName(i, killer_name, 64);
  1901. if (killer_index < sizeof(killer)) {
  1902. if (gameme_plugin[mod_id] == MOD_CSGO) {
  1903. if (attacked_hits == 1) {
  1904. Format(killer[killer_index], 128, " %s - %d %T, %d %T, %s", killer_name, killer_hpleft, "DamagePanel_Hp", player_index, attacked_damage, "DamagePanel_Dmg", player_index, csgo_weapon_list[killer_weapon]);
  1905. } else {
  1906. Format(killer[killer_index], 128, " %s - %d %T, %d %T, %s", killer_name, killer_hpleft, "DamagePanel_Hp", player_index, attacked_damage, "DamagePanel_Dmg", player_index, csgo_weapon_list[killer_weapon]);
  1907. }
  1908. } else if (gameme_plugin[mod_id] == MOD_CSS) {
  1909. if (attacked_hits == 1) {
  1910. Format(killer[killer_index], 128, " %s - %d %T, %d %T, %s", killer_name, killer_hpleft, "DamagePanel_Hp", player_index, attacked_damage, "DamagePanel_Dmg", player_index, css_weapon_list[killer_weapon]);
  1911. } else {
  1912. Format(killer[killer_index], 128, " %s - %d %T, %d %T, %s", killer_name, killer_hpleft, "DamagePanel_Hp", player_index, attacked_damage, "DamagePanel_Dmg", player_index, css_weapon_list[killer_weapon]);
  1913. }
  1914. } else if (gameme_plugin[mod_id] == MOD_DODS) {
  1915. if (attacked_hits == 1) {
  1916. Format(killer[killer_index], 128, " %s - %d %T, %d %T, %s", killer_name, killer_hpleft, "DamagePanel_Hp", player_index, attacked_damage, "DamagePanel_Dmg", player_index, dods_weapon_list[killer_weapon]);
  1917. } else {
  1918. Format(killer[killer_index], 128, " %s - %d %T, %d %T, %s", killer_name, killer_hpleft, "DamagePanel_Hp", player_index, attacked_damage, "DamagePanel_Dmg", player_index, dods_weapon_list[killer_weapon]);
  1919. }
  1920. }
  1921. killer_index++;
  1922. }
  1923. }
  1924. }
  1925. }
  1926. }
  1927. }
  1928.  
  1929.  
  1930. }
  1931. }
  1932.  
  1933. if ((attacked_index > 0) || (wounded_index > 0) || (killed_index > 0) || (killer_index > 0)) {
  1934. new Handle:panel = CreatePanel();
  1935. SetPanelKeys(panel, 1023);
  1936.  
  1937. new is_attacked = 0;
  1938. for (new i = 0; (i < sizeof(attacked)); i++) {
  1939. if (strcmp(attacked[i], "") != 0) {
  1940. is_attacked++;
  1941. if (is_attacked == 1) {
  1942. decl String: attackers_caption[32];
  1943. Format(attackers_caption, 32, "%T", "DamagePanel_Attackers", player_index);
  1944. DrawPanelItem(panel, attackers_caption);
  1945. }
  1946. DrawPanelText(panel, attacked[i]);
  1947. } else {
  1948. break;
  1949. }
  1950. }
  1951.  
  1952. new is_killed = 0;
  1953. for (new i = 0; (i < sizeof(killed)); i++) {
  1954. if (strcmp(killed[i], "") != 0) {
  1955. is_killed++;
  1956. if (is_killed == 1) {
  1957. decl String: killed_caption[32];
  1958. Format(killed_caption, 32, "%T", "DamagePanel_Killed", player_index);
  1959. DrawPanelItem(panel, killed_caption);
  1960. }
  1961. DrawPanelText(panel, killed[i]);
  1962. } else {
  1963. break;
  1964. }
  1965. }
  1966.  
  1967. new is_wounded = 0;
  1968. for (new i = 0; (i < sizeof(wounded)); i++) {
  1969. if (strcmp(wounded[i], "") != 0) {
  1970. is_wounded++;
  1971. if (is_wounded == 1) {
  1972. decl String: wounded_caption[32];
  1973. Format(wounded_caption, 32, "%T", "DamagePanel_Wounded", player_index);
  1974. DrawPanelItem(panel, wounded_caption);
  1975. }
  1976. DrawPanelText(panel, wounded[i]);
  1977. } else {
  1978. break;
  1979. }
  1980. }
  1981.  
  1982. new is_killer = 0;
  1983. for (new i = 0; (i < sizeof(killer)); i++) {
  1984. if (strcmp(killer[i], "") != 0) {
  1985. is_killer++;
  1986. if (is_killer == 1) {
  1987. decl String: killer_caption[32];
  1988. Format(killer_caption, 32, "%T", "DamagePanel_Killer", player_index);
  1989. DrawPanelItem(panel, killer_caption);
  1990. }
  1991. DrawPanelText(panel, killer[i]);
  1992. } else {
  1993. break;
  1994. }
  1995. }
  1996.  
  1997. SendPanelToClient(panel, player_index, PanelDamageHandler, 15);
  1998. CloseHandle(panel);
  1999. }
  2000. }
  2001.  
  2002.  
  2003. public build_damage_chat(player_index)
  2004. {
  2005.  
  2006. if ((gameme_plugin[damage_display] == 0) || ((!IsClientInGame(player_index)) || (IsFakeClient(player_index)))) {
  2007. return ;
  2008. }
  2009.  
  2010. new max_clients = GetMaxClients();
  2011. decl String: killed_message[192];
  2012. new killer_index = 0;
  2013.  
  2014. for (new i = 1; (i <= max_clients); i++) {
  2015. if (i != player_index) {
  2016. for (new j = 1; (j <= max_clients); j++) {
  2017. if (j == player_index) {
  2018. new attacked_damage = 0;
  2019. new killer_hpleft = 0;
  2020. new is_killer = 0;
  2021. if (player_damage[i][j][DAMAGE_HITS] > 0) {
  2022. attacked_damage = player_damage[i][j][DAMAGE_DAMAGE];
  2023. if (player_damage[i][j][DAMAGE_KILLER] > 0) {
  2024. killer_hpleft = player_damage[i][j][DAMAGE_HPLEFT];
  2025. is_killer++;
  2026.  
  2027. player_damage[i][j][DAMAGE_KILLER] = 0;
  2028. player_damage[i][j][DAMAGE_HPLEFT] = 0;
  2029. player_damage[i][j][DAMAGE_WEAPON] = -1;
  2030. }
  2031. }
  2032.  
  2033. if (is_killer > 0) {
  2034. if (IsClientConnected(i)) {
  2035. decl String: killer_name[64];
  2036. GetClientName(i, killer_name, 64);
  2037. if (strcmp(gameme_plugin[message_prefix_value], "") == 0) {
  2038. Format(killed_message, 192, "%T", "DamageChat_Killedyou", player_index, killer_name, attacked_damage, killer_hpleft);
  2039. } else {
  2040. Format(killed_message, 192, "%s %T", gameme_plugin[message_prefix_value], "DamageChat_Killedyou", player_index, killer_name, attacked_damage, killer_hpleft);
  2041. }
  2042. killer_index++;
  2043. }
  2044. }
  2045. }
  2046. }
  2047. }
  2048. }
  2049.  
  2050. if (killer_index > 0) {
  2051. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  2052.  
  2053. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_DODS)) {
  2054. color_gameme_entities(killed_message);
  2055.  
  2056. if (gameme_plugin[mod_id] == MOD_DODS) {
  2057. PrintToChat(player_index, killed_message);
  2058. } else {
  2059. new Handle: message_handle = StartMessageOne("SayText2", player_index);
  2060. if (message_handle != INVALID_HANDLE) {
  2061. if (gameme_plugin[protobuf] == 1) {
  2062. PbSetInt(message_handle, "ent_idx", player_index);
  2063. PbSetBool(message_handle, "chat", false);
  2064. PbSetString(message_handle, "msg_name", killed_message);
  2065. PbAddString(message_handle, "params", "");
  2066. PbAddString(message_handle, "params", "");
  2067. PbAddString(message_handle, "params", "");
  2068. PbAddString(message_handle, "params", "");
  2069. } else {
  2070. BfWriteByte(message_handle, player_index);
  2071. BfWriteByte(message_handle, 0);
  2072. BfWriteString(message_handle, killed_message);
  2073. }
  2074. EndMessage();
  2075. }
  2076. }
  2077. }
  2078. }
  2079.  
  2080. }
  2081. }
  2082.  
  2083.  
  2084. public Event_CSGOPlayerFire(Handle: event, const String: name[], bool:dontBroadcast)
  2085. {
  2086. // "userid" "short"
  2087. // "weapon" "string" // weapon name used
  2088.  
  2089. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2090. if (userid > 0) {
  2091. decl String: weapon_str[32];
  2092. GetEventString(event, "weapon", weapon_str, 32);
  2093. ReplaceString(weapon_str, 32, "weapon_", "", false);
  2094. new weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, weapon_str);
  2095. if (weapon_index > -1) {
  2096. if ((weapon_index != 22) && // hegrenade
  2097. (weapon_index != 32) && // inferno
  2098. (weapon_index != 33) && // decoy
  2099. (weapon_index != 34) && // flashbang
  2100. (weapon_index != 35) && // smokegrenade
  2101. (weapon_index != 36) && // molotov
  2102. (weapon_index != 37)) { // incgrenade
  2103. player_weapons[userid][weapon_index][wshots]++;
  2104. }
  2105. }
  2106. }
  2107. }
  2108.  
  2109.  
  2110. public Event_CSSPlayerFire(Handle: event, const String: name[], bool:dontBroadcast)
  2111. {
  2112. // "userid" "short"
  2113. // "weapon" "string" // weapon name used
  2114.  
  2115. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2116. if (userid > 0) {
  2117. decl String: weapon_str[32];
  2118. GetEventString(event, "weapon", weapon_str, 32);
  2119. new weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, weapon_str);
  2120. if (weapon_index > -1) {
  2121. if ((weapon_index != 27) && // flashbang
  2122. (weapon_index != 11) && // hegrenade
  2123. (weapon_index != 26)) { // smokegrenade
  2124. player_weapons[userid][weapon_index][wshots]++;
  2125. }
  2126. }
  2127. }
  2128. }
  2129.  
  2130.  
  2131. public Event_DODSWeaponAttack(Handle: event, const String: name[], bool:dontBroadcast)
  2132. {
  2133. // "attacker" "short"
  2134. // "weapon" "byte"
  2135.  
  2136. new userid = GetClientOfUserId(GetEventInt(event, "attacker"));
  2137. if (userid > 0) {
  2138. new log_weapon_index = GetEventInt(event, "weapon");
  2139.  
  2140. new weapon_index = -1;
  2141. switch (log_weapon_index) {
  2142. case 1 :
  2143. weapon_index = 20;
  2144. case 2 :
  2145. weapon_index = 16;
  2146. case 3 :
  2147. weapon_index = 7;
  2148. case 4 :
  2149. weapon_index = 15;
  2150. case 5 :
  2151. weapon_index = 10;
  2152. case 6 :
  2153. weapon_index = 8;
  2154. case 7 :
  2155. weapon_index = 1;
  2156. case 8 :
  2157. weapon_index = 2;
  2158. case 9 :
  2159. weapon_index = 9;
  2160. case 10 :
  2161. weapon_index = 3;
  2162. case 11 :
  2163. weapon_index = 0;
  2164. case 12 :
  2165. weapon_index = 4;
  2166. case 13 :
  2167. weapon_index = 6;
  2168. case 14 :
  2169. weapon_index = 11;
  2170. case 15 :
  2171. weapon_index = 12;
  2172. case 16 :
  2173. weapon_index = 5;
  2174. case 17 :
  2175. weapon_index = 13;
  2176. case 18 :
  2177. weapon_index = 14;
  2178. case 19 :
  2179. weapon_index = 19;
  2180. case 20 :
  2181. weapon_index = 17;
  2182. case 23 :
  2183. weapon_index = 24;
  2184. case 24 :
  2185. weapon_index = 23;
  2186. case 25 :
  2187. weapon_index = 22;
  2188. case 26 :
  2189. weapon_index = 21;
  2190. case 31 :
  2191. weapon_index = 8;
  2192. case 33 :
  2193. weapon_index = 9;
  2194. case 34 :
  2195. weapon_index = 3;
  2196. case 35 :
  2197. weapon_index = 12;
  2198. case 36 :
  2199. weapon_index = 5;
  2200. case 38 :
  2201. weapon_index = 6;
  2202. }
  2203.  
  2204. if (weapon_index > -1) {
  2205. if ((weapon_index != 25) && // dod_bomb_target
  2206. (weapon_index != 21) && // riflegren_ger
  2207. (weapon_index != 22) && // riflegren_us
  2208. (weapon_index != 23) && // smoke_ger
  2209. (weapon_index != 24)) { // smoke_us
  2210. player_weapons[userid][weapon_index][wshots]++;
  2211. }
  2212. }
  2213. }
  2214.  
  2215. }
  2216.  
  2217.  
  2218. public Event_L4DPlayerFire(Handle: event, const String: name[], bool:dontBroadcast)
  2219. {
  2220. // "local" "1" // don't network this, its way too spammy
  2221. // "userid" "short"
  2222. // "weapon" "string" // used weapon name
  2223. // "weaponid" "short" // used weapon ID
  2224. // "count" "short" // number of bullets
  2225.  
  2226. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2227. if (userid > 0) {
  2228. decl String: weapon_str[32];
  2229. GetEventString(event, "weapon", weapon_str, 32);
  2230. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str);
  2231. if (weapon_index > -1) {
  2232. if ((weapon_index != 12) && // entityflame
  2233. (weapon_index != 6)) { // inferno
  2234. player_weapons[userid][weapon_index][wshots]++;
  2235. }
  2236. }
  2237. }
  2238. }
  2239.  
  2240.  
  2241. public Event_CSGOPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2242. {
  2243. // "userid" "short" // player index who was hurt
  2244. // "attacker" "short" // player index who attacked
  2245. // "health" "byte" // remaining health points
  2246. // "armor" "byte" // remaining armor points
  2247. // "weapon" "string" // weapon name attacker used, if not the world
  2248. // "dmg_health" "byte" // damage done to health
  2249. // "dmg_armor" "byte" // damage done to armor
  2250. // "hitgroup" "byte" // hitgroup that was damaged
  2251.  
  2252. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2253. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2254.  
  2255. if ((attacker > 0) && (attacker != victim)) {
  2256. decl String: weapon_str[32];
  2257. GetEventString(event, "weapon", weapon_str, 32);
  2258. new weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, weapon_str);
  2259. if (weapon_index > -1) {
  2260. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2261. player_weapons[attacker][weapon_index][wshots]++;
  2262. }
  2263. player_weapons[attacker][weapon_index][whits]++;
  2264. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  2265. new hitgroup = GetEventInt(event, "hitgroup");
  2266. if (hitgroup < 8) {
  2267. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2268. }
  2269.  
  2270.  
  2271. if (gameme_plugin[damage_display] == 1) {
  2272. player_damage[attacker][victim][dhits]++;
  2273. player_damage[attacker][victim][ddamage] += GetEventInt(event, "dmg_health");
  2274. }
  2275. }
  2276. }
  2277. }
  2278.  
  2279.  
  2280. public Event_CSSPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2281. {
  2282. // "userid" "short" // player index who was hurt
  2283. // "attacker" "short" // player index who attacked
  2284. // "health" "byte" // remaining health points
  2285. // "armor" "byte" // remaining armor points
  2286. // "weapon" "string" // weapon name attacker used, if not the world
  2287. // "dmg_health" "byte" // damage done to health
  2288. // "dmg_armor" "byte" // damage done to armor
  2289. // "hitgroup" "byte" // hitgroup that was damaged
  2290.  
  2291. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2292. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2293.  
  2294. if ((attacker > 0) && (attacker != victim)) {
  2295. decl String: weapon_str[32];
  2296. GetEventString(event, "weapon", weapon_str, 32);
  2297. new weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, weapon_str);
  2298. if (weapon_index > -1) {
  2299. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2300. player_weapons[attacker][weapon_index][wshots]++;
  2301. }
  2302. player_weapons[attacker][weapon_index][whits]++;
  2303. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  2304. new hitgroup = GetEventInt(event, "hitgroup");
  2305. if (hitgroup < 8) {
  2306. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2307. }
  2308.  
  2309. if (gameme_plugin[damage_display] == 1) {
  2310. player_damage[attacker][victim][dhits]++;
  2311. player_damage[attacker][victim][ddamage] += GetEventInt(event, "dmg_health");
  2312. }
  2313. }
  2314. }
  2315. }
  2316.  
  2317.  
  2318. public Event_DODSPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2319. {
  2320. // "userid" "short" // user ID who was hurt
  2321. // "attacker" "short" // user ID who attacked
  2322. // "weapon" "string" // weapon name attacker used
  2323. // "health" "byte" // health remaining
  2324. // "damage" "byte" // how much damage in this attack
  2325. // "hitgroup" "byte" // what hitgroup was hit
  2326.  
  2327. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2328. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2329.  
  2330. if ((attacker > 0) && (attacker != victim)) {
  2331. decl String: weapon_str[32];
  2332. GetEventString(event, "weapon", weapon_str, 32);
  2333. new weapon_index = get_weapon_index(dods_weapon_list, MAX_DODS_WEAPON_COUNT, weapon_str);
  2334. if (weapon_index > -1) {
  2335. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2336. player_weapons[attacker][weapon_index][wshots]++;
  2337. }
  2338. player_weapons[attacker][weapon_index][whits]++;
  2339. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "health");
  2340. new hitgroup = GetEventInt(event, "hitgroup");
  2341. if (hitgroup < 8) {
  2342. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2343. }
  2344.  
  2345. if (gameme_plugin[damage_display] == 1) {
  2346. player_damage[attacker][victim][dhits]++;
  2347. player_damage[attacker][victim][ddamage] += GetEventInt(event, "damage");
  2348. }
  2349. }
  2350. }
  2351. }
  2352.  
  2353.  
  2354. public Event_L4DPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2355. {
  2356. // "local" "1" // Not networked
  2357. // "userid" "short" // user ID who was hurt
  2358. // "attacker" "short" // user id who attacked
  2359. // "attackerentid" "long" // entity id who attacked, if attacker not a player, and userid therefore invalid
  2360. // "health" "short" // remaining health points
  2361. // "armor" "byte" // remaining armor points
  2362. // "weapon" "string" // weapon name attacker used, if not the world
  2363. // "dmg_health" "short" // damage done to health
  2364. // "dmg_armor" "byte" // damage done to armor
  2365. // "hitgroup" "byte" // hitgroup that was damaged
  2366. // "type" "long" // damage type
  2367.  
  2368. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2369. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2370.  
  2371. if ((attacker > 0) && (attacker != victim)) {
  2372. decl String: weapon_str[32];
  2373. GetEventString(event, "weapon", weapon_str, 32);
  2374. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str);
  2375. if (weapon_index > -1) {
  2376. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2377. player_weapons[attacker][weapon_index][wshots]++;
  2378. }
  2379. player_weapons[attacker][weapon_index][whits]++;
  2380. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  2381. new hitgroup = GetEventInt(event, "hitgroup");
  2382. if (hitgroup < 8) {
  2383. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2384. }
  2385.  
  2386. } else if (!strcmp(weapon_str, "insect_swarm")) {
  2387. if ((victim > 0) && (IsClientInGame(victim)) && (GetClientTeam(victim) == 2) && (!GetEntProp(victim, Prop_Send, "m_isIncapacitated"))) {
  2388. log_player_player_event(attacker, victim, "triggered", "spit_hurt");
  2389. }
  2390. }
  2391.  
  2392. }
  2393. }
  2394.  
  2395.  
  2396. public Event_L4DInfectedHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2397. {
  2398. // "local" "1" // don't network this, its way too spammy
  2399. // "attacker" "short" // player userid who attacked
  2400. // "entityid" "long" // entity id of infected
  2401. // "hitgroup" "byte" // hitgroup that was damaged
  2402. // "amount" "short" // how much damage was done
  2403. // "type" "long" // damage type
  2404.  
  2405. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2406. if (attacker > 0) {
  2407. decl String: weapon_str[32];
  2408. GetClientWeapon(attacker, weapon_str, 32);
  2409. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str[7]);
  2410. if (weapon_index > -1) {
  2411. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2412. player_weapons[attacker][weapon_index][wshots]++;
  2413. }
  2414. player_weapons[attacker][weapon_index][whits]++;
  2415. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "amount");
  2416.  
  2417. new hitgroup = GetEventInt(event, "hitgroup");
  2418. if (hitgroup < 8) {
  2419. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2420. }
  2421.  
  2422. }
  2423. }
  2424. }
  2425.  
  2426. public Event_CSGOPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2427. {
  2428. // this extents the original player_death by a new fields
  2429. // "userid" "short" // user ID who died
  2430. // "attacker" "short" // user ID who killed
  2431. // "assister" "short" // user ID who assisted in the kill
  2432. // "weapon" "string" // weapon name killer used
  2433. // "headshot" "bool" // singals a headshot
  2434. // "dominated" "short" // did killer dominate victim with this kill
  2435. // "revenge" "short" // did killer get revenge on victim with this kill
  2436. // "penetrated" "short" // number of objects shot penetrated before killing target
  2437.  
  2438. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2439. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2440. new weapon_index = -1;
  2441.  
  2442. if ((victim > 0) && (attacker > 0)) {
  2443. if (attacker != victim) {
  2444. decl String: weapon_str[32];
  2445. GetEventString(event, "weapon", weapon_str, 32);
  2446. weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, weapon_str);
  2447. if (weapon_index > -1) {
  2448. player_weapons[attacker][weapon_index][wkills]++;
  2449. new headshot = GetEventBool(event, "headshot");
  2450. if (headshot == 1) {
  2451. player_weapons[attacker][weapon_index][wheadshots]++;
  2452. }
  2453. player_weapons[victim][weapon_index][wdeaths]++;
  2454.  
  2455. if (GetEventInt(event, "dominated")) {
  2456. log_player_player_event(attacker, victim, "triggered", "domination");
  2457. } else if (GetEventInt(event, "revenge")) {
  2458. log_player_player_event(attacker, victim, "triggered", "revenge");
  2459. }
  2460.  
  2461. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2462. player_weapons[attacker][weapon_index][wteamkills]++;
  2463. if (gameme_plugin[damage_display] == 1) {
  2464. player_damage[attacker][victim][dteamkill] += 1;
  2465. }
  2466. } else {
  2467. new assister = GetClientOfUserId(GetEventInt(event, "assister"));
  2468. if ((assister > 0) && (assister != victim)) {
  2469. log_player_player_event(assister, victim, "triggered", "kill_assist");
  2470. }
  2471. }
  2472.  
  2473. if (gameme_plugin[damage_display] == 1) {
  2474. player_damage[attacker][victim][dhpleft] = GetClientHealth(attacker);
  2475. player_damage[attacker][victim][dkills] += 1;
  2476. player_damage[attacker][victim][dkiller] = attacker;
  2477. player_damage[attacker][victim][dweapon] = weapon_index;
  2478. if (headshot == 1) {
  2479. player_damage[attacker][victim][dheadshots] += 1;
  2480. }
  2481.  
  2482. if (gameme_plugin[damage_display_type] == 2) {
  2483. build_damage_chat(victim);
  2484. } else {
  2485. build_damage_panel(victim);
  2486. }
  2487.  
  2488. }
  2489. }
  2490. }
  2491. dump_player_data(victim);
  2492.  
  2493. gameme_players[victim][palive] = 0;
  2494. if (gameme_plugin[display_spectator] == 1) {
  2495. if ((victim > 0) && (attacker > 0)) {
  2496. if ((IsClientInGame(victim)) && (!IsFakeClient(victim))) {
  2497. if ((victim == attacker) && (weapon_index == -1)) {
  2498. // this "could" a simple player disconnect if the cvar "mp_disconnect_kills_players"
  2499. // is enabled. However player "world" kills for example by jumping etc are ignored now
  2500. // as well. Hopefully the player disconnect event gets a flag if the kill is triggered
  2501. // by the disconnect event.
  2502. } else {
  2503. gameme_players[victim][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, victim, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2504. }
  2505. }
  2506. }
  2507.  
  2508. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2509. player_messages[j][attacker][supdated] = 1;
  2510. player_messages[j][victim][supdated] = 1;
  2511. }
  2512. }
  2513. }
  2514. }
  2515.  
  2516.  
  2517. public Event_CSSPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2518. {
  2519. // this extents the original player_death by a new fields
  2520. // "userid" "short" // user ID who died
  2521. // "attacker" "short" // user ID who killed
  2522. // "weapon" "string" // weapon name killer used
  2523. // "headshot" "bool" // signals a headshot
  2524. // "dominated" "short" // did killer dominate victim with this kill
  2525. // "revenge" "short" // did killer get revenge on victim with this kill
  2526.  
  2527. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2528. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2529.  
  2530. if ((victim > 0) && (attacker > 0)) {
  2531. if (attacker != victim) {
  2532. decl String: weapon_str[32];
  2533. GetEventString(event, "weapon", weapon_str, 32);
  2534. new weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, weapon_str);
  2535. if (weapon_index > -1) {
  2536. player_weapons[attacker][weapon_index][wkills]++;
  2537. new headshot = GetEventBool(event, "headshot");
  2538. if (headshot == 1) {
  2539. player_weapons[attacker][weapon_index][wheadshots]++;
  2540. }
  2541. player_weapons[victim][weapon_index][wdeaths]++;
  2542.  
  2543. if (GetEventInt(event, "dominated")) {
  2544. log_player_player_event(attacker, victim, "triggered", "domination");
  2545. } else if (GetEventInt(event, "revenge")) {
  2546. log_player_player_event(attacker, victim, "triggered", "revenge");
  2547. }
  2548.  
  2549.  
  2550. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2551. player_weapons[attacker][weapon_index][wteamkills]++;
  2552. if (gameme_plugin[damage_display] == 1) {
  2553. player_damage[attacker][victim][dteamkill] += 1;
  2554. }
  2555. }
  2556.  
  2557. if (gameme_plugin[damage_display] == 1) {
  2558. player_damage[attacker][victim][dhpleft] = GetClientHealth(attacker);
  2559. player_damage[attacker][victim][dkills] += 1;
  2560. player_damage[attacker][victim][dkiller] = attacker;
  2561. player_damage[attacker][victim][dweapon] = weapon_index;
  2562. if (headshot == 1) {
  2563. player_damage[attacker][victim][dheadshots] += 1;
  2564. }
  2565.  
  2566. if (gameme_plugin[damage_display_type] == 2) {
  2567. build_damage_chat(victim);
  2568. } else {
  2569. build_damage_panel(victim);
  2570. }
  2571.  
  2572. }
  2573. }
  2574. }
  2575. dump_player_data(victim);
  2576.  
  2577. gameme_players[victim][palive] = 0;
  2578. if (gameme_plugin[display_spectator] == 1) {
  2579. if ((IsClientInGame(victim)) && (!IsFakeClient(victim))) {
  2580. gameme_players[victim][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, victim, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2581. }
  2582.  
  2583. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2584. player_messages[j][attacker][supdated] = 1;
  2585. player_messages[j][victim][supdated] = 1;
  2586. }
  2587. }
  2588. }
  2589. }
  2590.  
  2591.  
  2592. public Event_DODSPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2593. {
  2594. // this extents the original player_death
  2595. // "userid" "short" // user ID who died
  2596. // "attacker" "short" // user ID who killed
  2597. // "weapon" "string" // weapon name killed used
  2598.  
  2599. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2600. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2601.  
  2602. if ((victim > 0) && (attacker > 0)) {
  2603. if (attacker != victim) {
  2604. decl String: weapon_str[32];
  2605. GetEventString(event, "weapon", weapon_str, 32);
  2606. new weapon_index = get_weapon_index(dods_weapon_list, MAX_DODS_WEAPON_COUNT, weapon_str);
  2607. if (weapon_index > -1) {
  2608. player_weapons[attacker][weapon_index][wkills]++;
  2609. player_weapons[victim][weapon_index][wdeaths]++;
  2610.  
  2611. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2612. player_weapons[attacker][weapon_index][wteamkills]++;
  2613. if (gameme_plugin[damage_display] == 1) {
  2614. player_damage[attacker][victim][dteamkill] += 1;
  2615. }
  2616. }
  2617.  
  2618. if (gameme_plugin[damage_display] == 1) {
  2619. player_damage[attacker][victim][dhpleft] = GetClientHealth(attacker);
  2620. player_damage[attacker][victim][dkills] += 1;
  2621. player_damage[attacker][victim][dkiller] = attacker;
  2622. player_damage[attacker][victim][dweapon] = weapon_index;
  2623.  
  2624. if (gameme_plugin[damage_display_type] == 2) {
  2625. build_damage_chat(victim);
  2626. } else {
  2627. build_damage_panel(victim);
  2628. }
  2629. }
  2630. }
  2631. }
  2632. dump_player_data(victim);
  2633. }
  2634. }
  2635.  
  2636.  
  2637. public Event_L4DPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2638. {
  2639. // "userid" "short" // user ID who died
  2640. // "entityid" "long" // entity ID who died, userid should be used first, to get the dead Player. Otherwise, it is not a player, so use this. $
  2641. // "attacker" "short" // user ID who killed
  2642. // "attackername" "string" // What type of zombie, so we don't have zombie names
  2643. // "attackerentid" "long" // if killer not a player, the entindex of who killed. Again, use attacker first
  2644. // "weapon" "string" // weapon name killer used
  2645. // "headshot" "bool" // signals a headshot
  2646. // "attackerisbot" "bool" // is the attacker a bot
  2647. // "victimname" "string" // What type of zombie, so we don't have zombie names
  2648. // "victimisbot" "bool" // is the victim a bot
  2649. // "abort" "bool" // did the victim abort
  2650. // "type" "long" // damage type
  2651. // "victim_x" "float"
  2652. // "victim_y" "float"
  2653. // "victim_z" "float"
  2654.  
  2655. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2656. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2657. if ((victim > 0) && (attacker > 0)) {
  2658. if (attacker != victim) {
  2659. decl String: weapon_str[32];
  2660. GetEventString(event, "weapon", weapon_str, 32);
  2661. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str);
  2662. if (weapon_index > -1) {
  2663. player_weapons[attacker][weapon_index][wkills]++;
  2664. new headshot = GetEventBool(event, "headshot");
  2665. if (headshot == 1) {
  2666. player_weapons[attacker][weapon_index][wheadshots]++;
  2667. }
  2668. player_weapons[victim][weapon_index][wdeaths]++;
  2669.  
  2670. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2671. player_weapons[attacker][weapon_index][wteamkills]++;
  2672. }
  2673. }
  2674. }
  2675. dump_player_data(victim);
  2676. }
  2677. }
  2678.  
  2679.  
  2680. public Event_HL2MPPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2681. {
  2682. // this extents the original player_death by a new fields
  2683. // "userid" "short" // user ID who died
  2684. // "attacker" "short" // user ID who killed
  2685. // "weapon" "string" // weapon name killer used
  2686.  
  2687. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2688. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2689.  
  2690. if ((victim > 0) && (attacker > 0)) {
  2691. if (attacker != victim) {
  2692. decl String: weapon_str[32];
  2693. GetEventString(event, "weapon", weapon_str, 32);
  2694. new weapon_index = get_weapon_index(hl2mp_weapon_list, MAX_HL2MP_WEAPON_COUNT, weapon_str);
  2695. if (weapon_index > -1) {
  2696. player_weapons[attacker][weapon_index][wkills]++;
  2697. player_weapons[victim][weapon_index][wdeaths]++;
  2698. if ((hl2mp_data[teamplay_enabled]) && (GetClientTeam(attacker) == GetClientTeam(victim))) {
  2699. player_weapons[attacker][weapon_index][wteamkills]++;
  2700. }
  2701. }
  2702. }
  2703. dump_player_data(victim);
  2704. }
  2705. }
  2706.  
  2707.  
  2708. public Event_ZPSPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2709. {
  2710. // this extents the original player_death by a new fields
  2711. // "userid" "short" // user ID who died
  2712. // "attacker" "short" // user ID who killed
  2713. // "weapon" "string" // weapon name killer used
  2714.  
  2715. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2716. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2717.  
  2718. if ((victim > 0) && (attacker > 0)) {
  2719. if (attacker != victim) {
  2720. decl String: weapon_str[32];
  2721. GetEventString(event, "weapon", weapon_str, 32);
  2722. new weapon_index = get_weapon_index(zps_weapon_list, MAX_ZPS_WEAPON_COUNT, weapon_str);
  2723. if (weapon_index > -1) {
  2724. player_weapons[attacker][weapon_index][wkills]++;
  2725. player_weapons[victim][weapon_index][wdeaths]++;
  2726. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2727. player_weapons[attacker][weapon_index][wteamkills]++;
  2728. }
  2729. }
  2730. }
  2731. dump_player_data(victim);
  2732. }
  2733. }
  2734.  
  2735.  
  2736. public Event_CSGOPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2737. {
  2738. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2739. if (userid > 0) {
  2740. reset_player_data(userid);
  2741. if (gameme_plugin[display_spectator] == 1) {
  2742. if (gameme_players[userid][pspectator][stimer] != INVALID_HANDLE) {
  2743. KillTimer(gameme_players[userid][pspectator][stimer]);
  2744. gameme_players[userid][pspectator][stimer] = INVALID_HANDLE;
  2745. }
  2746. }
  2747.  
  2748.  
  2749. if (IsClientInGame(userid)) {
  2750. new client_team = GetClientTeam(userid);
  2751. if ((client_team == 2) || (client_team == 3)) {
  2752.  
  2753. decl String: client_model[128];
  2754. GetClientModel(userid, client_model, 128);
  2755.  
  2756. new role_index = -1;
  2757. for (new i = 0; (i < MAX_CSGO_CODE_MODELS); i++) {
  2758. if (StrContains(client_model, csgo_code_models[i]) != -1) {
  2759. role_index = i;
  2760. }
  2761. }
  2762.  
  2763. if (role_index > -1) {
  2764. if (gameme_players[userid][prole] != role_index) {
  2765. gameme_players[userid][prole] = role_index;
  2766. LogToGame("\"%L\" changed role to \"%s\"", userid, csgo_code_models[role_index]);
  2767. }
  2768. }
  2769.  
  2770. } else if (client_team == 0) {
  2771.  
  2772. if (gameme_plugin[display_spectator] == 1) {
  2773. gameme_players[userid][pspectator][starget] = 0;
  2774. if (!IsFakeClient(userid)) {
  2775. gameme_players[userid][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, userid, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2776. }
  2777. }
  2778.  
  2779. }
  2780. }
  2781.  
  2782. }
  2783. }
  2784.  
  2785.  
  2786. public Event_CSSPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2787. {
  2788. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2789. if (userid > 0) {
  2790. reset_player_data(userid);
  2791. if (gameme_plugin[display_spectator] == 1) {
  2792. if (gameme_players[userid][pspectator][stimer] != INVALID_HANDLE) {
  2793. KillTimer(gameme_players[userid][pspectator][stimer]);
  2794. gameme_players[userid][pspectator][stimer] = INVALID_HANDLE;
  2795. }
  2796. }
  2797.  
  2798.  
  2799. if (IsClientInGame(userid)) {
  2800. new client_team = GetClientTeam(userid);
  2801. if ((client_team == 2) || (client_team == 3)) {
  2802.  
  2803. decl String: client_model[128];
  2804. GetClientModel(userid, client_model, 128);
  2805.  
  2806. new role_index = -1;
  2807. if (client_team == 2) {
  2808. for (new i = 0; (i < MAX_CSS_TS_MODELS); i++) {
  2809. if (strcmp(css_ts_models[i], client_model) == 0) {
  2810. role_index = i;
  2811. }
  2812. }
  2813. } else if (client_team == 3) {
  2814. for (new i = 0; (i < MAX_CSS_CT_MODELS); i++) {
  2815. if (strcmp(css_ct_models[i], client_model) == 0) {
  2816. role_index = i + MAX_CSS_TS_MODELS;
  2817. }
  2818. }
  2819. }
  2820.  
  2821. if (role_index > -1) {
  2822. if (gameme_players[userid][prole] != role_index) {
  2823. gameme_players[userid][prole] = role_index;
  2824. LogToGame("\"%L\" changed role to \"%s\"", userid, css_code_models[role_index]);
  2825. }
  2826. }
  2827.  
  2828. } else if (client_team == 0) {
  2829.  
  2830. if (gameme_plugin[display_spectator] == 1) {
  2831. gameme_players[userid][pspectator][starget] = 0;
  2832.  
  2833. if (!IsFakeClient(userid)) {
  2834. gameme_players[userid][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, userid, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2835. }
  2836. }
  2837.  
  2838. }
  2839. }
  2840.  
  2841. }
  2842. }
  2843.  
  2844.  
  2845. public Event_L4DPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2846. {
  2847. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2848. if (userid > 0) {
  2849. reset_player_data(userid);
  2850. }
  2851. }
  2852.  
  2853.  
  2854. public Event_HL2MPPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2855. {
  2856. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2857. if (userid > 0) {
  2858. reset_player_data(userid);
  2859. }
  2860. }
  2861.  
  2862.  
  2863. public Event_ZPSPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2864. {
  2865. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2866. if (userid > 0) {
  2867. reset_player_data(userid);
  2868. }
  2869. }
  2870.  
  2871.  
  2872. public Action: Event_CSPRoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  2873. {
  2874. LogToGame("World triggered \"Round_Start\"");
  2875. }
  2876.  
  2877.  
  2878. public Event_CSGORoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  2879. {
  2880. if (gameme_plugin[display_spectator] == 1) {
  2881. for (new i = 1; (i <= MaxClients); i++) {
  2882. if (gameme_players[i][pspectator][stimer] != INVALID_HANDLE) {
  2883. KillTimer(gameme_players[i][pspectator][stimer]);
  2884. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  2885. }
  2886.  
  2887. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2888. player_messages[i][j][supdated] = 1;
  2889. }
  2890.  
  2891. if ((i > 0) && (IsClientInGame(i)) && (!IsFakeClient(i)) && (IsClientObserver(i))) {
  2892. gameme_players[i][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, i, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2893. }
  2894. }
  2895. }
  2896. if (gameme_plugin[live_active] == 1) {
  2897. for (new i = 1; (i <= MaxClients); i++) {
  2898. gameme_players[i][palive] = 1;
  2899. }
  2900. }
  2901. }
  2902.  
  2903.  
  2904. public Event_CSSRoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  2905. {
  2906. if (gameme_plugin[display_spectator] == 1) {
  2907. for (new i = 1; (i <= MaxClients); i++) {
  2908.  
  2909. if (gameme_players[i][pspectator][stimer] != INVALID_HANDLE) {
  2910. KillTimer(gameme_players[i][pspectator][stimer]);
  2911. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  2912. }
  2913.  
  2914. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2915. player_messages[i][j][supdated] = 1;
  2916. }
  2917.  
  2918. if ((i > 0) && (IsClientInGame(i)) && (!IsFakeClient(i)) && (IsClientObserver(i))) {
  2919. gameme_players[i][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, i, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2920. }
  2921. }
  2922. }
  2923. if (gameme_plugin[live_active] == 1) {
  2924. for (new i = 1; (i <= MaxClients); i++) {
  2925. gameme_players[i][palive] = 1;
  2926. }
  2927. }
  2928. }
  2929.  
  2930.  
  2931. public Event_CSGORoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2932. {
  2933. for (new i = 1; (i <= MaxClients); i++) {
  2934. if ((IsClientConnected(i)) && (IsClientInGame(i)) && (IsPlayerAlive(i))) {
  2935. if (gameme_plugin[damage_display_type] == 1) {
  2936. build_damage_panel(i);
  2937. }
  2938. }
  2939. dump_player_data(i);
  2940. }
  2941. }
  2942.  
  2943.  
  2944. public Event_CSSRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2945. {
  2946. for (new i = 1; (i <= MaxClients); i++) {
  2947. if ((IsClientConnected(i)) && (IsClientInGame(i)) && (IsPlayerAlive(i))) {
  2948. if (gameme_plugin[damage_display_type] == 1) {
  2949. build_damage_panel(i);
  2950. }
  2951. }
  2952. dump_player_data(i);
  2953. }
  2954. }
  2955.  
  2956.  
  2957. public Event_DODSRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2958. {
  2959. for (new i = 1; (i <= MaxClients); i++) {
  2960. if ((IsClientConnected(i)) && (IsClientInGame(i)) && (IsPlayerAlive(i))) {
  2961. if (gameme_plugin[damage_display_type] == 1) {
  2962. build_damage_panel(i);
  2963. }
  2964. }
  2965. dump_player_data(i);
  2966. }
  2967. }
  2968.  
  2969.  
  2970. public Event_L4DRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2971. {
  2972. for (new i = 1; (i <= MaxClients); i++) {
  2973. dump_player_data(i);
  2974. }
  2975. }
  2976.  
  2977.  
  2978. public Event_HL2MPRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2979. {
  2980. for (new i = 1; (i <= MaxClients); i++) {
  2981. dump_player_data(i);
  2982. }
  2983. }
  2984.  
  2985.  
  2986. public Event_ZPSRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2987. {
  2988. for (new i = 1; (i <= MaxClients); i++) {
  2989. dump_player_data(i);
  2990. }
  2991. }
  2992.  
  2993.  
  2994. public Event_CSPRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2995. {
  2996. new team_index = GetEventInt(event, "winners");
  2997. if (strcmp(team_list[team_index], "") != 0) {
  2998. log_team_event(team_list[team_index], "Round_Win");
  2999. }
  3000. LogToGame("World triggered \"Round_End\"");
  3001. }
  3002.  
  3003.  
  3004. public Event_CSGOAnnounceWarmup(Handle: event, const String: name[], bool:dontBroadcast)
  3005. {
  3006. LogToGame("World triggered \"Round_Warmup_Start\"");
  3007. }
  3008.  
  3009.  
  3010. public Event_CSGOAnnounceMatchStart(Handle: event, const String: name[], bool:dontBroadcast)
  3011. {
  3012. for (new i = 0; (i <= MAXPLAYERS); i++) {
  3013. reset_player_data(i);
  3014. gameme_players[i][pgglevel] = 0;
  3015. }
  3016. LogToGame("World triggered \"Round_Match_Start\"");
  3017. }
  3018.  
  3019.  
  3020. public Event_CSGOGGLevelUp(Handle: event, const String: name[], bool:dontBroadcast)
  3021. {
  3022. // "userid" "short" // player who leveled up
  3023. // "weaponrank" "short"
  3024. // "weaponname" "string" // name of weapon being awarded
  3025.  
  3026. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  3027. if (player > 0) {
  3028.  
  3029. new level = GetEventInt(event,"weaponrank");
  3030. if (level >= 0) {
  3031. if (level > gameme_players[player][pgglevel]) {
  3032. log_player_event(player, "triggered", "gg_levelup");
  3033. } else if (level < gameme_players[player][pgglevel]) {
  3034. log_player_event(player, "triggered", "gg_leveldown");
  3035. }
  3036. gameme_players[player][pgglevel] = level;
  3037. }
  3038. }
  3039. }
  3040.  
  3041.  
  3042. public Event_CSGOGGWin(Handle: event, const String: name[], bool:dontBroadcast)
  3043. {
  3044. // "playerid" "short" // user ID who achieved the final gun game weapon
  3045.  
  3046. new player = GetClientOfUserId(GetEventInt(event, "playerid"));
  3047. if (player > 0) {
  3048. log_player_event(player, "triggered", "gg_win");
  3049. }
  3050. }
  3051.  
  3052.  
  3053. public Event_CSGOGGLeader(Handle: event, const String: name[], bool:dontBroadcast)
  3054. {
  3055. // "playerid" "short" // user ID that is currently in the lead
  3056.  
  3057. new player = GetClientOfUserId(GetEventInt(event, "playerid"));
  3058. if (player > 0) {
  3059. log_player_event(player, "triggered", "gg_leader");
  3060. }
  3061. }
  3062.  
  3063.  
  3064. public Event_RoundMVP(Handle: event, const String: name[], bool:dontBroadcast)
  3065. {
  3066. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  3067. if (player > 0) {
  3068. log_player_event(player, "triggered", "mvp");
  3069. }
  3070. }
  3071.  
  3072.  
  3073. public Event_TF2PlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  3074. {
  3075. // "userid" "short" // user ID who died
  3076. // "attacker" "short" // user ID who killed
  3077. // "weapon" "string" // weapon name killer used
  3078. // "weaponid" "short" // ID of weapon killed used
  3079. // "damagebits" "long" // bits of type of damage
  3080. // "customkill" "short" // type of custom kill
  3081. // "assister" "short" // user ID of assister
  3082. // "weapon_logclassname" "string" // weapon name that should be printed on the log
  3083. // "stun_flags" "short" // victim's stun flags at the moment of death
  3084. // "death_flags" "short" //death flags.
  3085.  
  3086. new death_flags = GetEventInt(event, "death_flags");
  3087. if ((death_flags & TF_DEATHFLAG_DEADRINGER) == TF_DEATHFLAG_DEADRINGER) {
  3088. return;
  3089. }
  3090.  
  3091. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  3092. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  3093.  
  3094. if ((attacker > 0) && (victim > 0) && (attacker <= MaxClients)) {
  3095.  
  3096. tf2_players[victim][jump_status] = TF2_JUMP_NONE;
  3097. tf2_players[victim][carry_object] = false;
  3098.  
  3099. new custom_kill = GetEventInt(event, "customkill");
  3100. if (custom_kill > 0) {
  3101. new victim_team_index = GetClientTeam(victim);
  3102. new player_team_index = GetClientTeam(attacker);
  3103.  
  3104. if (victim_team_index == player_team_index) {
  3105. if (custom_kill == TF_CUSTOM_SUICIDE) {
  3106. log_player_event(attacker, "triggered", "force_suicide");
  3107. }
  3108. } else {
  3109. if (custom_kill == TF_CUSTOM_HEADSHOT) {
  3110. log_player_event(attacker, "triggered", "headshot");
  3111. } else if (custom_kill == TF_CUSTOM_BACKSTAB) {
  3112. log_player_player_event(attacker, victim, "triggered", "backstab");
  3113. }
  3114. }
  3115. }
  3116.  
  3117. if (attacker != victim) {
  3118. switch(tf2_players[attacker][jump_status]) {
  3119. case 2:
  3120. log_player_event(attacker, "triggered", "rocket_jump_kill");
  3121. case 3:
  3122. log_player_event(attacker, "triggered", "sticky_jump_kill");
  3123. }
  3124.  
  3125. new bits = GetEventInt(event, "damagebits");
  3126. if ((bits & DMG_ACID) && (attacker > 0) && (custom_kill != TF_CUSTOM_HEADSHOT)) {
  3127. log_player_event(attacker, "triggered", "crit_kill");
  3128. } else if (bits & DMG_DROWN) {
  3129. log_player_event(attacker, "triggered", "drowned");
  3130. }
  3131. if ((death_flags & TF_DEATHFLAG_FIRSTBLOOD) == TF_DEATHFLAG_FIRSTBLOOD) {
  3132. log_player_event(attacker, "triggered", "first_blood");
  3133. }
  3134. if ((custom_kill == TF_CUSTOM_HEADSHOT) && (victim <= MaxClients) && (IsClientInGame(victim)) && ((GetEntityFlags(victim) & (FL_ONGROUND | FL_INWATER)) == 0)) {
  3135. log_player_event(attacker, "triggered", "airshot_headshot");
  3136. }
  3137. }
  3138.  
  3139. decl String: weapon_log_name[64];
  3140. GetEventString(event, "weapon_logclassname", weapon_log_name, 64);
  3141. new weapon_index = get_tf2_weapon_index(weapon_log_name, attacker);
  3142. if (weapon_index != -1) {
  3143. player_weapons[attacker][weapon_index][wkills]++;
  3144. if (custom_kill == TF_CUSTOM_HEADSHOT) {
  3145. player_weapons[attacker][weapon_index][wheadshots]++;
  3146. }
  3147. player_weapons[victim][weapon_index][wdeaths]++;
  3148. if (GetClientTeam(victim) == GetClientTeam(attacker)) {
  3149. player_weapons[attacker][weapon_index][wteamkills]++;
  3150. }
  3151. }
  3152. dump_player_data(victim);
  3153. gameme_players[victim][palive] = 0;
  3154. }
  3155. }
  3156.  
  3157.  
  3158. public Event_TF2PlayerTeleported(Handle: event, const String: name[], bool:dontBroadcast)
  3159. {
  3160. // "userid" "short" // userid of the player
  3161. // "builderid" "short" // userid of the player who built the teleporter
  3162.  
  3163. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  3164. new builder = GetClientOfUserId(GetEventInt(event, "builderid"));
  3165. if (((player > 0) && (builder > 0)) && (player != builder)) {
  3166. log_player_player_event(builder, player, "triggered", "player_teleported", 1);
  3167. }
  3168. }
  3169.  
  3170.  
  3171. public OnGameFrame()
  3172. {
  3173. switch (gameme_plugin[mod_id]) {
  3174. case MOD_HL2MP: {
  3175. new bow_entity;
  3176. while (PopStackCell(hl2mp_data[boltchecks], bow_entity)) {
  3177. if (!IsValidEntity(bow_entity)) {
  3178. continue;
  3179. }
  3180. new owner = GetEntDataEnt2(bow_entity, hl2mp_data[crossbow_owner_offset]);
  3181. if ((owner < 0) || (owner > MaxClients)) {
  3182. continue;
  3183. }
  3184. player_weapons[owner][HL2MP_CROSSBOW][wshots]++;
  3185. }
  3186. }
  3187. case MOD_TF2: {
  3188. new entity;
  3189. if ((gameme_plugin[sdkhook_available]) && (tf2_data[stun_ball_id] > -1)) {
  3190. while (PopStackCell(tf2_data[stun_balls], entity)) {
  3191. if (IsValidEntity(entity)) {
  3192. new owner = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
  3193. if ((owner > 0) && (owner <= MaxClients)) {
  3194. player_weapons[owner][tf2_data[stun_ball_id]][wshots]++;
  3195. }
  3196. }
  3197. }
  3198. }
  3199.  
  3200. while (PopStackCell(tf2_data[wearables], entity)) {
  3201. if (IsValidEntity(entity)) {
  3202. new owner = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
  3203. if ((owner > 0) && (owner <= MaxClients)) {
  3204.  
  3205. new item_index = GetEntProp(entity, Prop_Send, "m_iItemDefinitionIndex");
  3206. decl String: tmp_str[16];
  3207. Format(tmp_str, 16, "%d", item_index);
  3208.  
  3209. if (KvJumpToKey(tf2_data[items_kv], tmp_str)) {
  3210. KvGetString(tf2_data[items_kv], "item_slot", tmp_str, 16);
  3211. new slot;
  3212. if (GetTrieValue(tf2_data[slots_trie], tmp_str, slot)) {
  3213. if ((slot == 0) && (tf2_players[owner][player_class] == TFClass_DemoMan)) {
  3214. slot++;
  3215. }
  3216. if (tf2_players[owner][player_loadout0][slot] != item_index) {
  3217. tf2_players[owner][player_loadout0][slot] = item_index;
  3218. tf2_players[owner][player_loadout_updated] = true;
  3219. }
  3220. tf2_players[owner][player_loadout1][slot] = entity;
  3221. }
  3222. KvGoBack(tf2_data[items_kv]);
  3223. }
  3224. }
  3225. }
  3226. }
  3227.  
  3228. new client_count = GetClientCount();
  3229. for (new i = 1; i <= client_count; i++) {
  3230. if ((IsClientInGame(i)) && (GetEntData(i, tf2_data[carry_offset], 1))) {
  3231. tf2_players[i][carry_object] = true;
  3232. }
  3233. }
  3234.  
  3235. }
  3236.  
  3237. }
  3238. }
  3239.  
  3240.  
  3241. public OnEntityCreated(entity, const String: classname[]) {
  3242. switch (gameme_plugin[mod_id]) {
  3243. case MOD_HL2MP: {
  3244. if (strcmp(classname, "crossbow_bolt") == 0) {
  3245. PushStackCell(hl2mp_data[boltchecks], entity);
  3246. }
  3247. }
  3248. case MOD_TF2: {
  3249. if(StrEqual(classname, "tf_projectile_stun_ball")) {
  3250. PushStackCell(tf2_data[stun_balls], EntIndexToEntRef(entity));
  3251. } else if(StrEqual(classname, "tf_wearable_item_demoshield") || StrEqual(classname, "tf_wearable_item")) {
  3252. PushStackCell(tf2_data[wearables], EntIndexToEntRef(entity));
  3253. }
  3254. }
  3255. }
  3256. }
  3257.  
  3258.  
  3259. public Action: OnClientCommandKeyValues(int client, KeyValues: kv)
  3260. {
  3261. if (gameme_plugin[mod_id] == MOD_CSGO) {
  3262. decl String: command[PLATFORM_MAX_PATH];
  3263. if ((KvGetSectionName(kv, command, sizeof(command))) && (StrEqual(command, "ClanTagChanged", false))) {
  3264. decl String: clan[192];
  3265. if (KvGetString(kv, "tag", clan, sizeof(clan), "")) {
  3266. if (strcmp(clan, "") != 0) {
  3267. log_player_settings(client, "triggered", "clantag", clan);
  3268. }
  3269. }
  3270. }
  3271. }
  3272. return Plugin_Continue;
  3273. }
  3274.  
  3275.  
  3276. public Action:OnTF2GameLog(const String: message[])
  3277. {
  3278. if (tf2_data[block_next_logging]) {
  3279. tf2_data[block_next_logging] = false;
  3280. return Plugin_Handled;
  3281. }
  3282. return Plugin_Continue;
  3283. }
  3284.  
  3285.  
  3286. public OnLogLocationsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3287. {
  3288. if (strcmp(newVal, "") != 0) {
  3289. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0)) {
  3290. if (((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3291. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3292.  
  3293. if (gameme_plugin[enable_log_locations] != INVALID_HANDLE) {
  3294. new enable_log_locations_cvar = GetConVarInt(gameme_plugin[enable_log_locations]);
  3295. if (enable_log_locations_cvar == 1) {
  3296. gameme_plugin[log_locations] = 1;
  3297. LogToGame("gameME location logging activated");
  3298. } else if (enable_log_locations_cvar == 0) {
  3299. gameme_plugin[log_locations] = 0;
  3300. LogToGame("gameME location logging deactivated");
  3301. }
  3302. } else {
  3303. gameme_plugin[log_locations] = 0;
  3304. }
  3305.  
  3306. }
  3307. }
  3308. }
  3309. }
  3310.  
  3311.  
  3312. public OnDisplaySpectatorinfoChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3313. {
  3314. if (strcmp(newVal, "") != 0) {
  3315. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0)) {
  3316. if (((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3317. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3318.  
  3319. if (gameme_plugin[display_spectatorinfo] != INVALID_HANDLE) {
  3320. new display_info = GetConVarInt(gameme_plugin[display_spectatorinfo]);
  3321. if (display_info == 1) {
  3322. gameme_plugin[display_spectator] = 1;
  3323. LogToGame("gameME spectator displaying activated");
  3324. } else if (display_info == 0) {
  3325. gameme_plugin[display_spectator] = 0;
  3326. for (new i = 1; (i <= MaxClients); i++) {
  3327. if (gameme_players[i][pspectator][stimer] != INVALID_HANDLE) {
  3328. KillTimer(gameme_players[i][pspectator][stimer]);
  3329. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  3330. }
  3331. }
  3332. LogToGame("gameME spectator displaying deactivated");
  3333. }
  3334. } else {
  3335. gameme_plugin[display_spectator] = 0;
  3336. }
  3337. }
  3338. }
  3339. }
  3340. }
  3341.  
  3342.  
  3343. public OnDamageDisplayChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3344. {
  3345. if (strcmp(newVal, "") != 0) {
  3346. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0) || (strcmp(newVal, "2") == 0)) {
  3347.  
  3348. if (((strcmp(newVal, "2") == 0) && (strcmp(oldVal, "2") != 0)) ||
  3349. ((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3350. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3351.  
  3352. if (gameme_plugin[enable_damage_display] != INVALID_HANDLE) {
  3353. new enable_damage_display_cvar = GetConVarInt(gameme_plugin[enable_damage_display]);
  3354. if (enable_damage_display_cvar == 1) {
  3355. gameme_plugin[damage_display] = 1;
  3356. gameme_plugin[damage_display_type] = 1;
  3357. LogToGame("gameME damage display activated [Mode: Menu]");
  3358. } else if (enable_damage_display_cvar == 2) {
  3359. gameme_plugin[damage_display] = 1;
  3360. gameme_plugin[damage_display_type] = 2;
  3361. LogToGame("gameME damage display activated [Mode: Chat]");
  3362. } else if (enable_damage_display_cvar == 0) {
  3363. gameme_plugin[damage_display] = 0;
  3364. LogToGame("gameME damage display deactivated");
  3365. }
  3366. } else {
  3367. gameme_plugin[damage_display] = 0;
  3368. }
  3369.  
  3370. }
  3371. }
  3372. }
  3373. }
  3374.  
  3375.  
  3376. public OngameMELiveChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3377. {
  3378. if (strcmp(newVal, "") != 0) {
  3379. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0)) {
  3380.  
  3381. if (((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3382. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3383.  
  3384. if (gameme_plugin[enable_gameme_live] != INVALID_HANDLE) {
  3385. if ((gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_CSGO)) {
  3386. if ((strcmp(gameme_plugin[gameme_live_address_value], "") != 0) &&
  3387. (strcmp(gameme_plugin[gameme_live_address_port], "") != 0)) {
  3388. new enable_gameme_live_cvar = GetConVarInt(gameme_plugin[enable_gameme_live]);
  3389. if (enable_gameme_live_cvar == 1) {
  3390. gameme_plugin[live_active] = 1;
  3391. start_gameme_live();
  3392. LogToGame("gameME Live! activated");
  3393. } else if (enable_gameme_live_cvar == 0) {
  3394. gameme_plugin[live_active] = 0;
  3395. if (gameme_plugin[live_socket] != INVALID_HANDLE) {
  3396. CloseHandle(gameme_plugin[live_socket]);
  3397. }
  3398. LogToGame("gameME Live! disabled");
  3399. }
  3400. } else {
  3401. if (strcmp(newVal, "1") == 0) {
  3402. SetConVarInt(gameme_plugin[enable_gameme_live], 0);
  3403. } else {
  3404. LogToGame("gameME Live! cannot be activated, no gameME Live! address assigned");
  3405. }
  3406. gameme_plugin[live_active] = 0;
  3407. }
  3408. }
  3409. }
  3410. }
  3411. }
  3412. }
  3413. }
  3414.  
  3415.  
  3416. public OnLiveAddressChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3417. {
  3418.  
  3419. if (strcmp(newVal, "") != 0) {
  3420. if (gameme_plugin[gameme_live_address] != INVALID_HANDLE) {
  3421. decl String: gameme_live_cvar_value[32];
  3422. GetConVarString(gameme_plugin[gameme_live_address], gameme_live_cvar_value, 32);
  3423. if (strcmp(gameme_live_cvar_value, "") != 0) {
  3424. decl String: SplitArray[2][16];
  3425. new split_count = ExplodeString(gameme_live_cvar_value, ":", SplitArray, 2, 16);
  3426. if (split_count == 2) {
  3427. strcopy(gameme_plugin[gameme_live_address_value], 32, SplitArray[0]);
  3428. gameme_plugin[gameme_live_address_port] = StringToInt(SplitArray[1]);
  3429. }
  3430. }
  3431. }
  3432. }
  3433. }
  3434.  
  3435.  
  3436. public OnTagsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3437. {
  3438. if (gameme_plugin[ignore_next_tag_change]){
  3439. return;
  3440. }
  3441.  
  3442. new count = GetArraySize(gameme_plugin[custom_tags]);
  3443. for (new i = 0; (i < count); i++) {
  3444. decl String: tag[128];
  3445. GetArrayString(gameme_plugin[custom_tags], i, tag, 128);
  3446. AddPluginServerTag(tag);
  3447. }
  3448. }
  3449.  
  3450.  
  3451. public OnProtectAddressChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3452. {
  3453.  
  3454. if (strcmp(newVal, "") != 0) {
  3455. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3456. decl String: protect_address_cvar_value[32];
  3457. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 32);
  3458. if (strcmp(protect_address_cvar_value, "") != 0) {
  3459. decl String: SplitArray[2][16];
  3460. new split_count = ExplodeString(protect_address_cvar_value, ":", SplitArray, 2, 16);
  3461. if (split_count == 2) {
  3462. strcopy(gameme_plugin[protect_address_value], 32, SplitArray[0]);
  3463. gameme_plugin[protect_address_port] = StringToInt(SplitArray[1]);
  3464. }
  3465. }
  3466.  
  3467. decl String: log_command[192];
  3468. Format(log_command, 192, "logaddress_add %s", newVal);
  3469. ServerCommand(log_command);
  3470.  
  3471. for (new i = 0; (i <= MAXPLAYERS); i++) {
  3472. gameme_players[i][prole] = -1;
  3473. }
  3474. }
  3475. }
  3476. }
  3477.  
  3478.  
  3479. public Action: ProtectLoggingChange(args)
  3480. {
  3481. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3482. decl String: protect_address_cvar_value[192];
  3483. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 192);
  3484. if (args >= 1) {
  3485. decl String: log_action[192];
  3486. GetCmdArg(1, log_action, 192);
  3487. if ((strcmp(log_action, "off") == 0) || (strcmp(log_action, "0") == 0)) {
  3488. if (strcmp(protect_address_cvar_value, "") != 0) {
  3489. LogToGame("gameME address protection active, logging reenabled!");
  3490. ServerCommand("log 1");
  3491. }
  3492. } else if ((strcmp(log_action, "on") == 0) || (strcmp(log_action, "1") == 0)) {
  3493. for (new i = 0; (i <= MAXPLAYERS); i++) {
  3494. gameme_players[i][prole] = -1;
  3495. }
  3496. }
  3497.  
  3498. }
  3499. }
  3500. return Plugin_Continue;
  3501. }
  3502.  
  3503.  
  3504. public Action: ProtectForwardingChange(args)
  3505. {
  3506. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3507. decl String: protect_address_cvar_value[32];
  3508. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 32);
  3509. if (strcmp(protect_address_cvar_value, "") != 0) {
  3510. if (args == 1) {
  3511. decl String: log_action[192];
  3512. GetCmdArg(1, log_action, 192);
  3513. if (strcmp(log_action, protect_address_cvar_value) == 0) {
  3514. decl String: log_command[192];
  3515. Format(log_command, 192, "logaddress_add %s", protect_address_cvar_value);
  3516. LogToGame("gameME address protection active, logaddress readded!");
  3517. ServerCommand(log_command);
  3518. }
  3519. } else if (args > 1) {
  3520. new String: log_action[192];
  3521. for (new i = 1; i <= args; i++) {
  3522. decl String: temp_argument[192];
  3523. GetCmdArg(i, temp_argument, 192);
  3524. strcopy(log_action[strlen(log_action)], 192, temp_argument);
  3525. }
  3526. if (strcmp(log_action, protect_address_cvar_value) == 0) {
  3527. decl String: log_command[192];
  3528. Format(log_command, 192, "logaddress_add %s", protect_address_cvar_value);
  3529. LogToGame("gameME address protection active, logaddress readded!");
  3530. ServerCommand(log_command);
  3531. }
  3532. }
  3533. }
  3534. }
  3535. return Plugin_Continue;
  3536. }
  3537.  
  3538.  
  3539. public Action: ProtectForwardingDelallChange(args)
  3540. {
  3541. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3542. decl String: protect_address_cvar_value[32];
  3543. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 32);
  3544. if (strcmp(protect_address_cvar_value, "") != 0) {
  3545. decl String: log_command[192];
  3546. Format(log_command, 192, "logaddress_add %s", protect_address_cvar_value);
  3547. LogToGame("gameME address protection active, logaddress readded!");
  3548. ServerCommand(log_command);
  3549. }
  3550. }
  3551. return Plugin_Continue;
  3552. }
  3553.  
  3554.  
  3555. public OnBlockChatCommandsValuesChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3556. {
  3557. if (strcmp(newVal, "clear") == 0) {
  3558. ClearTrie(gameme_plugin[blocked_commands]);
  3559. LogToGame("Server triggered \"%s\"", "blocked_commands_cleared");
  3560. } else {
  3561. if (strcmp(newVal, "") != 0) {
  3562. decl String: BlockedCommands[32][64];
  3563. new block_commands_count = ExplodeString(String:newVal, " ", BlockedCommands, 32, 64);
  3564. for (new i = 0; (i < block_commands_count); i++) {
  3565. SetTrieValue(gameme_plugin[blocked_commands], BlockedCommands[i], 1);
  3566. }
  3567. }
  3568. }
  3569. }
  3570.  
  3571.  
  3572. public OnMessagePrefixChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3573. {
  3574. strcopy(gameme_plugin[message_prefix_value], 32, newVal);
  3575. color_gameme_entities(gameme_plugin[message_prefix_value]);
  3576. }
  3577.  
  3578.  
  3579. public Action: MessagePrefixClear(args)
  3580. {
  3581. strcopy(gameme_plugin[message_prefix_value], 32, "");
  3582. }
  3583.  
  3584.  
  3585. public OnTeamPlayChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3586. {
  3587. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  3588. hl2mp_data[teamplay_enabled] = GetConVarBool(hl2mp_data[teamplay]);
  3589. }
  3590. }
  3591.  
  3592.  
  3593. public OnTF2CriticalHitsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3594. {
  3595. tf2_data[critical_hits_enabled] = GetConVarBool(tf2_data[critical_hits]);
  3596. if(!tf2_data[critical_hits_enabled]) {
  3597. for(new i = 1; i <= MaxClients; i++) {
  3598. dump_player_data(i);
  3599. }
  3600. }
  3601. }
  3602.  
  3603.  
  3604. public Action: TF2_CalcIsAttackCritical(attacker, weapon, String: weaponname[], &bool: result)
  3605. {
  3606. if ((gameme_plugin[sdkhook_available]) && (attacker > 0) && (attacker <= MaxClients)) {
  3607. new weapon_index = get_tf2_weapon_index(weaponname[TF2_WEAPON_PREFIX_LENGTH], attacker);
  3608. if (weapon_index != -1) {
  3609. player_weapons[attacker][weapon_index][wshots]++;
  3610. }
  3611. }
  3612. return Plugin_Continue;
  3613. }
  3614.  
  3615.  
  3616. log_player_settings(client, String: verb[32], const String: settings_name[], const String: settings_value[])
  3617. {
  3618. if (client > 0) {
  3619. LogToGame("\"%L\" %s \"%s\" (value \"%s\")", client, verb, settings_name, settings_value);
  3620. } else {
  3621. LogToGame("\"%s\" %s \"%s\" (value \"%s\")", "Server", verb, settings_name, settings_value);
  3622. }
  3623. }
  3624.  
  3625.  
  3626. log_player_event(client, String: verb[32], String: player_event[192], additional_player = 0, display_location = 0)
  3627. {
  3628. if (client > 0) {
  3629. if (display_location > 0) {
  3630. new Float: player_origin[3];
  3631. GetClientAbsOrigin(client, player_origin);
  3632. if ((additional_player > 0) && (client != additional_player)) {
  3633. LogToGame("\"%L\" %s \"%s\" (position \"%d %d %d\") (player \"%L\")", client, verb, player_event, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), additional_player);
  3634. } else {
  3635. LogToGame("\"%L\" %s \"%s\" (position \"%d %d %d\")", client, verb, player_event, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));
  3636. }
  3637. } else {
  3638. if ((additional_player > 0) && (client != additional_player)) {
  3639. LogToGame("\"%L\" %s \"%s\" (player \"%L\")", client, verb, player_event, additional_player);
  3640. } else {
  3641. LogToGame("\"%L\" %s \"%s\"", client, verb, player_event);
  3642. }
  3643. }
  3644. }
  3645. }
  3646.  
  3647.  
  3648. log_player_player_event(client, victim, String: verb[32], String: player_event[192], display_location = 0)
  3649. {
  3650. if ((client > 0) && (victim > 0)) {
  3651. if (display_location > 0) {
  3652. new Float: player_origin[3];
  3653. GetClientAbsOrigin(client, player_origin);
  3654.  
  3655. new Float: victim_origin[3];
  3656. GetClientAbsOrigin(victim, victim_origin);
  3657.  
  3658. LogToGame("\"%L\" %s \"%s\" against \"%L\" (position \"%d %d %d\") (victim_position \"%d %d %d\")", client, verb, player_event, victim, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), RoundFloat(victim_origin[0]), RoundFloat(victim_origin[1]), RoundFloat(victim_origin[2]));
  3659. } else {
  3660. LogToGame("\"%L\" %s \"%s\" against \"%L\"", client, verb, player_event, victim);
  3661. }
  3662. }
  3663. }
  3664.  
  3665.  
  3666. log_team_event(String: team_name[32], String: team_action[192], String: team_objective[192] = "")
  3667. {
  3668. if (strcmp(team_name, "") != 0) {
  3669. if (strcmp(team_objective, "") != 0) {
  3670. LogToGame("Team \"%s\" triggered \"%s\" (object \"%s\")", team_name, team_action, team_objective);
  3671. } else {
  3672. LogToGame("Team \"%s\" triggered \"%s\"", team_name, team_action);
  3673. }
  3674. }
  3675. }
  3676.  
  3677.  
  3678. log_player_location(String: event[32], client, additional_player = 0)
  3679. {
  3680. if (client > 0) {
  3681. new Float: player_origin[3];
  3682. GetClientAbsOrigin(client, player_origin);
  3683. if ((additional_player > 0) && (client != additional_player)) {
  3684. new Float: additional_player_origin[3];
  3685. GetClientAbsOrigin(additional_player, additional_player_origin);
  3686. LogToGame("\"%L\" located on \"%s\" (position \"%d %d %d\") against \"%L\" (victim_position \"%d %d %d\")", client, event, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]), additional_player, RoundFloat(additional_player_origin[0]), RoundFloat(additional_player_origin[1]), RoundFloat(additional_player_origin[2]));
  3687. } else {
  3688. LogToGame("\"%L\" located on \"%s\" (position \"%d %d %d\")", client, event, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));
  3689. }
  3690. }
  3691. }
  3692.  
  3693.  
  3694. find_player_team_slot(team_index)
  3695. {
  3696. if (team_index > -1) {
  3697. ColorSlotArray[team_index] = -1;
  3698. for (new i = 1; i <= MaxClients; i++) {
  3699. if ((IsClientInGame(i)) && (GetClientTeam(i) == team_index)) {
  3700. ColorSlotArray[team_index] = i;
  3701. break;
  3702. }
  3703. }
  3704. }
  3705. }
  3706.  
  3707.  
  3708. stock validate_team_colors()
  3709. {
  3710. for (new i = 0; (i < sizeof(ColorSlotArray)); i++) {
  3711. new color_client = ColorSlotArray[i];
  3712. if (color_client > 0) {
  3713. if ((IsClientInGame(color_client)) && (GetClientTeam(color_client) != color_client)) {
  3714. find_player_team_slot(i);
  3715. }
  3716. } else {
  3717. if ((i == 2) || (i == 3)) {
  3718. find_player_team_slot(i);
  3719. }
  3720. }
  3721. }
  3722. }
  3723.  
  3724.  
  3725. public native_color_gameme_entities(Handle: plugin, numParams)
  3726. {
  3727. if (numParams < 1) {
  3728. return 0;
  3729. }
  3730.  
  3731. new message_length;
  3732. GetNativeStringLength(1, message_length);
  3733. if (message_length <= 0) {
  3734. return 0;
  3735. }
  3736.  
  3737. new String: message[message_length + 1];
  3738. GetNativeString(1, message, message_length + 1);
  3739.  
  3740. color_gameme_entities(message);
  3741. SetNativeString(1, message, strlen(message) + 1);
  3742.  
  3743. return 1;
  3744. }
  3745.  
  3746.  
  3747. color_gameme_entities(String: message[])
  3748. {
  3749. ReplaceString(message, 192, "x08", "\x08");
  3750. ReplaceString(message, 192, "x07", "\x07");
  3751. ReplaceString(message, 192, "x05", "\x05");
  3752. ReplaceString(message, 192, "x04", "\x04");
  3753. ReplaceString(message, 192, "x03", "\x03");
  3754. ReplaceString(message, 192, "x01", "\x01");
  3755. ReplaceString(message, 192, "x||0", "x0");
  3756. }
  3757.  
  3758.  
  3759. public OnClientDisconnect(client)
  3760. {
  3761. if (client > 0) {
  3762. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_DODS) || (gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) || (gameme_plugin[mod_id] == MOD_INSMOD) || (gameme_plugin[mod_id] == MOD_HL2MP) || (gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_ZPS)) {
  3763. dump_player_data(client);
  3764. reset_player_data(client);
  3765. }
  3766. if (IsClientInGame(client)) {
  3767. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_HL2MP) || (gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) || (gameme_plugin[mod_id] == MOD_INSMOD)) {
  3768. new team_index = GetClientTeam(client);
  3769. if (client == ColorSlotArray[team_index]) {
  3770. ColorSlotArray[team_index] = -1;
  3771. }
  3772. }
  3773. }
  3774.  
  3775. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) {
  3776. if (gameme_players[client][pspectator][stimer] != INVALID_HANDLE) {
  3777. KillTimer(gameme_players[client][pspectator][stimer]);
  3778. gameme_players[client][pspectator][stimer] = INVALID_HANDLE;
  3779. }
  3780. for (new j = 0; (j <= MAXPLAYERS); j++) {
  3781. player_messages[j][client][supdated] = 1;
  3782. strcopy(player_messages[j][client][smessage], 255, "");
  3783. }
  3784. }
  3785.  
  3786. }
  3787. }
  3788.  
  3789.  
  3790. stock get_team_index(String: team_name[])
  3791. {
  3792. new loop_break = 0;
  3793. new index = 0;
  3794. while ((loop_break == 0) && (index < sizeof(team_list))) {
  3795. if (strcmp(team_name, team_list[index], true) == 0) {
  3796. loop_break++;
  3797. }
  3798. index++;
  3799. }
  3800. if (loop_break == 0) {
  3801. return -1;
  3802. } else {
  3803. return index - 1;
  3804. }
  3805. }
  3806.  
  3807.  
  3808. public native_display_menu(Handle: plugin, numParams)
  3809. {
  3810. if (numParams < 4) {
  3811. return;
  3812. }
  3813.  
  3814. new client = GetNativeCell(1);
  3815. new time = GetNativeCell(2);
  3816.  
  3817. new message_length;
  3818. GetNativeStringLength(3, message_length);
  3819. if (message_length <= 0) {
  3820. return;
  3821. }
  3822. new String: message[message_length + 1];
  3823. GetNativeString(3, message, message_length + 1);
  3824.  
  3825. new handler = GetNativeCell(4);
  3826. display_menu(client, time, message, handler);
  3827.  
  3828. return;
  3829. }
  3830.  
  3831.  
  3832. display_menu(player_index, time, String: full_message[], need_handler = 0)
  3833. {
  3834. ReplaceString(full_message, 1024, "\\n", "\10");
  3835. if (need_handler == 0) {
  3836. InternalShowMenu(player_index, full_message, time);
  3837. } else {
  3838. InternalShowMenu(player_index, full_message, time, (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9), InternalMenuHandler);
  3839. }
  3840. }
  3841.  
  3842.  
  3843. public InternalMenuHandler(Handle:menu, MenuAction: action, param1, param2)
  3844. {
  3845. new client = param1;
  3846. if (IsClientInGame(client)) {
  3847. if (action == MenuAction_Select) {
  3848. decl String: player_event[192];
  3849. IntToString(param2, player_event, 192);
  3850. log_player_event(client, "selected", player_event);
  3851. } else if (action == MenuAction_Cancel) {
  3852. new String: player_event[192] = "cancel";
  3853. log_player_event(client, "selected", player_event);
  3854. }
  3855. }
  3856. }
  3857.  
  3858.  
  3859. get_param(index, argument_count)
  3860. {
  3861. decl String: param[128];
  3862. if (index <= argument_count) {
  3863. GetCmdArg(index, param, 128);
  3864. return StringToInt(param);
  3865. }
  3866. return -1;
  3867. }
  3868.  
  3869.  
  3870. get_query_id()
  3871. {
  3872. global_query_id++;
  3873. if (global_query_id > 65535) {
  3874. global_query_id = 1;
  3875. }
  3876. return global_query_id;
  3877. }
  3878.  
  3879.  
  3880. find_callback(query_id)
  3881. {
  3882. new index = -1;
  3883. new size = GetArraySize(QueryCallbackArray);
  3884.  
  3885. for (new i = 0; i < size; i++) {
  3886. decl data[callback_data];
  3887. GetArrayArray(QueryCallbackArray, i, data, sizeof(data));
  3888. if ((data[callback_data_id] == query_id) && (data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  3889. index = i;
  3890. break;
  3891. }
  3892. }
  3893. return index;
  3894. }
  3895.  
  3896.  
  3897. public native_query_gameme_stats(Handle: plugin, numParams)
  3898. {
  3899. if (numParams < 4) {
  3900. return;
  3901. }
  3902. decl String: cb_type[255];
  3903. GetNativeString(1, cb_type, 255);
  3904. new cb_client = GetNativeCell(2);
  3905. new Function: cb_function = GetNativeCell(3);
  3906. new cb_payload = GetNativeCell(4);
  3907.  
  3908. new cb_limit = 1;
  3909. if (numParams >= 5) {
  3910. cb_limit = GetNativeCell(5);
  3911. }
  3912.  
  3913. if (cb_client < 1) {
  3914. new queryid = get_query_id();
  3915.  
  3916. decl data[callback_data];
  3917. data[callback_data_id] = queryid;
  3918. data[callback_data_time] = GetGameTime();
  3919. data[callback_data_client] = cb_client;
  3920. data[callback_data_plugin] = plugin;
  3921. data[callback_data_function] = cb_function;
  3922. data[callback_data_payload] = cb_payload;
  3923. data[callback_data_limit] = cb_limit;
  3924. if (QueryCallbackArray != INVALID_HANDLE) {
  3925. PushArrayArray(QueryCallbackArray, data);
  3926. }
  3927.  
  3928. new String: query_payload[32];
  3929. IntToString(queryid, query_payload, 32);
  3930. log_player_settings(cb_client, "requested", cb_type, query_payload);
  3931. } else {
  3932. if (IsClientInGame(cb_client)) {
  3933. new userid = GetClientUserId(cb_client);
  3934. if (userid > 0) {
  3935. new queryid = get_query_id();
  3936.  
  3937. decl data[callback_data];
  3938. data[callback_data_id] = queryid;
  3939. data[callback_data_time] = GetGameTime();
  3940. data[callback_data_client] = cb_client;
  3941. data[callback_data_plugin] = plugin;
  3942. data[callback_data_function] = cb_function;
  3943. data[callback_data_payload] = cb_payload;
  3944. data[callback_data_limit] = cb_limit;
  3945.  
  3946. if (QueryCallbackArray != INVALID_HANDLE) {
  3947. PushArrayArray(QueryCallbackArray, data);
  3948.  
  3949. new String: query_payload[32];
  3950. IntToString(queryid, query_payload, 32);
  3951. log_player_settings(cb_client, "requested", cb_type, query_payload);
  3952. }
  3953. }
  3954. }
  3955. }
  3956. }
  3957.  
  3958.  
  3959. public Action: gameme_raw_message(args)
  3960. {
  3961.  
  3962. if (args < 1) {
  3963. PrintToServer("Usage: gameme_raw_message <type><array> - retrieve internal gameME Stats data");
  3964. return Plugin_Handled;
  3965. }
  3966.  
  3967. new argument_count = GetCmdArgs();
  3968. new type = get_param(1, argument_count);
  3969. switch (type) {
  3970.  
  3971. case RAW_MESSAGE_CALLBACK_PLAYER, RAW_MESSAGE_RANK, RAW_MESSAGE_PLACE, RAW_MESSAGE_KDEATH, RAW_MESSAGE_SESSION_DATA: {
  3972. if (argument_count >= 48) {
  3973. new query_id = get_param(2, argument_count);
  3974. new userid = get_param(3, argument_count);
  3975. new client = GetClientOfUserId(userid);
  3976. if (client > 0) {
  3977.  
  3978. new Handle: pack = CreateDataPack();
  3979.  
  3980. // total values
  3981. WritePackCell(pack, get_param(4, argument_count)); // rank
  3982. WritePackCell(pack, get_param(5, argument_count)); // players
  3983. WritePackCell(pack, get_param(6, argument_count)); // skill
  3984. WritePackCell(pack, get_param(7, argument_count)); // kills
  3985. WritePackCell(pack, get_param(8, argument_count)); // deaths
  3986.  
  3987. decl String: kpd_param[16];
  3988. GetCmdArg(9, kpd_param, 16);
  3989. WritePackFloat(pack, StringToFloat(kpd_param)); // kpd
  3990.  
  3991. WritePackCell(pack, get_param(10, argument_count)); // suicides
  3992. WritePackCell(pack, get_param(11, argument_count)); // headshots
  3993.  
  3994. decl String: hpk_param[16];
  3995. GetCmdArg(12, hpk_param, 16);
  3996. WritePackFloat(pack, StringToFloat(hpk_param)); // hpk
  3997.  
  3998. decl String: acc_param[16];
  3999. GetCmdArg(13, acc_param, 16);
  4000. WritePackFloat(pack, StringToFloat(acc_param)); // accuracy
  4001.  
  4002. WritePackCell(pack, get_param(14, argument_count)); // connection_time
  4003. WritePackCell(pack, get_param(15, argument_count)); // kill_assists
  4004. WritePackCell(pack, get_param(16, argument_count)); // kills_assisted
  4005. WritePackCell(pack, get_param(17, argument_count)); // points_healed
  4006. WritePackCell(pack, get_param(18, argument_count)); // flags_captured
  4007. WritePackCell(pack, get_param(19, argument_count)); // custom_wins
  4008. WritePackCell(pack, get_param(20, argument_count)); // kill_streak
  4009. WritePackCell(pack, get_param(21, argument_count)); // death_streak
  4010.  
  4011. // session values
  4012. WritePackCell(pack, get_param(22, argument_count)); // session_pos_change
  4013. WritePackCell(pack, get_param(23, argument_count)); // session_skill_change
  4014. WritePackCell(pack, get_param(24, argument_count)); // session_kills
  4015. WritePackCell(pack, get_param(25, argument_count)); // session_deaths
  4016.  
  4017. decl String: session_kpd_param[16];
  4018. GetCmdArg(26, session_kpd_param, 16);
  4019. WritePackFloat(pack, StringToFloat(session_kpd_param)); // session_kpd
  4020.  
  4021. WritePackCell(pack, get_param(27, argument_count)); // session_suicides
  4022. WritePackCell(pack, get_param(28, argument_count)); // session_headshots
  4023.  
  4024. decl String: session_hpk_param[16];
  4025. GetCmdArg(29, session_hpk_param, 16);
  4026. WritePackFloat(pack, StringToFloat(session_hpk_param)); // session_hpk
  4027.  
  4028. decl String: session_acc_param[16];
  4029. GetCmdArg(30, session_acc_param, 16);
  4030. WritePackFloat(pack, StringToFloat(session_acc_param)); // session_accuracy
  4031.  
  4032. WritePackCell(pack, get_param(31, argument_count)); // session_time
  4033. WritePackCell(pack, get_param(32, argument_count)); // session_kill_assists
  4034. WritePackCell(pack, get_param(33, argument_count)); // session_kills_assisted
  4035. WritePackCell(pack, get_param(34, argument_count)); // session_points_healed
  4036. WritePackCell(pack, get_param(35, argument_count)); // session_flags_captured
  4037. WritePackCell(pack, get_param(36, argument_count)); // session_custom_wins
  4038. WritePackCell(pack, get_param(37, argument_count)); // session_kill_streak
  4039. WritePackCell(pack, get_param(38, argument_count)); // session_death_streak
  4040.  
  4041. decl String: session_fav_weapon[32];
  4042. GetCmdArg(39, session_fav_weapon, 32);
  4043. if (StrEqual(session_fav_weapon, "-")) {
  4044. session_fav_weapon = "No Fav Weapon";
  4045. }
  4046. WritePackString(pack, session_fav_weapon); // fav weapons
  4047.  
  4048. // global values
  4049. WritePackCell(pack, get_param(40, argument_count)); // global_rank
  4050. WritePackCell(pack, get_param(41, argument_count)); // global_players
  4051. WritePackCell(pack, get_param(42, argument_count)); // global_kills
  4052. WritePackCell(pack, get_param(43, argument_count)); // global_deaths
  4053.  
  4054. decl String: global_kpd_param[16];
  4055. GetCmdArg(44, global_kpd_param, 16);
  4056. WritePackFloat(pack, StringToFloat(global_kpd_param)); // global_kpd
  4057.  
  4058. WritePackCell(pack, get_param(45, argument_count)); // global_headshots
  4059.  
  4060. decl String: global_hpk_param[16];
  4061. GetCmdArg(46, global_hpk_param, 16);
  4062. WritePackFloat(pack, StringToFloat(global_hpk_param)); // global_hpk
  4063.  
  4064. // country
  4065. decl String: country_code[16];
  4066. GetCmdArg(47, country_code, 16);
  4067. WritePackString(pack, country_code); // player country
  4068.  
  4069.  
  4070. decl Action: result;
  4071. if (type == RAW_MESSAGE_CALLBACK_PLAYER) {
  4072. if (query_id > 0) {
  4073. new cb_array_index = find_callback(query_id);
  4074. if (cb_array_index >= 0) {
  4075. decl data[callback_data];
  4076. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4077. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4078. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4079. Call_PushCell(RAW_MESSAGE_CALLBACK_PLAYER);
  4080.  
  4081. Call_PushCell(data[callback_data_payload]);
  4082. Call_PushCell(client);
  4083.  
  4084. Call_PushCellRef(pack);
  4085. Call_Finish(_:result);
  4086.  
  4087. if (data[callback_data_limit] == 1) {
  4088. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4089. }
  4090. }
  4091. }
  4092. }
  4093. } else {
  4094. switch (type) {
  4095. case RAW_MESSAGE_RANK: {
  4096. Call_StartForward(gameMEStatsRankForward);
  4097. Call_PushCell(RAW_MESSAGE_RANK);
  4098. }
  4099. case RAW_MESSAGE_PLACE: {
  4100. Call_StartForward(gameMEStatsPublicCommandForward);
  4101. Call_PushCell(RAW_MESSAGE_PLACE);
  4102. }
  4103. case RAW_MESSAGE_KDEATH: {
  4104. Call_StartForward(gameMEStatsPublicCommandForward);
  4105. Call_PushCell(RAW_MESSAGE_KDEATH);
  4106. }
  4107. case RAW_MESSAGE_SESSION_DATA: {
  4108. Call_StartForward(gameMEStatsPublicCommandForward);
  4109. Call_PushCell(RAW_MESSAGE_SESSION_DATA);
  4110. }
  4111. }
  4112. Call_PushCell(client);
  4113. Call_PushString(gameme_plugin[message_prefix_value]);
  4114.  
  4115. Call_PushCellRef(pack);
  4116. Call_Finish(_: result);
  4117. }
  4118.  
  4119. CloseHandle(pack);
  4120. }
  4121.  
  4122. }
  4123. }
  4124. case RAW_MESSAGE_CALLBACK_TOP10, RAW_MESSAGE_TOP10: {
  4125. if (argument_count >= 4) {
  4126. new query_id = get_param(2, argument_count);
  4127. new userid = get_param(3, argument_count);
  4128. if (((userid > 0) && (type == RAW_MESSAGE_TOP10)) ||
  4129. ((userid == -1) && (type == RAW_MESSAGE_CALLBACK_TOP10))) {
  4130.  
  4131. new client = GetClientOfUserId(userid);
  4132. if ((client < 1) && (type == RAW_MESSAGE_TOP10)) {
  4133. return Plugin_Handled;
  4134. }
  4135.  
  4136. new Handle: pack = CreateDataPack();
  4137. if (argument_count == 4) {
  4138. WritePackCell(pack, -1); // total_players
  4139. } else {
  4140. new count = 0;
  4141. for (new i = 4; (i <= argument_count); i++) {
  4142. if (((i + 3) <= argument_count)) {
  4143. count++;
  4144. i = i + 3;
  4145. }
  4146. }
  4147. WritePackCell(pack, count); // total_players
  4148.  
  4149. new rank = 0;
  4150. for (new i = 4; (i <= argument_count); i++) {
  4151. if (((i + 3) <= argument_count)) {
  4152. rank++;
  4153.  
  4154. WritePackCell(pack, rank); // rank
  4155. WritePackCell(pack, get_param(i, argument_count)); // skill
  4156.  
  4157. decl String: name[64];
  4158. GetCmdArg((i + 1), name, 64);
  4159. WritePackString(pack, name); // name
  4160.  
  4161. decl String: kpd_param[16];
  4162. GetCmdArg((i + 2), kpd_param, 16);
  4163. WritePackFloat(pack, StringToFloat(kpd_param)); // kpd
  4164.  
  4165. decl String: hpk_param[16];
  4166. GetCmdArg((i + 3), hpk_param, 16);
  4167. WritePackFloat(pack, StringToFloat(hpk_param)); // hpk
  4168.  
  4169. i = i + 3;
  4170. }
  4171. }
  4172. }
  4173.  
  4174. decl Action: result;
  4175. if (type == RAW_MESSAGE_CALLBACK_TOP10) {
  4176. if (query_id > 0) {
  4177. new cb_array_index = find_callback(query_id);
  4178. if (cb_array_index >= 0) {
  4179. decl data[callback_data];
  4180. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4181. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4182. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4183. Call_PushCell(RAW_MESSAGE_CALLBACK_TOP10);
  4184. Call_PushCell(data[callback_data_payload]);
  4185. Call_PushCellRef(pack);
  4186. Call_Finish(_:result);
  4187.  
  4188. if (data[callback_data_limit] == 1) {
  4189. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4190. }
  4191. }
  4192. }
  4193. }
  4194. } else {
  4195.  
  4196. Call_StartForward(gameMEStatsTop10Forward);
  4197. Call_PushCell(RAW_MESSAGE_TOP10);
  4198. Call_PushCell(client);
  4199. Call_PushString(gameme_plugin[message_prefix_value]);
  4200. Call_PushCellRef(pack);
  4201. Call_Finish(_:result);
  4202.  
  4203. }
  4204.  
  4205. CloseHandle(pack);
  4206. }
  4207. }
  4208. }
  4209. case RAW_MESSAGE_CALLBACK_NEXT, RAW_MESSAGE_NEXT: {
  4210. if (argument_count >= 4) {
  4211. new query_id = get_param(2, argument_count);
  4212. new userid = get_param(3, argument_count);
  4213. new client = GetClientOfUserId(userid);
  4214. if (client > 0) {
  4215.  
  4216. new Handle: pack = CreateDataPack();
  4217.  
  4218. if (argument_count == 4) {
  4219. WritePackCell(pack, -1); // total_players
  4220. } else {
  4221. new count = 0;
  4222. for (new i = 4; (i <= argument_count); i++) {
  4223. if (((i + 4) <= argument_count)) {
  4224. count++;
  4225. i = i + 4;
  4226. }
  4227. }
  4228. WritePackCell(pack, count); // total_players
  4229.  
  4230. for (new i = 4; (i <= argument_count); i++) {
  4231. if (((i + 4) <= argument_count)) {
  4232.  
  4233. WritePackCell(pack, get_param(i, argument_count)); // rank
  4234. WritePackCell(pack, get_param((i + 1), argument_count)); // skill
  4235.  
  4236. decl String: name[64];
  4237. GetCmdArg((i + 2), name, 64);
  4238. WritePackString(pack, name); // name
  4239.  
  4240. decl String: kpd_param[16];
  4241. GetCmdArg((i + 3), kpd_param, 16);
  4242. WritePackFloat(pack, StringToFloat(kpd_param)); // kpd
  4243.  
  4244. decl String: hpk_param[16];
  4245. GetCmdArg((i + 4), hpk_param, 16);
  4246. WritePackFloat(pack, StringToFloat(hpk_param)); // hpk
  4247.  
  4248. i = i + 4;
  4249. }
  4250. }
  4251. }
  4252.  
  4253. decl Action: result;
  4254. if (type == RAW_MESSAGE_CALLBACK_NEXT) {
  4255. if (query_id > 0) {
  4256. new cb_array_index = find_callback(query_id);
  4257. if (cb_array_index >= 0) {
  4258. decl data[callback_data];
  4259. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4260. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4261. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4262. Call_PushCell(RAW_MESSAGE_CALLBACK_NEXT);
  4263. Call_PushCell(data[callback_data_payload]);
  4264. Call_PushCell(client);
  4265. Call_PushCellRef(pack);
  4266. Call_Finish(_:result);
  4267.  
  4268. if (data[callback_data_limit] == 1) {
  4269. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4270. }
  4271. }
  4272. }
  4273. }
  4274. } else {
  4275.  
  4276. Call_StartForward(gameMEStatsNextForward);
  4277. Call_PushCell(RAW_MESSAGE_NEXT);
  4278. Call_PushCell(client);
  4279. Call_PushString(gameme_plugin[message_prefix_value]);
  4280. Call_PushCellRef(pack);
  4281. Call_Finish(_:result);
  4282.  
  4283. }
  4284. CloseHandle(pack);
  4285. }
  4286. }
  4287. }
  4288. case RAW_MESSAGE_CALLBACK_INT_CLOSE: {
  4289. if (argument_count >= 2) {
  4290. new query_id = get_param(2, argument_count);
  4291. new cb_array_index = find_callback(query_id);
  4292. if (cb_array_index >= 0) {
  4293. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4294. }
  4295. }
  4296. }
  4297. case RAW_MESSAGE_CALLBACK_INT_SPECTATOR: {
  4298. if (argument_count >= 5) {
  4299. new query_id = get_param(2, argument_count);
  4300.  
  4301. new caller[MAXPLAYERS + 1] = {-1, ...};
  4302. decl String: caller_id[512];
  4303. GetCmdArg(3, caller_id, 512);
  4304. if (StrContains(caller_id, ",") > -1) {
  4305. decl String: CallerRecipients[MaxClients][16];
  4306. new recipient_count = ExplodeString(caller_id, ",", CallerRecipients, MaxClients, 16);
  4307. for (new i = 0; (i < recipient_count); i++) {
  4308. caller[i] = GetClientOfUserId(StringToInt(CallerRecipients[i]));
  4309. }
  4310. } else {
  4311. caller[0] = GetClientOfUserId(StringToInt(caller_id));
  4312. }
  4313.  
  4314. new target[MAXPLAYERS + 1] = {-1, ...};
  4315. decl String: target_id[512];
  4316. GetCmdArg(4, target_id, 512);
  4317. if (StrContains(target_id, ",") > -1) {
  4318. decl String: TargetRecipients[MaxClients][16];
  4319. new recipient_count = ExplodeString(target_id, ",", TargetRecipients, MaxClients, 16);
  4320. for (new i = 0; (i < recipient_count); i++) {
  4321. target[i] = GetClientOfUserId(StringToInt(TargetRecipients[i]));
  4322. }
  4323. } else {
  4324. target[0] = GetClientOfUserId(StringToInt(target_id));
  4325. }
  4326.  
  4327.  
  4328. if ((caller[0] > -1) && (target[0] > -1) && (query_id > 0)) {
  4329. decl String: message[1024];
  4330. GetCmdArg(5, message, 1024);
  4331.  
  4332. new cb_array_index = find_callback(query_id);
  4333. if (cb_array_index >= 0) {
  4334. decl data[callback_data];
  4335. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4336. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4337. decl Action: result;
  4338. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4339. Call_PushCell(RAW_MESSAGE_CALLBACK_INT_SPECTATOR);
  4340. Call_PushCell(data[callback_data_payload]);
  4341. Call_PushArray(caller, MAXPLAYERS + 1);
  4342. Call_PushArray(target, MAXPLAYERS + 1);
  4343. Call_PushString(gameme_plugin[message_prefix_value]);
  4344. Call_PushString(message);
  4345. Call_Finish(_:result);
  4346.  
  4347. if (data[callback_data_limit] == 1) {
  4348. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4349. }
  4350. }
  4351. }
  4352.  
  4353. }
  4354. }
  4355. }
  4356.  
  4357. }
  4358.  
  4359. return Plugin_Handled;
  4360. }
  4361.  
  4362.  
  4363. public Action: gameme_psay(args)
  4364. {
  4365. if (args < 2) {
  4366. PrintToServer("Usage: gameme_psay <userid><colored><message> - sends private message");
  4367. return Plugin_Handled;
  4368. }
  4369.  
  4370. decl String: client_id[192];
  4371. GetCmdArg(1, client_id, 192);
  4372. if (StrContains(client_id, ",") > -1) {
  4373. decl String: MessageRecipients[MaxClients][16];
  4374. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4375. for (new i = 0; (i < recipient_count); i++) {
  4376. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4377. }
  4378. } else {
  4379. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4380. }
  4381.  
  4382. decl String: colored_param[32];
  4383. GetCmdArg(2, colored_param, 32);
  4384. new is_colored = 0;
  4385. new ignore_param = 0;
  4386. if (strcmp(colored_param, "1") == 0) {
  4387. is_colored = 1;
  4388. ignore_param = 1;
  4389. } else if (strcmp(colored_param, "2") == 0) {
  4390. is_colored = 2;
  4391. ignore_param = 1;
  4392. } else if (strcmp(colored_param, "3") == 0) {
  4393. is_colored = 3;
  4394. ignore_param = 1;
  4395. } else if (strcmp(colored_param, "0") == 0) {
  4396. ignore_param = 1;
  4397. }
  4398.  
  4399. decl String: argument_string[1024];
  4400. GetCmdArgString(argument_string, 1024);
  4401. new copy_start_length = strlen(client_id) + 3;
  4402. if (ignore_param == 1) {
  4403. copy_start_length += strlen(colored_param) + 1;
  4404. }
  4405. copy_start_length += 1;
  4406.  
  4407. new String: client_message[192];
  4408. strcopy(client_message, 192, argument_string[copy_start_length]);
  4409. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4410. client_message[strlen(client_message)-1] = 0;
  4411. }
  4412.  
  4413. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4414. new color_index = -1;
  4415. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_DODS) || (gameme_plugin[mod_id] == MOD_HL2MP) || (gameme_plugin[mod_id] == MOD_TF2) || (gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) || (gameme_plugin[mod_id] == MOD_INSMOD)) {
  4416.  
  4417. if (is_colored > 1) {
  4418. validate_team_colors();
  4419. if (is_colored == 2) {
  4420. if (ColorSlotArray[2] > -1) {
  4421. color_index = ColorSlotArray[2];
  4422. }
  4423. } else if (is_colored == 3) {
  4424. if (ColorSlotArray[3] > -1) {
  4425. color_index = ColorSlotArray[3];
  4426. }
  4427. }
  4428. color_gameme_entities(client_message);
  4429. } else if (is_colored == 1) {
  4430. color_gameme_entities(client_message);
  4431. }
  4432.  
  4433. new bool: setupColorForRecipients = false;
  4434. if (color_index == -1) {
  4435. setupColorForRecipients = true;
  4436. }
  4437.  
  4438. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4439. new recipient_client = -1;
  4440. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4441.  
  4442. new player_index = GetClientOfUserId(recipient_client);
  4443. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4444. if (setupColorForRecipients == true) {
  4445. color_index = player_index;
  4446. }
  4447.  
  4448. if (gameme_plugin[mod_id] == MOD_DODS) {
  4449. PrintToChat(player_index, client_message);
  4450. } else {
  4451. new Handle: message_handle = StartMessageOne("SayText2", player_index);
  4452. if (message_handle != INVALID_HANDLE) {
  4453. if (gameme_plugin[protobuf] == 1) {
  4454. PbSetInt(message_handle, "ent_idx", color_index);
  4455. PbSetBool(message_handle, "chat", false);
  4456. PbSetString(message_handle, "msg_name", client_message);
  4457. PbAddString(message_handle, "params", "");
  4458. PbAddString(message_handle, "params", "");
  4459. PbAddString(message_handle, "params", "");
  4460. PbAddString(message_handle, "params", "");
  4461. } else {
  4462. BfWriteByte(message_handle, color_index);
  4463. BfWriteByte(message_handle, 0);
  4464. BfWriteString(message_handle, client_message);
  4465. }
  4466. EndMessage();
  4467. }
  4468. }
  4469. }
  4470. }
  4471. } else {
  4472. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4473. new recipient_client = -1;
  4474. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4475.  
  4476. new player_index = GetClientOfUserId(recipient_client);
  4477. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4478. PrintToChat(player_index, client_message);
  4479. }
  4480. }
  4481. }
  4482. }
  4483.  
  4484. return Plugin_Handled;
  4485. }
  4486.  
  4487.  
  4488. public Action: gameme_csay(args)
  4489. {
  4490. if (args < 1) {
  4491. PrintToServer("Usage: gameme_csay <message> - display center message");
  4492. return Plugin_Handled;
  4493. }
  4494.  
  4495. new String: display_message[192];
  4496. GetCmdArg(1, display_message, 192);
  4497.  
  4498. if (strcmp(display_message, "") != 0) {
  4499. PrintCenterTextAll(display_message);
  4500. }
  4501.  
  4502. return Plugin_Handled;
  4503. }
  4504.  
  4505.  
  4506. public Action: gameme_msay(args)
  4507. {
  4508. if (args < 3) {
  4509. PrintToServer("Usage: gameme_msay <time><userid><message> - sends hud message");
  4510. return Plugin_Handled;
  4511. }
  4512.  
  4513. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  4514. return Plugin_Handled;
  4515. }
  4516.  
  4517. decl String: display_time[16];
  4518. GetCmdArg(1, display_time, 16);
  4519.  
  4520. decl String: client_id[32];
  4521. GetCmdArg(2, client_id, 32);
  4522.  
  4523. decl String: handler_param[32];
  4524. GetCmdArg(3, handler_param, 32);
  4525.  
  4526. new need_handler = 0;
  4527. if ((strcmp(handler_param, "1") == 0) || (strcmp(handler_param, "0") == 0)) {
  4528. need_handler = 1;
  4529. }
  4530.  
  4531. decl String: argument_string[1024];
  4532. GetCmdArgString(argument_string, 1024);
  4533. new copy_start_length = strlen(display_time) + 3 + strlen(client_id) + 3;
  4534. if (need_handler == 1) {
  4535. copy_start_length += 2;
  4536. }
  4537. copy_start_length += 1;
  4538.  
  4539. new String: client_message[1024];
  4540. strcopy(client_message, 1024, argument_string[copy_start_length]);
  4541. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4542. client_message[strlen(client_message)-1] = 0;
  4543. }
  4544.  
  4545. new time = StringToInt(display_time);
  4546. if (time <= 0) {
  4547. time = 10;
  4548. }
  4549.  
  4550. new client = StringToInt(client_id);
  4551. if (client > 0) {
  4552. new player_index = GetClientOfUserId(client);
  4553. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4554. if (strcmp(client_message, "") != 0) {
  4555. display_menu(player_index, time, client_message, need_handler);
  4556. }
  4557. }
  4558. }
  4559.  
  4560. return Plugin_Handled;
  4561. }
  4562.  
  4563.  
  4564. public Action: gameme_tsay(args)
  4565. {
  4566. if (args < 3) {
  4567. PrintToServer("Usage: gameme_tsay <time><userid><message> - sends hud message");
  4568. return Plugin_Handled;
  4569. }
  4570.  
  4571. decl String: display_time[16];
  4572. GetCmdArg(1, display_time, 16);
  4573.  
  4574. decl String: client_id[32];
  4575. GetCmdArg(2, client_id, 32);
  4576.  
  4577. decl String: argument_string[1024];
  4578. GetCmdArgString(argument_string, 1024);
  4579. new copy_start_length = strlen(display_time) + 3 + strlen(client_id) + 3;
  4580. copy_start_length += 1;
  4581.  
  4582. new String: client_message[192];
  4583. strcopy(client_message, 192, argument_string[copy_start_length]);
  4584. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4585. client_message[strlen(client_message)-1] = 0;
  4586. }
  4587.  
  4588. new client = StringToInt(client_id);
  4589. if ((client > 0) && (strcmp(client_message, "") != 0)) {
  4590. new player_index = GetClientOfUserId(client);
  4591. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4592. new Handle:values = CreateKeyValues("msg");
  4593. KvSetString(values, "title", client_message);
  4594. KvSetNum(values, "level", 1);
  4595. KvSetString(values, "time", display_time);
  4596. CreateDialog(player_index, values, DialogType_Msg);
  4597. CloseHandle(values);
  4598. }
  4599. }
  4600.  
  4601. return Plugin_Handled;
  4602. }
  4603.  
  4604.  
  4605. public Action: gameme_hint(args)
  4606. {
  4607. if (args < 2) {
  4608. PrintToServer("Usage: gameme_hint <userid><message> - send hint message");
  4609. return Plugin_Handled;
  4610. }
  4611.  
  4612. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  4613. return Plugin_Handled;
  4614. }
  4615.  
  4616. decl String: client_id[512];
  4617. GetCmdArg(1, client_id, 512);
  4618. if (StrContains(client_id, ",") > -1) {
  4619. decl String: MessageRecipients[MaxClients][16];
  4620. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4621. for (new i = 0; (i < recipient_count); i++) {
  4622. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4623. }
  4624. } else {
  4625. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4626. }
  4627.  
  4628. decl String: argument_string[1024];
  4629. GetCmdArgString(argument_string, 1024);
  4630. new copy_start_length = strlen(client_id) + 3;
  4631. copy_start_length++;
  4632.  
  4633. new String: client_message[192];
  4634. strcopy(client_message, 192, argument_string[copy_start_length]);
  4635. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4636. client_message[strlen(client_message)-1] = 0;
  4637. }
  4638.  
  4639. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4640. if (strcmp(client_message, "") != 0) {
  4641. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4642. new recipient_client = -1;
  4643. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4644.  
  4645. new player_index = GetClientOfUserId(recipient_client);
  4646. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4647. PrintHintText(player_index, client_message);
  4648. }
  4649. }
  4650. }
  4651. }
  4652.  
  4653. return Plugin_Handled;
  4654. }
  4655.  
  4656.  
  4657. public Action: gameme_khint(args)
  4658. {
  4659. if (args < 2) {
  4660. PrintToServer("Usage: gameme_khint <userid><message> - send khint message");
  4661. return Plugin_Handled;
  4662. }
  4663.  
  4664. decl String: client_id[512];
  4665. GetCmdArg(1, client_id, 512);
  4666. if (StrContains(client_id, ",") > -1) {
  4667. decl String: MessageRecipients[MaxClients][16];
  4668. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4669. for (new i = 0; (i < recipient_count); i++) {
  4670. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4671. }
  4672. } else {
  4673. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4674. }
  4675.  
  4676. decl String: argument_string[1024];
  4677. GetCmdArgString(argument_string, 1024);
  4678. new copy_start_length = strlen(client_id) + 3;
  4679. copy_start_length++;
  4680.  
  4681. new String: client_message[255];
  4682. strcopy(client_message, 255, argument_string[copy_start_length]);
  4683. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4684. client_message[strlen(client_message)-1] = 0;
  4685. }
  4686. ReplaceString(client_message, 255, "\\n", "\10");
  4687.  
  4688. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4689. if (strcmp(client_message, "") != 0) {
  4690. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4691. new recipient_client = -1;
  4692. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4693.  
  4694. new player_index = GetClientOfUserId(recipient_client);
  4695. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4696. new Handle: message_handle = StartMessageOne("KeyHintText", player_index);
  4697. if (message_handle != INVALID_HANDLE) {
  4698. if (gameme_plugin[protobuf] == 1) {
  4699. PbAddString(message_handle, "hints", client_message);
  4700. } else {
  4701. BfWriteByte(message_handle, 1);
  4702. BfWriteString(message_handle, client_message);
  4703. }
  4704. EndMessage();
  4705. }
  4706. }
  4707. }
  4708. }
  4709. }
  4710.  
  4711. return Plugin_Handled;
  4712. }
  4713.  
  4714.  
  4715. public Action: gameme_browse(args)
  4716. {
  4717. if (args < 2) {
  4718. PrintToServer("Usage: gameme_browse <userid><url> - open client ingame browser");
  4719. return Plugin_Handled;
  4720. }
  4721.  
  4722. decl String: client_id[512];
  4723. GetCmdArg(1, client_id, 512);
  4724. if (StrContains(client_id, ",") > -1) {
  4725. decl String: MessageRecipients[MaxClients][16];
  4726. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4727. for (new i = 0; (i < recipient_count); i++) {
  4728. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4729. }
  4730. } else {
  4731. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4732. }
  4733.  
  4734. new String: client_url[192];
  4735. GetCmdArg(2, client_url, 192);
  4736.  
  4737. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4738. if (strcmp(client_url, "") != 0) {
  4739. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4740. new recipient_client = -1;
  4741. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4742.  
  4743. new player_index = GetClientOfUserId(recipient_client);
  4744. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4745. ShowMOTDPanel(player_index, "gameME", client_url, MOTDPANEL_TYPE_URL);
  4746. }
  4747. }
  4748. }
  4749. }
  4750.  
  4751. return Plugin_Handled;
  4752. }
  4753.  
  4754.  
  4755. public Action: gameme_swap(args)
  4756. {
  4757. if (args < 1) {
  4758. PrintToServer("Usage: gameme_swap <userid> - swaps players to the opposite team (css only)");
  4759. return Plugin_Handled;
  4760. }
  4761.  
  4762. if (gameme_plugin[mod_id] != MOD_CSS) {
  4763. return Plugin_Handled;
  4764. }
  4765.  
  4766. decl String: client_id[32];
  4767. GetCmdArg(1, client_id, 32);
  4768.  
  4769. new client = StringToInt(client_id);
  4770. if (client > 0) {
  4771. new player_index = GetClientOfUserId(client);
  4772. if ((player_index > 0) && (IsClientInGame(player_index))) {
  4773. swap_player(player_index);
  4774. }
  4775. }
  4776. return Plugin_Handled;
  4777. }
  4778.  
  4779.  
  4780. public Action: gameme_redirect(args)
  4781. {
  4782. if (args < 3) {
  4783. PrintToServer("Usage: gameme_redirect <time><userid><address><reason> - asks player to be redirected to specified gameserver");
  4784. return Plugin_Handled;
  4785. }
  4786.  
  4787. decl String: display_time[16];
  4788. GetCmdArg(1, display_time, 16);
  4789.  
  4790. decl String: client_id[512];
  4791. GetCmdArg(2, client_id, 512);
  4792. if (StrContains(client_id, ",") > -1) {
  4793. decl String: MessageRecipients[MaxClients][16];
  4794. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4795. for (new i = 0; (i < recipient_count); i++) {
  4796. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4797. }
  4798. } else {
  4799. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4800. }
  4801.  
  4802. new String: server_address[192];
  4803. GetCmdArg(3, server_address, 192);
  4804.  
  4805. decl String: argument_string[1024];
  4806. GetCmdArgString(argument_string, 1024);
  4807. new copy_start_length = strlen(display_time) + 3 + strlen(client_id) + 3 + strlen(server_address) + 3;
  4808. copy_start_length++;
  4809.  
  4810. new String: redirect_reason[192];
  4811. strcopy(redirect_reason, 192, argument_string[copy_start_length]);
  4812. while ((strlen(redirect_reason) > 0) && (redirect_reason[strlen(redirect_reason)-1] == 34)) {
  4813. redirect_reason[strlen(redirect_reason)-1] = 0;
  4814. }
  4815.  
  4816. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4817. if (strcmp(server_address, "") != 0) {
  4818.  
  4819. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4820. new recipient_client = -1;
  4821. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4822.  
  4823. new player_index = GetClientOfUserId(recipient_client);
  4824. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4825. new Handle:top_values = CreateKeyValues("msg");
  4826. KvSetString(top_values, "title", redirect_reason);
  4827. KvSetNum(top_values, "level", 1);
  4828. KvSetString(top_values, "time", display_time);
  4829. CreateDialog(player_index, top_values, DialogType_Msg);
  4830. CloseHandle(top_values);
  4831.  
  4832. new Float: display_time_float;
  4833. display_time_float = StringToFloat(display_time);
  4834. DisplayAskConnectBox(player_index, display_time_float, server_address);
  4835. }
  4836. }
  4837. }
  4838. }
  4839.  
  4840. return Plugin_Handled;
  4841. }
  4842.  
  4843.  
  4844. public Action: gameme_player_action(args)
  4845. {
  4846. if (args < 2) {
  4847. PrintToServer("Usage: gameme_player_action <client><action> - trigger player action to be handled from gameME");
  4848. return Plugin_Handled;
  4849. }
  4850.  
  4851. decl String: client_id[32];
  4852. GetCmdArg(1, client_id, 32);
  4853.  
  4854. decl String: player_action[192];
  4855. GetCmdArg(2, player_action, 192);
  4856.  
  4857. new client = StringToInt(client_id);
  4858. if (client > 0) {
  4859. log_player_event(client, "triggered", player_action);
  4860. }
  4861.  
  4862. return Plugin_Handled;
  4863. }
  4864.  
  4865.  
  4866. public Action: gameme_team_action(args)
  4867. {
  4868. if (args < 2) {
  4869. PrintToServer("Usage: gameme_team_action <team_name><action>(objective) - trigger team action to be handled from gameME");
  4870. return Plugin_Handled;
  4871. }
  4872.  
  4873. decl String: team_name[32];
  4874. GetCmdArg(1, team_name, 32);
  4875.  
  4876. decl String: team_action[192];
  4877. GetCmdArg(2, team_action, 192);
  4878.  
  4879. if (args > 2) {
  4880. decl String: team_objective[192];
  4881. GetCmdArg(3, team_objective, 192);
  4882. log_team_event(team_name, team_action, team_objective);
  4883. } else {
  4884. log_team_event(team_name, team_action);
  4885. }
  4886.  
  4887. return Plugin_Handled;
  4888. }
  4889.  
  4890.  
  4891. public Action: gameme_world_action(args)
  4892. {
  4893. if (args < 1) {
  4894. PrintToServer("Usage: gameme_world_action <action> - trigger world action to be handled from gameME");
  4895. return Plugin_Handled;
  4896. }
  4897.  
  4898. decl String: world_action[192];
  4899. GetCmdArg(1, world_action, 192);
  4900.  
  4901. LogToGame("World triggered \"%s\"", world_action);
  4902.  
  4903. return Plugin_Handled;
  4904. }
  4905.  
  4906.  
  4907. is_command_blocked(String: command[])
  4908. {
  4909. new index;
  4910. if(GetTrieValue(gameme_plugin[blocked_commands], command, index)) {
  4911. return 1;
  4912. }
  4913. return 0;
  4914. }
  4915.  
  4916.  
  4917. public Action: gameme_block_commands(client, args)
  4918. {
  4919. if (client) {
  4920. if (client == 0) {
  4921. return Plugin_Continue;
  4922. }
  4923. new block_chat_commands_enabled = GetConVarInt(gameme_plugin[block_chat_commands]);
  4924.  
  4925. decl String: user_command[192];
  4926. GetCmdArgString(user_command, 192);
  4927.  
  4928. decl String: origin_command[192];
  4929. new start_index = 0;
  4930. new command_length = strlen(user_command);
  4931. if (command_length > 0) {
  4932. if (user_command[0] == 34) {
  4933. start_index = 1;
  4934. if (user_command[command_length - 1] == 34) {
  4935. user_command[command_length - 1] = 0;
  4936. }
  4937. }
  4938. strcopy(origin_command, 192, user_command[start_index]);
  4939. }
  4940.  
  4941. new String: command_type[32] = "say";
  4942. if (command_length > 0) {
  4943. if (block_chat_commands_enabled > 0) {
  4944. if (IsClientInGame(client)) {
  4945. if (is_command_blocked(user_command[start_index]) > 0) {
  4946. if ((strcmp("gameme", user_command[start_index]) == 0) ||
  4947. (strcmp("/gameme", user_command[start_index]) == 0) ||
  4948. (strcmp("!gameme", user_command[start_index]) == 0) ||
  4949. (strcmp("gameme_menu", user_command[start_index]) == 0) ||
  4950. (strcmp("/gameme_menu", user_command[start_index]) == 0) ||
  4951. (strcmp("!gameme_menu", user_command[start_index]) == 0)) {
  4952. DisplayMenu(gameme_plugin[menu_main], client, MENU_TIME_FOREVER);
  4953. }
  4954. log_player_event(client, command_type, origin_command);
  4955. return Plugin_Stop;
  4956. } else {
  4957. if ((strcmp("gameme", user_command[start_index]) == 0) ||
  4958. (strcmp("/gameme", user_command[start_index]) == 0) ||
  4959. (strcmp("!gameme", user_command[start_index]) == 0) ||
  4960. (strcmp("gameme_menu", user_command[start_index]) == 0) ||
  4961. (strcmp("/gameme_menu", user_command[start_index]) == 0) ||
  4962. (strcmp("!gameme_menu", user_command[start_index]) == 0)) {
  4963. DisplayMenu(gameme_plugin[menu_main], client, MENU_TIME_FOREVER);
  4964. }
  4965. }
  4966. }
  4967. } else {
  4968. if (IsClientInGame(client)) {
  4969. if ((strcmp("gameme", user_command[start_index]) == 0) ||
  4970. (strcmp("/gameme", user_command[start_index]) == 0) ||
  4971. (strcmp("!gameme", user_command[start_index]) == 0) ||
  4972. (strcmp("gameme_menu", user_command[start_index]) == 0) ||
  4973. (strcmp("/gameme_menu", user_command[start_index]) == 0) ||
  4974. (strcmp("!gameme_menu", user_command[start_index]) == 0)) {
  4975. DisplayMenu(gameme_plugin[menu_main], client, MENU_TIME_FOREVER);
  4976. }
  4977. }
  4978. return Plugin_Continue;
  4979. }
  4980. }
  4981. }
  4982. return Plugin_Continue;
  4983. }
  4984.  
  4985.  
  4986. public Action: gameME_Event_PlyDeath(Handle: event, const String: name[], bool:dontBroadcast)
  4987. {
  4988. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  4989. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  4990.  
  4991. if (attacker > 0) {
  4992. new headshot = 0;
  4993. headshot = GetEventBool(event, "headshot");
  4994.  
  4995. if (((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_CSP)) && (victim > 0)) {
  4996. if (headshot == 1) {
  4997. new player_team_index = GetClientTeam(attacker);
  4998. new victim_team_index = GetClientTeam(victim);
  4999. if (victim_team_index != player_team_index) {
  5000. log_player_event(attacker, "triggered", "headshot");
  5001. }
  5002. }
  5003. if ((gameme_plugin[log_locations] == 1) && ((gameme_plugin[mod_id] != MOD_CSP))) {
  5004. if (attacker != victim) {
  5005. log_player_location("kill", attacker, victim);
  5006. } else {
  5007. log_player_location("suicide", attacker);
  5008. }
  5009. }
  5010. }
  5011.  
  5012. if ((gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII)) {
  5013. if (headshot == 1) {
  5014. log_player_event(attacker, "triggered", "headshot");
  5015. }
  5016. if (gameme_plugin[mod_id] == MOD_L4DII) {
  5017. decl String: weapon[32];
  5018. GetEventString(event, "weapon", weapon, 32);
  5019. if (strncmp(weapon, "melee", 5) == 0) {
  5020. new new_weapon_index = GetEntDataEnt2(attacker, l4dii_data[active_weapon_offset]);
  5021. if (IsValidEdict(new_weapon_index)) {
  5022. GetEdictClassname(new_weapon_index, weapon, 32);
  5023. if (strncmp(weapon[7], "melee", 5) == 0) {
  5024. GetEntPropString(new_weapon_index, Prop_Data, "m_strMapSetScriptName", weapon, 32);
  5025. SetEventString(event, "weapon", weapon);
  5026. }
  5027. }
  5028. }
  5029. }
  5030. }
  5031.  
  5032. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  5033. decl String: weapon[32];
  5034. GetEventString(event, "weapon", weapon, 32);
  5035. if (strcmp(weapon, "crossbow_bolt") == 0) {
  5036. if (hl2mp_players[victim][nextbow_hitgroup] == HITGROUP_HEAD) {
  5037. log_player_event(attacker, "triggered", "headshot");
  5038. }
  5039. } else {
  5040. if (hl2mp_players[victim][next_hitgroup] == HITGROUP_HEAD) {
  5041. log_player_event(attacker, "triggered", "headshot");
  5042. }
  5043. }
  5044. }
  5045.  
  5046. if (gameme_plugin[mod_id] == MOD_ZPS) {
  5047. if (zps_players[victim][next_hitgroup] == HITGROUP_HEAD) {
  5048. log_player_event(attacker, "triggered", "headshot");
  5049. }
  5050. }
  5051.  
  5052. if (gameme_plugin[mod_id] == MOD_TF2) {
  5053. new customkill = GetEventInt(event, "customkill");
  5054. new weapon = GetEventInt(event, "weaponid");
  5055. switch (customkill) {
  5056. case TF_CUSTOM_BURNING_ARROW, TF_CUSTOM_FLYINGBURN: {
  5057. decl String: log_weapon[64];
  5058. GetEventString(event, "weapon_logclassname", log_weapon, 64);
  5059. if (log_weapon[0] != 'd') {
  5060. SetEventString(event, "weapon_logclassname", "tf_projectile_arrow_fire");
  5061. }
  5062. }
  5063. case TF_CUSTOM_TAUNT_UBERSLICE: {
  5064. if (weapon == TF_WEAPON_BONESAW) {
  5065. SetEventString(event, "weapon_logclassname", "taunt_medic");
  5066. SetEventString(event, "weapon", "taunt_medic");
  5067. }
  5068. }
  5069. case TF_CUSTOM_DECAPITATION_BOSS: {
  5070. log_player_event(attacker, "triggered", "killed_by_horseman");
  5071. }
  5072. }
  5073. }
  5074.  
  5075. if (gameme_plugin[log_locations] == 1) {
  5076. if (((gameme_plugin[mod_id] == MOD_INSMOD) || (gameme_plugin[mod_id] == MOD_HL2MP) || (gameme_plugin[mod_id] == MOD_DODS)) && (victim > 0)) {
  5077. if (attacker != victim) {
  5078. log_player_location("kill", attacker, victim);
  5079. }
  5080. }
  5081. }
  5082.  
  5083. }
  5084.  
  5085. return Plugin_Continue;
  5086. }
  5087.  
  5088.  
  5089. public Action: gameME_Event_PlyTeamChange(Handle: event, const String: name[], bool:dontBroadcast)
  5090. {
  5091. new userid = GetEventInt(event, "userid");
  5092. if (userid > 0) {
  5093. new player_index = GetClientOfUserId(userid);
  5094. if (player_index > 0) {
  5095. for (new i = 0; (i < sizeof(ColorSlotArray)); i++) {
  5096. new color_client = ColorSlotArray[i];
  5097. if (color_client > -1) {
  5098. if (color_client == player_index) {
  5099. ColorSlotArray[i] = -1;
  5100. }
  5101. }
  5102. }
  5103. }
  5104. }
  5105. return Plugin_Continue;
  5106. }
  5107.  
  5108.  
  5109. public Action: gameME_Event_PlyBombDropped(Handle: event, const String: name[], bool:dontBroadcast)
  5110. {
  5111. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5112. if (player > 0) {
  5113. if (gameme_plugin[log_locations] == 1) {
  5114. log_player_location("Dropped_The_Bomb", player);
  5115. }
  5116.  
  5117. if (gameme_plugin[display_spectator] == 1) {
  5118. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5119. player_messages[i][player][supdated] = 1;
  5120. }
  5121. }
  5122. }
  5123.  
  5124. return Plugin_Continue;
  5125. }
  5126.  
  5127.  
  5128. public Action: gameME_Event_PlyBombPickup(Handle: event, const String: name[], bool:dontBroadcast)
  5129. {
  5130. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5131. if (player > 0) {
  5132. if (gameme_plugin[log_locations] == 1) {
  5133. log_player_location("Got_The_Bomb", player);
  5134. }
  5135. if (gameme_plugin[display_spectator] == 1) {
  5136. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5137. player_messages[i][player][supdated] = 1;
  5138. }
  5139. }
  5140. }
  5141.  
  5142. return Plugin_Continue;
  5143. }
  5144.  
  5145.  
  5146. public Action: gameME_Event_PlyBombPlanted(Handle: event, const String: name[], bool:dontBroadcast)
  5147. {
  5148. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5149. if (player > 0) {
  5150. if (gameme_plugin[log_locations] == 1) {
  5151. log_player_location("Planted_The_Bomb", player);
  5152. }
  5153. if (gameme_plugin[display_spectator] == 1) {
  5154. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5155. player_messages[i][player][supdated] = 1;
  5156. }
  5157. }
  5158. }
  5159.  
  5160. return Plugin_Continue;
  5161. }
  5162.  
  5163.  
  5164. public Action: gameME_Event_PlyBombDefused(Handle: event, const String: name[], bool:dontBroadcast)
  5165. {
  5166. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5167. if (player > 0) {
  5168. if (gameme_plugin[log_locations] == 1) {
  5169. log_player_location("Defused_The_Bomb", player);
  5170. }
  5171.  
  5172. if (gameme_plugin[display_spectator] == 1) {
  5173. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5174. player_messages[i][player][supdated] = 1;
  5175. }
  5176. }
  5177. }
  5178. return Plugin_Continue;
  5179. }
  5180.  
  5181.  
  5182. public Action: gameME_Event_PlyHostageKill(Handle: event, const String: name[], bool:dontBroadcast)
  5183. {
  5184. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5185. if (player > 0) {
  5186. if (gameme_plugin[log_locations] == 1) {
  5187. log_player_location("Killed_A_Hostage", player);
  5188. }
  5189.  
  5190. if (gameme_plugin[display_spectator] == 1) {
  5191. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5192. player_messages[i][player][supdated] = 1;
  5193. }
  5194. }
  5195. }
  5196. return Plugin_Continue;
  5197. }
  5198.  
  5199.  
  5200. public Action: gameME_Event_PlyHostageResc(Handle: event, const String: name[], bool:dontBroadcast)
  5201. {
  5202. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5203. if (player > 0) {
  5204. if (gameme_plugin[log_locations] == 1) {
  5205. log_player_location("Rescued_A_Hostage", player);
  5206. }
  5207.  
  5208. if (gameme_plugin[display_spectator] == 1) {
  5209. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5210. player_messages[i][player][supdated] = 1;
  5211. }
  5212. }
  5213. }
  5214. return Plugin_Continue;
  5215. }
  5216.  
  5217.  
  5218. swap_player(player_index)
  5219. {
  5220. if (IsClientInGame(player_index)) {
  5221. new player_team_index = GetClientTeam(player_index);
  5222. decl String: player_team[32];
  5223. player_team = team_list[player_team_index];
  5224.  
  5225. if (strcmp(player_team, "CT") == 0) {
  5226. if (IsPlayerAlive(player_index)) {
  5227. CS_SwitchTeam(player_index, CS_TEAM_T);
  5228. CS_RespawnPlayer(player_index);
  5229. new new_model = GetRandomInt(0, 3);
  5230. SetEntityModel(player_index, css_ts_models[new_model]);
  5231. } else {
  5232. CS_SwitchTeam(player_index, CS_TEAM_T);
  5233. }
  5234. } else if (strcmp(player_team, "TERRORIST") == 0) {
  5235. if (IsPlayerAlive(player_index)) {
  5236. CS_SwitchTeam(player_index, CS_TEAM_CT);
  5237. CS_RespawnPlayer(player_index);
  5238. new new_model = GetRandomInt(0, 3);
  5239. SetEntityModel(player_index, css_ct_models[new_model]);
  5240. new weapon_entity = GetPlayerWeaponSlot(player_index, 4);
  5241. if (weapon_entity > 0) {
  5242. decl String: class_name[32];
  5243. GetEdictClassname(weapon_entity, class_name, 32);
  5244. if (strcmp(class_name, "weapon_c4") == 0) {
  5245. RemovePlayerItem(player_index, weapon_entity);
  5246. }
  5247. }
  5248. } else {
  5249. CS_SwitchTeam(player_index, CS_TEAM_CT);
  5250. }
  5251. }
  5252. }
  5253. }
  5254.  
  5255.  
  5256. public CreateGameMEMenuMain(&Handle: MenuHandle)
  5257. {
  5258. MenuHandle = CreateMenu(gameMEMainCommandHandler, MenuAction_Display | MenuAction_DisplayItem | MenuAction_Select | MenuAction_Cancel);
  5259.  
  5260. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  5261.  
  5262. SetMenuTitle(MenuHandle, "gameME - Main Menu");
  5263.  
  5264. AddMenuItem(MenuHandle, "IngameMenu_Menu1", "Display Rank");
  5265. AddMenuItem(MenuHandle, "IngameMenu_Menu2", "Next Players");
  5266. AddMenuItem(MenuHandle, "IngameMenu_Menu3", "Top10 Players");
  5267. AddMenuItem(MenuHandle, "IngameMenu_Menu4", "Auto Ranking");
  5268. AddMenuItem(MenuHandle, "IngameMenu_Menu5", "Console Events");
  5269. AddMenuItem(MenuHandle, "IngameMenu_Menu6", "Toggle Ranking Display");
  5270. AddMenuItem(MenuHandle, "IngameMenu_Menu16" ,"Reset Statistics");
  5271.  
  5272. } else {
  5273.  
  5274. SetMenuTitle(MenuHandle, "gameME - Main Menu");
  5275.  
  5276. AddMenuItem(MenuHandle, "IngameMenu_Menu1", "Display Rank");
  5277. AddMenuItem(MenuHandle, "IngameMenu_Menu2", "Next Players");
  5278. AddMenuItem(MenuHandle, "IngameMenu_Menu3", "Top10 Players");
  5279. AddMenuItem(MenuHandle, "IngameMenu_Menu7", "Clans Ranking");
  5280. AddMenuItem(MenuHandle, "IngameMenu_Menu8", "Server Status");
  5281. AddMenuItem(MenuHandle, "IngameMenu_Menu9", "Statsme");
  5282.  
  5283. AddMenuItem(MenuHandle, "IngameMenu_Menu4", "Auto Ranking");
  5284. AddMenuItem(MenuHandle, "IngameMenu_Menu5", "Console Events");
  5285. AddMenuItem(MenuHandle, "IngameMenu_Menu10", "Weapon Usage");
  5286. AddMenuItem(MenuHandle, "IngameMenu_Menu11", "Weapons Accuracy");
  5287. AddMenuItem(MenuHandle, "IngameMenu_Menu12", "Weapons Targets");
  5288. AddMenuItem(MenuHandle, "IngameMenu_Menu13", "Player Kills");
  5289.  
  5290. AddMenuItem(MenuHandle, "IngameMenu_Menu6" , "Toggle Ranking Display");
  5291. AddMenuItem(MenuHandle, "IngameMenu_Menu16" ,"Reset Statistics");
  5292. AddMenuItem(MenuHandle, "IngameMenu_Menu14", "VAC Cheaterlist");
  5293. AddMenuItem(MenuHandle, "IngameMenu_Menu15", "Display Help");
  5294. }
  5295.  
  5296. SetMenuPagination(MenuHandle, 8);
  5297. }
  5298.  
  5299.  
  5300. public CreateGameMEMenuAuto(&Handle: MenuHandle)
  5301. {
  5302. MenuHandle = CreateMenu(gameMEAutoCommandHandler, MenuAction_Display | MenuAction_DisplayItem | MenuAction_Select | MenuAction_Cancel);
  5303.  
  5304. SetMenuTitle(MenuHandle, "gameME - Auto-Ranking");
  5305.  
  5306. AddMenuItem(MenuHandle, "AutoMenu_Menu1", "Enable on round-start");
  5307. AddMenuItem(MenuHandle, "AutoMenu_Menu2", "Enable on round-end");
  5308. AddMenuItem(MenuHandle, "AutoMenu_Menu3", "Enable on player death");
  5309. AddMenuItem(MenuHandle, "AutoMenu_Menu4", "Disable");
  5310.  
  5311. SetMenuPagination(MenuHandle, 8);
  5312. }
  5313.  
  5314.  
  5315. public CreateGameMEMenuEvents(&Handle: MenuHandle)
  5316. {
  5317. MenuHandle = CreateMenu(gameMEEventsCommandHandler, MenuAction_Display | MenuAction_DisplayItem | MenuAction_Select | MenuAction_Cancel);
  5318.  
  5319. SetMenuTitle(MenuHandle, "gameME - Console Events");
  5320.  
  5321. AddMenuItem(MenuHandle, "ConsoleMenu_Menu1", "Enable Events");
  5322. AddMenuItem(MenuHandle, "ConsoleMenu_Menu2", "Disable Events");
  5323. AddMenuItem(MenuHandle, "ConsoleMenu_Menu3", "Enable Global Chat");
  5324. AddMenuItem(MenuHandle, "ConsoleMenu_Menu4", "Disable Global Chat");
  5325.  
  5326. SetMenuPagination(MenuHandle, 8);
  5327. }
  5328.  
  5329.  
  5330. make_player_command(client, String: player_command[192])
  5331. {
  5332. if (client > 0) {
  5333. log_player_event(client, "say", player_command);
  5334. }
  5335. }
  5336.  
  5337.  
  5338. public gameMEMainCommandHandler(Handle:menu, MenuAction:action, param1, param2)
  5339. {
  5340. if (action == MenuAction_DisplayItem) {
  5341.  
  5342. decl String: info[64];
  5343. GetMenuItem(menu, param2, info, sizeof(info), _, "", 0);
  5344.  
  5345. decl String: buffer[255];
  5346. Format(buffer, sizeof(buffer), "%T", info, param1);
  5347.  
  5348. return RedrawMenuItem(buffer);
  5349.  
  5350. } else if (action == MenuAction_Display) {
  5351.  
  5352. decl String: buffer[255];
  5353. Format(buffer, sizeof(buffer), "%T", "IngameMenu_Caption", param1);
  5354.  
  5355. new Handle: panel = Handle: param2;
  5356. SetPanelTitle(panel, buffer);
  5357.  
  5358. } else if (action == MenuAction_Select) {
  5359.  
  5360. if (IsClientInGame(param1)) {
  5361. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  5362. switch (param2) {
  5363. case 0 :
  5364. make_player_command(param1, "/rank");
  5365. case 1 :
  5366. make_player_command(param1, "/next");
  5367. case 2 :
  5368. make_player_command(param1, "/top10");
  5369. case 3 :
  5370. DisplayMenu(gameme_plugin[menu_auto], param1, MENU_TIME_FOREVER);
  5371. case 4 :
  5372. DisplayMenu(gameme_plugin[menu_events], param1, MENU_TIME_FOREVER);
  5373. case 5 :
  5374. make_player_command(param1, "/gameme_hideranking");
  5375. case 6 :
  5376. make_player_command(param1, "/gameme_reset");
  5377. }
  5378. } else {
  5379. switch (param2) {
  5380. case 0 :
  5381. make_player_command(param1, "/rank");
  5382. case 1 :
  5383. make_player_command(param1, "/next");
  5384. case 2 :
  5385. make_player_command(param1, "/top10");
  5386. case 3 :
  5387. make_player_command(param1, "/clans");
  5388. case 4 :
  5389. make_player_command(param1, "/status");
  5390. case 5 :
  5391. make_player_command(param1, "/statsme");
  5392. case 6 :
  5393. DisplayMenu(gameme_plugin[menu_auto], param1, MENU_TIME_FOREVER);
  5394. case 7 :
  5395. DisplayMenu(gameme_plugin[menu_events], param1, MENU_TIME_FOREVER);
  5396. case 8 :
  5397. make_player_command(param1, "/weapons");
  5398. case 9 :
  5399. make_player_command(param1, "/accuracy");
  5400. case 10 :
  5401. make_player_command(param1, "/targets");
  5402. case 11 :
  5403. make_player_command(param1, "/kills");
  5404. case 12 :
  5405. make_player_command(param1, "/gameme_hideranking");
  5406. case 13 :
  5407. make_player_command(param1, "/gameme_reset");
  5408. case 14 :
  5409. make_player_command(param1, "/cheaters");
  5410. case 15 :
  5411. make_player_command(param1, "/help");
  5412.  
  5413.  
  5414. }
  5415. }
  5416. }
  5417. }
  5418.  
  5419. return 0;
  5420. }
  5421.  
  5422.  
  5423. public gameMEAutoCommandHandler(Handle:menu, MenuAction:action, param1, param2)
  5424. {
  5425. if (action == MenuAction_DisplayItem) {
  5426.  
  5427. decl String: info[64];
  5428. GetMenuItem(menu, param2, info, sizeof(info), _, "", 0);
  5429.  
  5430. decl String: buffer[255];
  5431. Format(buffer, sizeof(buffer), "%T", info, param1);
  5432.  
  5433. return RedrawMenuItem(buffer);
  5434.  
  5435. } else if (action == MenuAction_Display) {
  5436.  
  5437. decl String: buffer[255];
  5438. Format(buffer, sizeof(buffer), "%T", "IngameMenu_Caption", param1);
  5439.  
  5440. new Handle: panel = Handle: param2;
  5441. SetPanelTitle(panel, buffer);
  5442.  
  5443. } else if (action == MenuAction_Select) {
  5444.  
  5445. if (IsClientInGame(param1)) {
  5446. switch (param2) {
  5447. case 0 :
  5448. make_player_command(param1, "/gameme_auto start rank");
  5449. case 1 :
  5450. make_player_command(param1, "/gameme_auto end rank");
  5451. case 2 :
  5452. make_player_command(param1, "/gameme_auto kill rank");
  5453. case 3 :
  5454. make_player_command(param1, "/gameme_auto clear");
  5455. }
  5456. }
  5457. }
  5458.  
  5459. return 0;
  5460. }
  5461.  
  5462.  
  5463. public gameMEEventsCommandHandler(Handle:menu, MenuAction:action, param1, param2)
  5464. {
  5465. if (action == MenuAction_DisplayItem) {
  5466.  
  5467. decl String: info[64];
  5468. GetMenuItem(menu, param2, info, sizeof(info), _, "", 0);
  5469.  
  5470. decl String: buffer[255];
  5471. Format(buffer, sizeof(buffer), "%T", info, param1);
  5472.  
  5473. return RedrawMenuItem(buffer);
  5474.  
  5475. } else if (action == MenuAction_Display) {
  5476.  
  5477. decl String: buffer[255];
  5478. Format(buffer, sizeof(buffer), "%T", "IngameMenu_Caption", param1);
  5479.  
  5480. new Handle: panel = Handle: param2;
  5481. SetPanelTitle(panel, buffer);
  5482.  
  5483. } else if (action == MenuAction_Select) {
  5484.  
  5485. if (IsClientInGame(param1)) {
  5486. switch (param2) {
  5487. case 0 :
  5488. make_player_command(param1, "/gameme_display 1");
  5489. case 1 :
  5490. make_player_command(param1, "/gameme_display 0");
  5491. case 2 :
  5492. make_player_command(param1, "/gameme_chat 1");
  5493. case 3 :
  5494. make_player_command(param1, "/gameme_chat 0");
  5495. }
  5496. }
  5497. }
  5498.  
  5499. return 0;
  5500. }
  5501.  
  5502.  
  5503. //
  5504. //
  5505. // Third Party Addons
  5506. //
  5507. //
  5508.  
  5509.  
  5510. /*
  5511. *
  5512. * Advanced Logging for
  5513. * Left 4 Dead,
  5514. * Left 4 Dead 2,
  5515. * Team Fortress 2,
  5516. * Insurgency,
  5517. * Half-Life 2: Deathmatch
  5518. * Copyright (C) 2011 Nicholas Hastings (psychonic)
  5519. *
  5520. * This program is free software; you can redistribute it and/or
  5521. * modify it under the terms of the GNU General Public License
  5522. * as published by the Free Software Foundation; either version 2
  5523. * of the License, or (at your option) any later version.
  5524. *
  5525. * This program is distributed in the hope that it will be useful,
  5526. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5527. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5528. * GNU General Public License for more details.
  5529. *
  5530. * You should have received a copy of the GNU General Public License
  5531. * along with this program; if not, write to the Free Software
  5532. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  5533. */
  5534.  
  5535.  
  5536. public Event_L4DRescueSurvivor(Handle: event, const String: name[], bool:dontBroadcast)
  5537. {
  5538. new player = GetClientOfUserId(GetEventInt(event, "rescuer"));
  5539. if (player > 0) {
  5540. log_player_event(player, "triggered", "rescued_survivor");
  5541. }
  5542. }
  5543.  
  5544.  
  5545. public Event_L4DHeal(Handle: event, const String: name[], bool:dontBroadcast)
  5546. {
  5547. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5548. if ((player > 0) && (player != GetClientOfUserId(GetEventInt(event, "subject")))) {
  5549. log_player_event(player, "triggered", "healed_teammate");
  5550. }
  5551. }
  5552.  
  5553.  
  5554. public Event_L4DRevive(Handle: event, const String: name[], bool:dontBroadcast)
  5555. {
  5556. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5557. if (player > 0) {
  5558. log_player_event(player, "triggered", "revived_teammate");
  5559. }
  5560. }
  5561.  
  5562.  
  5563. public Event_L4DStartleWitch(Handle: event, const String: name[], bool:dontBroadcast)
  5564. {
  5565. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5566. if ((player > 0) && ((gameme_plugin[mod_id] != MOD_L4DII) || (GetEventBool(event, "first")))) {
  5567. log_player_event(player, "triggered", "startled_witch");
  5568. }
  5569. }
  5570.  
  5571.  
  5572. public Event_L4DPounce(Handle: event, const String: name[], bool:dontBroadcast)
  5573. {
  5574. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5575. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5576.  
  5577. if (victim > 0) {
  5578. log_player_player_event(player, victim, "triggered", "pounce");
  5579. } else {
  5580. log_player_event(player, "triggered", "pounce");
  5581. }
  5582. }
  5583.  
  5584.  
  5585. public Event_L4DBoomered(Handle: event, const String: name[], bool:dontBroadcast)
  5586. {
  5587. new player = GetClientOfUserId(GetEventInt(event, "attacker"));
  5588. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  5589.  
  5590. if ((player > 0) && ((gameme_plugin[mod_id] != MOD_L4DII) || (GetEventBool(event, "by_boomer")))) {
  5591. if (victim > 0) {
  5592. log_player_player_event(player, victim, "triggered", "vomit");
  5593. } else {
  5594. log_player_event(player, "triggered", "vomit");
  5595. }
  5596. }
  5597. }
  5598.  
  5599.  
  5600. public Event_L4DFF(Handle: event, const String: name[], bool:dontBroadcast)
  5601. {
  5602. new player = GetClientOfUserId(GetEventInt(event, "attacker"));
  5603. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5604.  
  5605. if ((player > 0) && (player == GetClientOfUserId(GetEventInt(event, "guilty")))) {
  5606. if (victim > 0) {
  5607. log_player_player_event(player, victim, "triggered", "friendly_fire");
  5608. } else {
  5609. log_player_event(player, "triggered", "friendly_fire");
  5610. }
  5611. }
  5612. }
  5613.  
  5614.  
  5615. public Event_L4DWitchKilled(Handle: event, const String: name[], bool:dontBroadcast)
  5616. {
  5617. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5618. if ((player > 0) && (GetEventBool(event, "oneshot"))) {
  5619. log_player_event(player, "triggered", "cr0wned");
  5620. }
  5621. }
  5622.  
  5623. public Event_L4DDefib(Handle: event, const String: name[], bool:dontBroadcast)
  5624. {
  5625. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5626. if (player > 0) {
  5627. log_player_event(player, "triggered", "defibrillated_teammate");
  5628. }
  5629. }
  5630.  
  5631. public Event_L4DAdrenaline(Handle: event, const String: name[], bool:dontBroadcast)
  5632. {
  5633. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5634. if (player > 0) {
  5635. log_player_event(player, "triggered", "used_adrenaline");
  5636. }
  5637. }
  5638.  
  5639. public Event_L4DPills(Handle: event, const String: name[], bool:dontBroadcast)
  5640. {
  5641. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5642. if (player > 0) {
  5643. log_player_event(player, "triggered", "used_pills");
  5644. }
  5645. }
  5646.  
  5647. public Event_L4DUpgrade(Handle: event, const String: name[], bool:dontBroadcast)
  5648. {
  5649. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5650. if (player > 0) {
  5651. log_player_event(player, "triggered", "upgrade_pack_used");
  5652. }
  5653. }
  5654.  
  5655. public Event_L4DIncap(Handle: event, const String: name[], bool:dontBroadcast)
  5656. {
  5657. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5658. if (player > 0) {
  5659. log_player_event(player, "triggered", "player_incapacitated");
  5660. }
  5661. }
  5662.  
  5663. public Event_L4DShove(Handle: event, const String: name[], bool:dontBroadcast)
  5664. {
  5665. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5666. if (player > 0) {
  5667. log_player_event(player, "triggered", "melee_kill");
  5668. }
  5669. }
  5670.  
  5671. public Event_L4DBreak(Handle: event, const String: name[], bool:dontBroadcast)
  5672. {
  5673. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5674. if (player > 0) {
  5675. log_player_event(player, "triggered", "break_breakable");
  5676. }
  5677. }
  5678.  
  5679. public Event_L4DCarTrig(Handle: event, const String: name[], bool:dontBroadcast)
  5680. {
  5681. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5682. if (player > 0) {
  5683. log_player_event(player, "triggered", "triggered_car_alarm");
  5684. }
  5685. }
  5686.  
  5687. public Event_L4DHskeet(Handle: event, const String: name[], bool:dontBroadcast)
  5688. {
  5689. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  5690. new victim = GetClientOfUserId(GetEventInt(event, "hunter"));
  5691. if ((attacker > 0) && (IsClientInGame(attacker))) {
  5692. if GetEventBool(event, "islunging") {
  5693. if ((victim > 0) && (IsClientInGame(victim))) {
  5694. log_player_event(attacker, victim, "triggered", "hunter_headshot");
  5695. } else {
  5696. log_player_event(attacker, "triggered", "hunter_headshot");
  5697. }
  5698. }
  5699. }
  5700. }
  5701.  
  5702. public Event_L4DInfIg(Handle: event, const String: name[], bool:dontBroadcast)
  5703. {
  5704. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5705. if (player > 0) {
  5706. log_player_event(player, "triggered", "zombie_ignited");
  5707. }
  5708. }
  5709.  
  5710. public Event_L4DScav(Handle: event, const String: name[], bool:dontBroadcast)
  5711. {
  5712. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5713. if (player > 0) {
  5714. log_player_event(player, "triggered", "item_pickup");
  5715. }
  5716. }
  5717.  
  5718. public Event_L4DJockeyRide(Handle: event, const String: name[], bool:dontBroadcast)
  5719. {
  5720. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5721. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5722.  
  5723. if (player > 0) {
  5724. if (victim > 0) {
  5725. log_player_player_event(player, victim, "triggered", "jockey_ride");
  5726. } else {
  5727. log_player_event(player, "triggered", "jockey_ride");
  5728. }
  5729. }
  5730. }
  5731.  
  5732. public Event_L4DChargerPummelStart(Handle: event, const String: name[], bool:dontBroadcast)
  5733. {
  5734. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5735. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5736.  
  5737. if (player > 0) {
  5738. if (victim > 0) {
  5739. log_player_player_event(player, victim, "triggered", "charger_pummel");
  5740. } else {
  5741. log_player_event(player, "triggered", "charger_pummel");
  5742. }
  5743. }
  5744. }
  5745.  
  5746.  
  5747. public Event_L4DVomitBombTank(Handle: event, const String: name[], bool:dontBroadcast)
  5748. {
  5749. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5750. if (player > 0) {
  5751. log_player_event(player, "triggered", "bilebomb_tank");
  5752. }
  5753. }
  5754.  
  5755.  
  5756. public Event_L4DScavengeEnd(Handle: event, const String: name[], bool:dontBroadcast)
  5757. {
  5758. new team_index = GetEventInt(event, "winners");
  5759. if (strcmp(team_list[team_index], "") != 0) {
  5760. log_team_event(team_list[team_index], "scavenge_win");
  5761. }
  5762. }
  5763.  
  5764.  
  5765. public Event_L4DVersusEnd(Handle: event, const String: name[], bool:dontBroadcast)
  5766. {
  5767. new team_index = GetEventInt(event, "winners");
  5768. if (strcmp(team_list[team_index], "") != 0) {
  5769. log_team_event(team_list[team_index], "versus_win");
  5770. }
  5771. }
  5772.  
  5773.  
  5774. public Event_L4dChargerKilled(Handle: event, const String: name[], bool:dontBroadcast)
  5775. {
  5776. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  5777. new victim = GetClientOfUserId(GetEventInt(event, "charger"));
  5778. if ((attacker > 0) && (IsClientInGame(attacker))) {
  5779. if (GetEventBool(event, "melee") && GetEventBool(event, "charging")) {
  5780. if ((victim > 0) && (IsClientInGame(victim))) {
  5781. log_player_player_event(attacker, victim, "triggered", "level_a_charge");
  5782. } else {
  5783. log_player_event(attacker, "triggered", "level_a_charge");
  5784. }
  5785. }
  5786. }
  5787. }
  5788.  
  5789.  
  5790. public Event_L4DAward(Handle: event, const String: name[], bool:dontBroadcast)
  5791. {
  5792. // "userid" "short" // player who earned the award
  5793. // "entityid" "long" // client likes ent id
  5794. // "subjectentid" "long" // entity id of other party in the award, if any
  5795. // "award" "short" // id of award earned
  5796.  
  5797. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5798. if (player > 0) {
  5799. switch (GetEventInt(event, "award")) {
  5800. case 21:
  5801. log_player_event(player, "triggered", "hunter_punter");
  5802. case 27:
  5803. log_player_event(player, "triggered", "tounge_twister");
  5804. case 67:
  5805. log_player_event(player, "triggered", "protect_teammate");
  5806. case 80:
  5807. log_player_event(player, "triggered", "no_death_on_tank");
  5808. case 136:
  5809. log_player_event(player, "triggered", "killed_all_survivors");
  5810. }
  5811. }
  5812. }
  5813.  
  5814.  
  5815. public Event_TF2StealSandvich(Handle: event, const String: name[], bool:dontBroadcast)
  5816. {
  5817. // "owner" "short"
  5818. // "target" "short"
  5819.  
  5820. new owner = GetClientOfUserId(GetEventInt(event, "owner"));
  5821. new target = GetClientOfUserId(GetEventInt(event, "target"));
  5822.  
  5823. if ((owner > 0) && (target > 0)) {
  5824. log_player_player_event(target, owner, "triggered", "steal_sandvich");
  5825. }
  5826. }
  5827.  
  5828.  
  5829. public Event_TF2Stunned(Handle: event, const String: name[], bool:dontBroadcast)
  5830. {
  5831. // "stunner" "short"
  5832. // "victim" "short"
  5833. // "victim_capping" "bool"
  5834. // "big_stun" "bool"
  5835.  
  5836. new stunner = GetClientOfUserId(GetEventInt(event, "stunner"));
  5837. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5838. if ((stunner > 0) && (victim > 0)) {
  5839.  
  5840. log_player_player_event(stunner, victim, "triggered", "stun");
  5841. if ((GetEntityFlags(victim) & (FL_ONGROUND | FL_INWATER)) == 0) {
  5842. log_player_event(stunner, "triggered", "airshot_stun");
  5843. }
  5844. }
  5845. }
  5846.  
  5847.  
  5848. public Action: Event_TF2Jarated(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
  5849. {
  5850. new client = BfReadByte(bf);
  5851. new victim = BfReadByte(bf);
  5852.  
  5853. if ((client > 0) && (victim > 0) && (IsClientInGame(client)) && (IsClientInGame(victim))) {
  5854. if (TF2_IsPlayerInCondition(victim, TFCond_Jarated)) {
  5855. log_player_player_event(client, victim, "triggered", "jarate");
  5856. } else if (TF2_IsPlayerInCondition(victim, TFCond_Milked)) {
  5857. log_player_player_event(client, victim, "triggered", "madmilk");
  5858. }
  5859. }
  5860. return Plugin_Continue;
  5861. }
  5862.  
  5863.  
  5864. public Action: Event_TF2ShieldBlocked(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
  5865. {
  5866. new victim = BfReadByte(bf);
  5867. new client = BfReadByte(bf);
  5868.  
  5869. if ((client > 0) && (victim > 0)) {
  5870. log_player_player_event(client, victim, "triggered", "shield_blocked");
  5871. }
  5872. return Plugin_Continue;
  5873. }
  5874.  
  5875.  
  5876. public Action: Event_TF2SoundHook(clients[64], &numClients, String: sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags)
  5877. {
  5878. if ((entity <= MaxClients) &&(clients[0] == entity) && (tf2_players[entity][player_class] == TFClass_Heavy) && (StrEqual(sample, "vo/SandwichEat09.wav"))) {
  5879.  
  5880. switch (tf2_players[entity][player_loadout0][1]) {
  5881. case TF2_LUNCHBOX_CHOCOLATE: {
  5882. log_player_event(entity, "triggered", "dalokohs");
  5883. new Float: time = GetGameTime();
  5884. if ((time - tf2_players[entity][dalokohs]) > 30) {
  5885. log_player_event(entity, "triggered", "dalokohs_healthboost");
  5886. }
  5887. tf2_players[entity][dalokohs] = time;
  5888. if (GetClientHealth(entity) < 350) {
  5889. log_player_event(entity, "triggered", "dalokohs_healself");
  5890. }
  5891. }
  5892. case TF2_LUNCHBOX_STEAK: {
  5893. log_player_event(entity, "triggered", "steak");
  5894. }
  5895. default: {
  5896. log_player_event(entity, "triggered", "sandvich");
  5897. if (GetClientHealth(entity) < 300) {
  5898. log_player_event(entity, "triggered", "sandvich_healself");
  5899. }
  5900. }
  5901. }
  5902.  
  5903.  
  5904. }
  5905. return Plugin_Continue;
  5906. }
  5907.  
  5908.  
  5909. public Event_TF2WinPanel(Handle: event, const String: name[], bool:dontBroadcast)
  5910. {
  5911. new player1 = GetEventInt(event, "player_1");
  5912. new player2 = GetEventInt(event, "player_2");
  5913. new player3 = GetEventInt(event, "player_3");
  5914.  
  5915. if ((player1 > 0) && (IsClientInGame(player1))) {
  5916. log_player_event(player1, "triggered", "mvp1");
  5917. }
  5918. if ((player2 > 0) && (IsClientInGame(player2))) {
  5919. log_player_event(player2, "triggered", "mvp2");
  5920. }
  5921. if ((player3 > 0) && (IsClientInGame(player3))) {
  5922. log_player_event(player3, "triggered", "mvp3");
  5923. }
  5924. }
  5925.  
  5926.  
  5927. public Event_TF2EscortScore(Handle: event, const String: name[], bool:dontBroadcast)
  5928. {
  5929. new player = GetEventInt(event, "player");
  5930. if (player > 0) {
  5931. log_player_event(player, "triggered", "escort_score");
  5932. }
  5933. }
  5934.  
  5935.  
  5936. public Event_TF2DeployBuffBanner(Handle: event, const String: name[], bool:dontBroadcast)
  5937. {
  5938. new player = GetClientOfUserId(GetEventInt(event, "buff_owner"));
  5939. if (player > 0) {
  5940. log_player_event(player, "triggered", "buff_deployed");
  5941. }
  5942.  
  5943. }
  5944.  
  5945.  
  5946. public Event_TF2MedicDefended(Handle: event, const String: name[], bool:dontBroadcast)
  5947. {
  5948. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5949. if (player > 0) {
  5950. log_player_event(player, "triggered", "defended_medic");
  5951. }
  5952. }
  5953.  
  5954.  
  5955. public Action: Event_TF2ObjectDestroyedPre(Handle: event, const String: name[], bool:dontBroadcast)
  5956. {
  5957. if (GetEntProp(GetEventInt(event, "index"), Prop_Send, "m_bMiniBuilding", 1)) {
  5958. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  5959. new userid = GetEventInt(event, "userid");
  5960. new victim = GetClientOfUserId(userid);
  5961.  
  5962. if ((attacker > 0) && (victim > 0) && (attacker <= MAXPLAYERS) && (victim <= MAXPLAYERS) && (IsClientInGame(victim)) && (IsClientInGame(attacker))) {
  5963. decl String: weapon_str[32];
  5964. GetEventString(event, "weapon", weapon_str, 32);
  5965. new Float: player_origin[3];
  5966. GetClientAbsOrigin(attacker, player_origin);
  5967. LogToGame("\"%L\" %s \"%s\" (object \"%s\") (weapon \"%s\") (objectowner \"%L\") (attacker_position \"%d %d %d\")", attacker, "triggered", "killedobject", "OBJ_SENTRYGUN_MINI", weapon_str, victim, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));
  5968. }
  5969. tf2_data[block_next_logging] = true;
  5970. }
  5971. return Plugin_Continue;
  5972. }
  5973.  
  5974.  
  5975. public Action: Event_TF2PlayerBuiltObjectPre(Handle: event, const String: name[], bool:dontBroadcast)
  5976. {
  5977. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  5978. if (client > 0) {
  5979. if (tf2_players[client][carry_object]) {
  5980. tf2_players[client][carry_object] = false;
  5981. tf2_data[block_next_logging] = true;
  5982. } else {
  5983. if (GetEntProp(GetEventInt(event, "index"), Prop_Send, "m_bMiniBuilding", 1)) {
  5984. if ((client > 0) && (client <= MAXPLAYERS) && (IsClientInGame(client))) {
  5985. new Float: player_origin[3];
  5986. GetClientAbsOrigin(client, player_origin);
  5987. LogToGame("\"%L\" %s \"%s\" (object \"%s\") (position \"%d %d %d\")", client, "triggered", "builtobject", "OBJ_SENTRYGUN_MINI", RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));
  5988. }
  5989. tf2_data[block_next_logging] = true;
  5990. }
  5991. }
  5992. }
  5993. return Plugin_Continue;
  5994. }
  5995.  
  5996.  
  5997. public Event_TF2PlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  5998. {
  5999. new Float: time = GetGameTime();
  6000. new userid = GetEventInt(event, "userid");
  6001. new client = GetClientOfUserId(userid);
  6002. new TFClassType: spawn_class = TFClassType: GetEventInt(event, "class");
  6003.  
  6004. tf2_players[client][jump_status] = TF2_JUMP_NONE;
  6005. dump_player_data(client);
  6006.  
  6007. if (time == tf2_players[client][object_removed]) {
  6008. new obj_type;
  6009. decl String: obj_name[24];
  6010. while (PopStackCell(tf2_players[client][object_list], obj_type)) {
  6011. switch (obj_type) {
  6012. case TF2_OBJ_DISPENSER:
  6013. obj_name = "OBJ_DISPENSER";
  6014. case TF2_OBJ_TELEPORTER:
  6015. obj_name = "OBJ_TELEPORTER";
  6016. case TF2_OBJ_SENTRYGUN:
  6017. obj_name = "OBJ_SENTRYGUN";
  6018. case TF2_OBJ_SENTRYGUN_MINI:
  6019. obj_name = "OBJ_SENTRYGUN_MINI";
  6020. default:
  6021. continue;
  6022. }
  6023. new Float: player_origin[3];
  6024. GetClientAbsOrigin(client, player_origin);
  6025. LogToGame("\"%L\" %s \"%s\" (object \"%s\") (weapon \"%s\") (objectowner \"%L\") (attacker_position \"%d %d %d\")", client, "triggered", "killedobject", obj_name, "pda_engineer", client, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));
  6026. }
  6027. }
  6028.  
  6029. tf2_players[client][player_class] = spawn_class;
  6030. tf2_players[client][dalokohs] = -30.0;
  6031. }
  6032.  
  6033.  
  6034. public Event_TF2RoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  6035. {
  6036. if (gameme_plugin[live_active] == 1) {
  6037. for (new i = 0; (i <= MAXPLAYERS); i++) {
  6038. gameme_players[i][palive] = 1;
  6039. }
  6040. }
  6041. }
  6042.  
  6043.  
  6044. public Event_TF2RoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  6045. {
  6046. for (new i = 1; (i <= MaxClients); i++) {
  6047. dump_player_data(i);
  6048. }
  6049. }
  6050.  
  6051.  
  6052. public Event_TF2ObjectRemoved(Handle: event, const String: name[], bool:dontBroadcast)
  6053. {
  6054. new Float: time = GetGameTime();
  6055. new userid = GetEventInt(event, "userid");
  6056. new client = GetClientOfUserId(userid);
  6057.  
  6058. if (time != tf2_players[client][object_removed]) {
  6059. tf2_players[client][object_removed] = time;
  6060. while (PopStack(tf2_players[client][object_list])) {
  6061. continue;
  6062. }
  6063. }
  6064. new obj_type = GetEventInt(event, "objecttype");
  6065. new obj_index = GetEventInt(event, "index");
  6066. if ((IsValidEdict(obj_index)) && (GetEntProp(GetEventInt(event, "index"), Prop_Send, "m_bMiniBuilding", 1))) {
  6067. obj_type = TF2_OBJ_SENTRYGUN_MINI;
  6068. }
  6069. PushStackCell(tf2_players[client][object_list], obj_type);
  6070. }
  6071.  
  6072.  
  6073. public Event_TF2PostInvApp(Handle: event, const String: name[], bool:dontBroadcast)
  6074. {
  6075. CreateTimer(0.2, check_player_loadout, GetEventInt(event, "userid"));
  6076. }
  6077.  
  6078.  
  6079. public Action: check_player_loadout(Handle: timer, any: userid)
  6080. {
  6081. new client = GetClientOfUserId(userid);
  6082. if ((client == 0) || (!IsClientInGame(client))) {
  6083. return Plugin_Stop;
  6084. }
  6085.  
  6086. new bool: is_new_loadout = false;
  6087. for (new check_slot = 0; check_slot <= 5; check_slot++) {
  6088. if ((tf2_players[client][player_loadout1][check_slot] != 0) && (IsValidEntity(tf2_players[client][player_loadout1][check_slot]))) {
  6089. continue;
  6090. }
  6091. new entity = GetPlayerWeaponSlot(client, check_slot);
  6092. if (entity == -1) {
  6093. if ((gameme_plugin[sdkhook_available]) && (check_slot < 3) && ((tf2_players[client][player_class] == TFClass_Soldier) || (tf2_players[client][player_class] == TFClass_DemoMan))) {
  6094. tf2_players[client][player_loadout1][check_slot] = -1;
  6095. continue;
  6096. }
  6097. if (tf2_players[client][player_loadout0][check_slot] == -1) {
  6098. continue;
  6099. }
  6100. tf2_players[client][player_loadout0][check_slot] = -1;
  6101. tf2_players[client][player_loadout1][check_slot] = -1;
  6102. is_new_loadout = true;
  6103. } else {
  6104. new item_index = GetEntProp(entity, Prop_Send, "m_iItemDefinitionIndex");
  6105. if (tf2_players[client][player_loadout0][check_slot] != item_index) {
  6106. tf2_players[client][player_loadout0][check_slot] = item_index;
  6107. is_new_loadout = true;
  6108. }
  6109. tf2_players[client][player_loadout1][check_slot] = EntIndexToEntRef(entity);
  6110. }
  6111. }
  6112.  
  6113. if (gameme_plugin[sdkhook_available]) {
  6114. if (is_new_loadout) {
  6115. tf2_players[client][player_loadout_updated] = true;
  6116. }
  6117. CreateTimer(0.2, log_weapon_loadout, userid);
  6118. } else {
  6119. if (is_new_loadout) {
  6120. log_weapon_loadout(INVALID_HANDLE, userid);
  6121. }
  6122. }
  6123. return Plugin_Stop;
  6124. }
  6125.  
  6126.  
  6127. public Action: log_weapon_loadout(Handle: timer, any: userid)
  6128. {
  6129. new client = GetClientOfUserId(userid);
  6130. if ((client > 0) && (IsClientInGame(client))) {
  6131. for (new i = 0; i < TF2_MAX_LOADOUT_SLOTS; i++) {
  6132. if ((tf2_players[client][player_loadout0][i] != -1) && (!IsValidEntity(tf2_players[client][player_loadout1][i])) || (tf2_players[client][player_loadout1][i] == 0)) {
  6133. tf2_players[client][player_loadout0][i] = -1;
  6134. tf2_players[client][player_loadout1][i] = -1;
  6135. tf2_players[client][player_loadout_updated] = true;
  6136. }
  6137. }
  6138. if (tf2_players[client][player_loadout_updated] == false) {
  6139. return Plugin_Stop;
  6140. }
  6141. tf2_players[client][player_loadout_updated] = false;
  6142. LogToGame("\"%L\" %s \"%s\" (primary \"%d\") (secondary \"%d\") (melee \"%d\") (pda \"%d\") (pda2 \"%d\") (building \"%d\") (head \"%d\") (misc \"%d\")", client, "triggered", "player_loadout", tf2_players[client][player_loadout0][0], tf2_players[client][player_loadout0][1], tf2_players[client][player_loadout0][2], tf2_players[client][player_loadout0][3], tf2_players[client][player_loadout0][4], tf2_players[client][player_loadout0][5], tf2_players[client][player_loadout0][6], tf2_players[client][player_loadout0][7]);
  6143. }
  6144. return Plugin_Stop;
  6145. }
  6146.  
  6147.  
  6148. public Action: OnTF2TakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
  6149. {
  6150. if ((attacker > 0) && (attacker <= MaxClients) && (attacker != victim) && (inflictor > MaxClients) && (damage > 0.0) && (IsValidEntity(inflictor)) && ((GetEntityFlags(victim) & (FL_ONGROUND | FL_INWATER)) == 0)) {
  6151. decl String: weapon_str[64];
  6152. GetEdictClassname(inflictor, weapon_str, 64);
  6153. if ((weapon_str[3] == 'p') && (weapon_str[4] == 'r')) {
  6154. switch(weapon_str[14]) {
  6155. case 'r': {
  6156. log_player_event(attacker, "triggered", "airshot_rocket");
  6157. if (tf2_players[attacker][jump_status] == TF2_JUMP_ROCKET) {
  6158. log_player_event(attacker, "triggered", "air2airshot_rocket");
  6159. }
  6160. }
  6161. case 'p': {
  6162. if (weapon_str[18] != 0) {
  6163. log_player_event(attacker, "triggered", "airshot_sticky");
  6164. if (tf2_players[attacker][jump_status] == TF2_JUMP_STICKY) {
  6165. log_player_event(attacker, "triggered", "air2airshot_sticky");
  6166. }
  6167. } else {
  6168. log_player_event(attacker, "triggered", "airshot_pipebomb");
  6169. if (tf2_players[attacker][jump_status] == TF2_JUMP_STICKY) {
  6170. log_player_event(attacker, "triggered", "air2airshot_pipebomb");
  6171. }
  6172. }
  6173. }
  6174. case 'a': {
  6175. log_player_event(attacker, "triggered", "airshot_arrow");
  6176. }
  6177. case 'f': {
  6178. if (damage > 10.0) {
  6179. log_player_event(attacker, "triggered", "airshot_flare");
  6180. }
  6181. }
  6182. }
  6183. }
  6184. }
  6185. return Plugin_Continue;
  6186. }
  6187.  
  6188.  
  6189. public OnTF2TakeDamage_Post(victim, attacker, inflictor, Float:damage, damagetype)
  6190. {
  6191. if ((attacker > 0) && (attacker <= MaxClients)) {
  6192. new weapon_index = -1;
  6193. new idamage = RoundFloat(damage);
  6194. decl String: weapon_str[64];
  6195.  
  6196. if (inflictor <= MaxClients) {
  6197. if (damagetype & DMG_BURN) {
  6198. return;
  6199. }
  6200. if ((inflictor == attacker) && (damagetype & 1) && (damage == 1000.0)) {
  6201. return;
  6202. }
  6203. GetClientWeapon(attacker, weapon_str, 64);
  6204. weapon_index = get_tf2_weapon_index(weapon_str[TF2_WEAPON_PREFIX_LENGTH], attacker);
  6205. } else if (IsValidEdict(inflictor)) {
  6206. GetEdictClassname(inflictor, weapon_str, 64);
  6207. if (weapon_str[TF2_WEAPON_PREFIX_LENGTH] == 'g') {
  6208. return;
  6209. } else if (weapon_str[3] == 'p') {
  6210. weapon_index = get_tf2_weapon_index(weapon_str, attacker, inflictor);
  6211. } else {
  6212. if ((!(damagetype & DMG_CRUSH)) && (damagetype & DMG_CLUB) && (StrEqual(weapon_str, "tf_weapon_bat_wood"))) {
  6213. weapon_index = get_tf2_weapon_index("ball", attacker);
  6214. } else {
  6215. weapon_index = get_tf2_weapon_index(weapon_str[TF2_WEAPON_PREFIX_LENGTH], attacker);
  6216. }
  6217. }
  6218. }
  6219.  
  6220. if (weapon_index > -1) {
  6221. player_weapons[attacker][weapon_index][wdamage] += idamage;
  6222. player_weapons[attacker][weapon_index][whits]++;
  6223. }
  6224. }
  6225. }
  6226.  
  6227.  
  6228. public Event_TF2RocketJump(Handle:event, const String:name[], bool:dontBroadcast)
  6229. {
  6230. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6231. if (client > 0) {
  6232. new status = tf2_players[client][jump_status];
  6233. if (status == TF2_JUMP_ROCKET_START) {
  6234. tf2_players[client][jump_status] = TF2_JUMP_ROCKET;
  6235. log_player_event(client, "triggered", "rocket_jump");
  6236. } else if (status != TF2_JUMP_ROCKET) {
  6237. tf2_players[client][jump_status] = TF2_JUMP_ROCKET_START;
  6238. }
  6239. }
  6240. }
  6241.  
  6242.  
  6243. public Event_TF2StickyJump(Handle:event, const String:name[], bool:dontBroadcast)
  6244. {
  6245. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6246. if (client > 0) {
  6247. if (tf2_players[client][jump_status] != TF2_JUMP_STICKY) {
  6248. tf2_players[client][jump_status] = TF2_JUMP_STICKY;
  6249. log_player_event(client, "triggered", "sticky_jump");
  6250. }
  6251. }
  6252. }
  6253.  
  6254.  
  6255. public Event_TF2JumpLanded(Handle:event, const String:name[], bool:dontBroadcast)
  6256. {
  6257. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6258. if (client > 0) {
  6259. tf2_players[client][jump_status] = TF2_JUMP_NONE;
  6260.  
  6261. }
  6262. }
  6263.  
  6264.  
  6265. public Event_TF2ObjectDeflected(Handle:event, const String:name[], bool:dontBroadcast)
  6266. {
  6267. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6268. new owner = GetClientOfUserId(GetEventInt(event, "ownerid"));
  6269.  
  6270. if ((client > 0) && (owner > 0)) {
  6271. new weapon_id = GetEventInt(event, "weaponid");
  6272.  
  6273. switch (weapon_id) {
  6274. case TF_WEAPON_NONE: {
  6275. log_player_player_event(client, owner, "triggered", "airblast_player", 1);
  6276. }
  6277. case TF_WEAPON_COMPOUND_BOW: {
  6278. if (gameme_plugin[sdkhook_available]) {
  6279. new weapon_index = get_tf2_weapon_index("deflect_arrow");
  6280. if (weapon_index > -1) {
  6281. player_weapons[client][weapon_index][wshots]++;
  6282. }
  6283. }
  6284. }
  6285. case TF_WEAPON_FLAREGUN: {
  6286. if (gameme_plugin[sdkhook_available]) {
  6287. new weapon_index = get_tf2_weapon_index("deflect_flare");
  6288. if(weapon_index > -1) {
  6289. player_weapons[client][weapon_index][wshots]++;
  6290. }
  6291. }
  6292. }
  6293. case TF_WEAPON_ROCKETLAUNCHER: {
  6294. if (gameme_plugin[sdkhook_available]) {
  6295. new weapon_index = get_tf2_weapon_index("deflect_rocket");
  6296. if(weapon_index > -1) {
  6297. player_weapons[client][weapon_index][wshots]++;
  6298. }
  6299. }
  6300. }
  6301. case TF_WEAPON_DIRECTHIT: {
  6302. if (gameme_plugin[sdkhook_available]) {
  6303. new weapon_index = get_tf2_weapon_index("deflect_rocket");
  6304. if(weapon_index > -1) {
  6305. player_weapons[client][weapon_index][wshots]++;
  6306. }
  6307. }
  6308. }
  6309. case TF_WEAPON_GRENADE_DEMOMAN: {
  6310. if (gameme_plugin[sdkhook_available]) {
  6311. new weapon_index = get_tf2_weapon_index("deflect_promode");
  6312. if(weapon_index > -1) {
  6313. player_weapons[client][weapon_index][wshots]++;
  6314. }
  6315. }
  6316. }
  6317. }
  6318.  
  6319. }
  6320. }
  6321.  
  6322.  
  6323. public OnHL2MPFireBullets(attacker, shots, String: weapon_str[])
  6324. {
  6325. if ((attacker > 0) && (attacker <= MaxClients)) {
  6326. decl String: weapon_name[32];
  6327. GetClientWeapon(attacker, weapon_name, 32);
  6328. new weapon_index = get_weapon_index(hl2mp_weapon_list, MAX_HL2MP_WEAPON_COUNT, weapon_name[7]);
  6329. if (weapon_index > -1) {
  6330. player_weapons[attacker][weapon_index][wshots]++;
  6331. }
  6332. }
  6333. }
  6334.  
  6335.  
  6336. public OnHL2MPTraceAttack(victim, attacker, inflictor, Float: damage, damagetype, ammotype, hitbox, hitgroup)
  6337. {
  6338. if ((hitgroup > 0) && (attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6339. if (IsValidEntity(inflictor)) {
  6340. decl String: inflictorclsname[64];
  6341. if ((GetEntityNetClass(inflictor, inflictorclsname, sizeof(inflictorclsname)) && (strcmp(inflictorclsname, "CCrossbowBolt") == 0))) {
  6342. hl2mp_players[victim][nextbow_hitgroup] = hitgroup;
  6343. return;
  6344. }
  6345. }
  6346. hl2mp_players[victim][next_hitgroup] = hitgroup;
  6347. }
  6348. }
  6349.  
  6350.  
  6351. public OnHL2MPTakeDamage(victim, attacker, inflictor, Float:damage, damagetype)
  6352. {
  6353. if ((attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6354. decl String: weapon_str[32];
  6355. GetClientWeapon(attacker, weapon_str, 32);
  6356. new weapon_index = -1;
  6357.  
  6358. if (IsValidEntity(inflictor)) {
  6359. decl String: inflictorclsname[64];
  6360. if (GetEntityNetClass(inflictor, inflictorclsname, sizeof(inflictorclsname)) && strcmp(inflictorclsname, "CCrossbowBolt") == 0) {
  6361. weapon_index = HL2MP_CROSSBOW;
  6362. }
  6363. }
  6364. if (weapon_index == -1) {
  6365. weapon_index = get_weapon_index(hl2mp_weapon_list, MAX_HL2MP_WEAPON_COUNT, weapon_str[7]);
  6366. }
  6367.  
  6368. new hitgroup = ((weapon_index == HL2MP_CROSSBOW) ? hl2mp_players[victim][nextbow_hitgroup] : hl2mp_players[victim][next_hitgroup]);
  6369. if (hitgroup < 8) {
  6370. hitgroup += LOG_HIT_OFFSET;
  6371. }
  6372.  
  6373. new bool: headshot = ((GetClientHealth(victim) <= 0) && (hitgroup == HITGROUP_HEAD));
  6374. if (weapon_index > -1) {
  6375. player_weapons[attacker][weapon_index][whits]++;
  6376. player_weapons[attacker][weapon_index][wdamage] += RoundToNearest(damage);
  6377. player_weapons[attacker][weapon_index][hitgroup]++;
  6378. if (headshot) {
  6379. player_weapons[attacker][weapon_index][wheadshots]++;
  6380. }
  6381. }
  6382.  
  6383. if (weapon_index == HL2MP_CROSSBOW) {
  6384. hl2mp_players[victim][nextbow_hitgroup] = 0;
  6385. } else {
  6386. hl2mp_players[victim][next_hitgroup] = 0;
  6387. }
  6388.  
  6389. }
  6390. }
  6391.  
  6392.  
  6393. public OnZPSFireBullets(attacker, shots, String: weapon[])
  6394. {
  6395. if ((attacker > 0) && (attacker <= MaxClients)) {
  6396. decl String: weapon_name[32];
  6397. GetClientWeapon(attacker, weapon_name, 32);
  6398. new weapon_index = get_weapon_index(zps_weapon_list, MAX_ZPS_WEAPON_COUNT, weapon_name);
  6399. if (weapon_index > -1) {
  6400. player_weapons[attacker][weapon_index][wshots]++;
  6401. }
  6402. }
  6403. }
  6404.  
  6405.  
  6406. public OnZPSTraceAttack(victim, attacker, inflictor, Float:damage, damagetype, ammotype, hitbox, hitgroup)
  6407. {
  6408. if ((hitgroup > 0) && (attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6409. zps_players[victim][next_hitgroup] = hitgroup;
  6410. }
  6411. }
  6412.  
  6413.  
  6414. public OnZPSTakeDamage(victim, attacker, inflictor, Float:damage, damagetype)
  6415. {
  6416. if ((attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6417. new hitgroup = zps_players[victim][next_hitgroup];
  6418. if (hitgroup < 8) {
  6419. hitgroup += LOG_HIT_OFFSET;
  6420. }
  6421. new bool: headshot = ((GetClientHealth(victim) <= 0) && (hitgroup == HITGROUP_HEAD));
  6422.  
  6423. decl String: weapon_str[32];
  6424. GetClientWeapon(attacker, weapon_str, 32);
  6425. new weapon_index = get_weapon_index(zps_weapon_list, MAX_ZPS_WEAPON_COUNT, weapon_str);
  6426.  
  6427. if (weapon_index > -1) {
  6428. player_weapons[attacker][weapon_index][whits]++;
  6429. player_weapons[attacker][weapon_index][wdamage] += RoundToNearest(damage);
  6430. if (headshot) {
  6431. player_weapons[attacker][weapon_index][wheadshots]++;
  6432. }
  6433. }
  6434. zps_players[victim][next_hitgroup] = 0;
  6435. }
  6436. }
  6437.  
  6438.  
  6439. stock AddPluginServerTag(const String:tag[])
  6440. {
  6441. if ((gameme_plugin[sv_tags] == INVALID_HANDLE) ||
  6442. ((gameme_plugin[engine_version] != Engine_CSS) && (gameme_plugin[engine_version] != Engine_HL2DM) &&
  6443. (gameme_plugin[engine_version] != Engine_DODS) && (gameme_plugin[engine_version] != Engine_TF2) &&
  6444. (gameme_plugin[engine_version] != Engine_NuclearDawn) && (gameme_plugin[engine_version] != Engine_Left4Dead) &&
  6445. (gameme_plugin[engine_version] != Engine_Left4Dead2) && (gameme_plugin[engine_version] != Engine_CSGO) &&
  6446. (gameme_plugin[engine_version] != Engine_Insurgency))) {
  6447. return;
  6448. }
  6449.  
  6450. if (FindStringInArray(gameme_plugin[custom_tags], tag) == -1) {
  6451. PushArrayString(gameme_plugin[custom_tags], tag);
  6452. }
  6453.  
  6454. decl String: current_tags[128];
  6455. GetConVarString(gameme_plugin[sv_tags], current_tags, 128);
  6456. if (StrContains(current_tags, tag) > -1) {
  6457. LogToGame("gameME gameserver tag already exists [%s]", current_tags);
  6458. return;
  6459. }
  6460.  
  6461. decl String: new_tags[128];
  6462. Format(new_tags, sizeof(new_tags), "%s%s%s", current_tags, (current_tags[0] != 0) ? "," : "", tag);
  6463.  
  6464. new flags = GetConVarFlags(gameme_plugin[sv_tags]);
  6465. SetConVarFlags(gameme_plugin[sv_tags], flags & ~FCVAR_NOTIFY);
  6466. gameme_plugin[ignore_next_tag_change] = true;
  6467. SetConVarString(gameme_plugin[sv_tags], new_tags);
  6468. gameme_plugin[ignore_next_tag_change] = false;
  6469. SetConVarFlags(gameme_plugin[sv_tags], flags);
  6470.  
  6471. LogToGame("Added gameME gameserver tag [%s]", new_tags);
  6472. }
  6473.  
  6474.  
  6475. public Event_INSMODPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  6476. {
  6477. // "deathflags" "short"
  6478. // "attacker" "short"
  6479. // "customkill" "short"
  6480. // "lives" "short"
  6481. // "attackerteam" "short"
  6482. // "damagebits" "short"
  6483. // "weapon" "string"
  6484. // "weaponid" "short"
  6485. // "userid" "short"
  6486. // "priority" "short"
  6487. // "team" "short"
  6488. // "y" "float"
  6489. // "x" "float"
  6490. // "z" "float"
  6491. // "assister" "short"
  6492.  
  6493. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  6494. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  6495.  
  6496. if ((victim > 0) && (attacker > 0)) {
  6497. if (attacker != victim) {
  6498. decl String: weapon_str[32];
  6499. GetEventString(event, "weapon", weapon_str, 32);
  6500. ReplaceString(weapon_str, 32, "weapon_", "", false);
  6501.  
  6502. new weapon_index = get_weapon_index(insmod_weapon_list, MAX_INSMOD_WEAPON_COUNT, weapon_str);
  6503. if (weapon_index > -1) {
  6504. player_weapons[attacker][weapon_index][wkills]++;
  6505. player_weapons[victim][weapon_index][wdeaths]++;
  6506. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  6507. player_weapons[attacker][weapon_index][wteamkills]++;
  6508. }
  6509. }
  6510.  
  6511. new assister = GetClientOfUserId(GetEventInt(event, "assister"));
  6512. if ((assister > 0) && (assister != victim)) {
  6513. log_player_player_event(assister, victim, "triggered", "kill_assist");
  6514. }
  6515. }
  6516. dump_player_data(victim);
  6517. }
  6518. }
  6519.  
  6520.  
  6521. public Event_INSMODPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  6522. {
  6523. // "userid" "short"
  6524. // "weapon" "string"
  6525. // "hitgroup" "short"
  6526. // "priority" "short"
  6527. // "attacker" "short"
  6528. // "dmg_health" "short"
  6529. // "health" "byte"
  6530.  
  6531. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  6532. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  6533.  
  6534. if ((attacker > 0) && (attacker != victim)) {
  6535. decl String: weapon_str[32];
  6536. GetEventString(event, "weapon", weapon_str, 32);
  6537. ReplaceString(weapon_str, 32, "weapon_", "", false);
  6538.  
  6539. new weapon_index = get_weapon_index(insmod_weapon_list, MAX_INSMOD_WEAPON_COUNT, weapon_str);
  6540. if (weapon_index > -1) {
  6541. player_weapons[attacker][weapon_index][wshots]++;
  6542. player_weapons[attacker][weapon_index][whits]++;
  6543. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  6544. new hitgroup = GetEventInt(event, "hitgroup");
  6545. if (hitgroup < 8) {
  6546. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  6547. } else {
  6548. player_weapons[attacker][weapon_index][hitgroup]++;
  6549. }
  6550.  
  6551. if (hitgroup == HITGROUP_HEAD) {
  6552. player_weapons[attacker][weapon_index][wheadshots]++;
  6553. if (IsClientInGame(attacker)) {
  6554. log_player_event(attacker, "triggered", "headshot");
  6555. }
  6556. }
  6557. }
  6558. }
  6559. }
  6560.  
  6561.  
  6562. public Event_INSMODEventFired(Handle:event, const String:name[], bool:dontBroadcast)
  6563. {
  6564. // "weaponid" "short"
  6565. // "userid" "short"
  6566. // "shots" "byte"
  6567.  
  6568. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6569. new String: weapon_str[32];
  6570. GetClientWeapon(client, weapon_str, 32);
  6571. ReplaceString(weapon_str, 32, "weapon_", "", false);
  6572.  
  6573. new weapon_index = get_weapon_index(insmod_weapon_list, MAX_INSMOD_WEAPON_COUNT, weapon_str);
  6574. if (weapon_index > -1) {
  6575. player_weapons[client][weapon_index][wshots]++;
  6576. }
  6577.  
  6578. }
  6579.  
  6580.  
  6581. public Event_INSMODPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  6582. {
  6583. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  6584. if (userid > 0) {
  6585. reset_player_data(userid);
  6586. }
  6587. }
  6588.  
  6589.  
  6590. public Event_INSMODRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  6591. {
  6592. for (new i = 1; (i <= MaxClients); i++) {
  6593. dump_player_data(i);
  6594. }
  6595.  
  6596. new team_index = GetEventInt(event, "winner");
  6597. if (team_index > 0) {
  6598. log_team_event(team_list[team_index], "Round_Win");
  6599. }
  6600. }
  6601.  
  6602.  
  6603. /**
  6604. * Insurgency2 Logger/LogFixer
  6605. * Based on SuperLogs by psychonic (https://forums.alliedmods.net/showthread.php?t=99231?t=99231)
  6606. * Author: FZFalzar of Brutus.SG Modded Servers (http://brutus.sg)
  6607. * Updated and maintained by Jared Ballou (http://jballou.com)
  6608. * Version: 1.2.0
  6609. */
  6610.  
  6611.  
  6612.  
  6613. public Event_INSMODPlayerPickSquad(Handle:event, const String:name[], bool:dontBroadcast)
  6614. {
  6615. // "squad_slot" "byte"
  6616. // "squad" "byte"
  6617. // "userid" "short"
  6618. // "class_template" "string"
  6619.  
  6620.  
  6621. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6622.  
  6623. if( client == 0) {
  6624. return;
  6625. }
  6626.  
  6627. decl String: class_template[64];
  6628. GetEventString(event, "class_template", class_template, sizeof(class_template));
  6629. ReplaceString(class_template, sizeof(class_template), "template_", "", false);
  6630. ReplaceString(class_template, sizeof(class_template), "_training", "", false);
  6631. ReplaceString(class_template, sizeof(class_template), "_coop", "", false);
  6632. ReplaceString(class_template, sizeof(class_template), "coop_", "", false);
  6633. ReplaceString(class_template, sizeof(class_template), "_security", "", false);
  6634. ReplaceString(class_template, sizeof(class_template), "_insurgent", "", false);
  6635. ReplaceString(class_template, sizeof(class_template), "_survival", "", false);
  6636.  
  6637. if(!StrEqual(insmod_players[client][last_role], class_template)) {
  6638. LogToGame("\"%L\" changed role to \"%s\"", client, class_template);
  6639. strcopy(insmod_players[client][last_role], 64, class_template);
  6640. }
  6641. }
  6642.  
  6643.  
  6644. public Action: Event_INSMODObjectiveDestroyed(Handle: event, const String: name[], bool: dontBroadcast)
  6645. {
  6646. //"team" "byte"
  6647. //"attacker" "byte"
  6648. //"cp" "short"
  6649. //"index" "short"
  6650. //"type" "byte"
  6651. //"weapon" "string"
  6652. //"weaponid" "short"
  6653. //"assister" "byte"
  6654. //"attackerteam" "byte"
  6655.  
  6656. new client = GetClientOfUserId(GetEventInt(event, "attacker"));
  6657. if ((client > 0) && (client <= MaxClients) && (IsClientInGame(client))) {
  6658. log_player_event(client, "triggered", "obj_destroyed");
  6659. }
  6660. }
  6661.  
  6662.  
  6663. public Action: Event_INSMODControlpointCapped(Handle: event, const String: name[], bool: dontBroadcast)
  6664. {
  6665. // "priority" "short"
  6666. // "cp" "byte"
  6667. // "cappers" "string"
  6668. // "cpname" "string"
  6669. // "team" "byte"
  6670.  
  6671. decl String: cappers[256];
  6672. GetEventString(event, "cappers", cappers, sizeof(cappers));
  6673.  
  6674. for (new i = 0; i < strlen(cappers); i++) {
  6675. new client = cappers[i];
  6676. if ((client > 0) && (client <= MaxClients) && (IsClientInGame(client))) {
  6677. log_player_event(client, "triggered", "obj_captured");
  6678. }
  6679. }
  6680. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement