Advertisement
Guest User

Untitled

a guest
Nov 10th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 229.55 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.8.1"
  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("jockey_ride", Event_L4DJockeyRide);
  1204. HookEvent("charger_pummel_start", Event_L4DChargerPummelStart);
  1205. HookEvent("vomit_bomb_tank", Event_L4DVomitBombTank);
  1206. HookEvent("scavenge_match_finished", Event_L4DScavengeEnd);
  1207. HookEvent("versus_match_finished", Event_L4DVersusEnd);
  1208. HookEvent("charger_killed", Event_L4dChargerKilled);
  1209. }
  1210.  
  1211. }
  1212. case MOD_INSMOD: {
  1213. HookEvent("player_death", Event_INSMODPlayerDeath);
  1214. HookEvent("player_hurt", Event_INSMODPlayerHurt);
  1215. HookEvent("weapon_fire", Event_INSMODEventFired);
  1216. HookEvent("player_spawn", Event_INSMODPlayerSpawn);
  1217. HookEvent("player_pick_squad", Event_INSMODPlayerPickSquad);
  1218. HookEvent("round_end", Event_INSMODRoundEnd);
  1219. HookEvent("object_destroyed", Event_INSMODObjectiveDestroyed);
  1220. HookEvent("controlpoint_captured", Event_INSMODControlpointCapped);
  1221. }
  1222. case MOD_HL2MP: {
  1223. HookEvent("player_death", Event_HL2MPPlayerDeath);
  1224. HookEvent("player_spawn", Event_HL2MPPlayerSpawn);
  1225. HookEvent("round_end", Event_HL2MPRoundEnd, EventHookMode_PostNoCopy);
  1226. }
  1227. case MOD_ZPS: {
  1228. HookEvent("player_death", Event_ZPSPlayerDeath);
  1229. HookEvent("player_spawn", Event_ZPSPlayerSpawn);
  1230. HookEvent("round_end", Event_ZPSRoundEnd, EventHookMode_PostNoCopy);
  1231. }
  1232. case MOD_CSP: {
  1233. HookEvent("round_start", Event_CSPRoundStart);
  1234. HookEvent("round_end", Event_CSPRoundEnd);
  1235. }
  1236. } // end switch
  1237.  
  1238. // generic death event hook
  1239. HookEvent("player_death", gameME_Event_PlyDeath, EventHookMode_Pre);
  1240.  
  1241. if ((gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII) || (gameme_plugin[mod_id] == MOD_INSMOD)) {
  1242. // since almost no deaths occurs force the data to be logged at least every 180 seconds
  1243. CreateTimer(180.0, flush_weapon_logs, 0, TIMER_REPEAT);
  1244. }
  1245.  
  1246. // player location logging
  1247. if (gameme_plugin[enable_log_locations] != INVALID_HANDLE) {
  1248. new enable_log_locations_cvar = GetConVarInt(gameme_plugin[enable_log_locations]);
  1249. if (enable_log_locations_cvar == 1) {
  1250. gameme_plugin[log_locations] = 1;
  1251. LogToGame("gameME location logging activated");
  1252. } else if (enable_log_locations_cvar == 0) {
  1253. gameme_plugin[log_locations] = 0;
  1254. LogToGame("gameME location logging deactivated");
  1255. }
  1256. } else {
  1257. gameme_plugin[log_locations] = 0;
  1258. }
  1259.  
  1260. LogToGame("gameME Game Detection: %s [%s]", game_description, gameme_plugin[game_mod]);
  1261.  
  1262. }
  1263. }
  1264.  
  1265.  
  1266. public OnClientPutInServer(client)
  1267. {
  1268. if (client > 0) {
  1269. if (gameme_plugin[sdkhook_available]) {
  1270. switch (gameme_plugin[mod_id]) {
  1271. case MOD_HL2MP: {
  1272. SDKHook(client, SDKHook_FireBulletsPost, OnHL2MPFireBullets);
  1273. SDKHook(client, SDKHook_TraceAttackPost, OnHL2MPTraceAttack);
  1274. SDKHook(client, SDKHook_OnTakeDamagePost, OnHL2MPTakeDamage);
  1275. }
  1276. case MOD_ZPS: {
  1277. SDKHook(client, SDKHook_FireBulletsPost, OnZPSFireBullets);
  1278. SDKHook(client, SDKHook_TraceAttackPost, OnZPSTraceAttack);
  1279. SDKHook(client, SDKHook_OnTakeDamagePost, OnZPSTakeDamage);
  1280. }
  1281. case MOD_TF2: {
  1282. SDKHook(client, SDKHook_OnTakeDamagePost, OnTF2TakeDamage_Post);
  1283. SDKHook(client, SDKHook_OnTakeDamage, OnTF2TakeDamage);
  1284.  
  1285. tf2_players[client][player_loadout_updated] = true;
  1286. tf2_players[client][carry_object] = false;
  1287. tf2_players[client][object_removed] = 0.0;
  1288. tf2_players[client][player_class] = TFClass_Unknown;
  1289.  
  1290. for (new i = 0; (i < TF2_MAX_LOADOUT_SLOTS); i++) {
  1291. tf2_players[client][player_loadout0][i] = -1;
  1292. tf2_players[client][player_loadout1][i] = -1;
  1293. }
  1294. }
  1295. }
  1296. }
  1297.  
  1298. reset_player_data(client);
  1299. gameme_players[client][prole] = -1;
  1300. gameme_players[client][pgglevel] = 0;
  1301.  
  1302. if (!IsFakeClient(client)) {
  1303. QueryClientConVar(client, "cl_language", ConVarQueryFinished:ClientConVar, client);
  1304. 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)) {
  1305. QueryClientConVar(client, "cl_connectmethod", ConVarQueryFinished: ClientConVar, client);
  1306. }
  1307. }
  1308.  
  1309. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) {
  1310. if (gameme_plugin[display_spectator] == 1) {
  1311. gameme_players[client][pspectator][stimer] = INVALID_HANDLE;
  1312. for (new j = 0; (j <= MAXPLAYERS); j++) {
  1313. player_messages[j][client][supdated] = 1;
  1314. strcopy(player_messages[j][client][smessage], 255, "");
  1315. }
  1316. }
  1317. }
  1318.  
  1319. }
  1320. }
  1321.  
  1322.  
  1323. public ClientConVar(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[]) {
  1324. if (IsClientConnected(client)) {
  1325. log_player_settings(client, "setup", cvarName, cvarValue);
  1326. }
  1327. }
  1328.  
  1329.  
  1330. start_gameme_live()
  1331. {
  1332. if ((gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_CSGO)) {
  1333. if (gameme_plugin[live_active] == 1) {
  1334. if (GetExtensionFileStatus("socket.ext") == 1) {
  1335. LogToGame("Extension Socket is available");
  1336. if (gameme_plugin[mod_id] == MOD_CSS) {
  1337. css_data[money_offset] = FindSendPropInfo("CCSPlayer", "m_iAccount");
  1338. }
  1339. gameme_plugin[live_socket] = SocketCreate(SOCKET_UDP, OnSocketError);
  1340.  
  1341. CreateTimer(gameme_plugin[live_interval], CollectData, 0, TIMER_REPEAT);
  1342. } else {
  1343. LogToGame("gameME Live! not activated, Socket extension not available");
  1344. }
  1345. }
  1346. } else {
  1347. LogToGame("gameME Live! not enabled, not supported yet");
  1348. gameme_plugin[live_active] = 0;
  1349. }
  1350.  
  1351. }
  1352.  
  1353.  
  1354. get_weapon_index(const String: weapon_list[][], weapon_list_count, const String: weapon_name[])
  1355. {
  1356. new loop_break = 0;
  1357. new index = 0;
  1358.  
  1359. while ((loop_break == 0) && (index < weapon_list_count)) {
  1360. if (strcmp(weapon_name, weapon_list[index], true) == 0) {
  1361. loop_break++;
  1362. } else {
  1363. index++;
  1364. }
  1365. }
  1366.  
  1367. if (loop_break == 0) {
  1368. return -1;
  1369. }
  1370. return index;
  1371. }
  1372.  
  1373.  
  1374. init_tf2_weapon_trie()
  1375. {
  1376.  
  1377. tf2_data[weapons_trie] = CreateTrie();
  1378. for (new i = 0; i < MAX_TF2_WEAPON_COUNT; i++) {
  1379. SetTrieValue(tf2_data[weapons_trie], tf2_weapon_list[i], i);
  1380. }
  1381.  
  1382. new index;
  1383. if(GetTrieValue(tf2_data[weapons_trie], "ball", index)) {
  1384. SetTrieValue(tf2_data[weapons_trie], "tf_projectile_stun_ball", index);
  1385. tf2_data[stun_ball_id] = index;
  1386. }
  1387. }
  1388.  
  1389.  
  1390. get_tf2_weapon_index(const String: weapon_name[], client = 0, weapon = -1)
  1391. {
  1392. new weapon_index = -1;
  1393. new bool: unlockable_weapon;
  1394. new reflect_index = -1;
  1395.  
  1396. if (strlen(weapon_name) < 15) {
  1397. return -1;
  1398. }
  1399.  
  1400. if(GetTrieValue(tf2_data[weapons_trie], weapon_name, weapon_index)) {
  1401. if (weapon_index & TF2_UNLOCKABLE_BIT) {
  1402. weapon_index &= ~TF2_UNLOCKABLE_BIT;
  1403. unlockable_weapon = true;
  1404. }
  1405.  
  1406. if ((weapon_name[3] == 'p') && (weapon > -1)) {
  1407. if (client == GetEntProp(weapon, Prop_Send, "m_iDeflected")) {
  1408. switch(weapon_name[14]) {
  1409. case 'a':
  1410. reflect_index = get_tf2_weapon_index("deflect_arrow");
  1411. case 'f':
  1412. reflect_index = get_tf2_weapon_index("deflect_flare");
  1413. case 'p': {
  1414. if (weapon_name[19] == 0) {
  1415. reflect_index = get_tf2_weapon_index("deflect_promode");
  1416. }
  1417. }
  1418. case 'r':
  1419. reflect_index = get_tf2_weapon_index("deflect_rocket");
  1420. }
  1421. }
  1422. }
  1423.  
  1424. if (reflect_index > -1) {
  1425. return reflect_index;
  1426. }
  1427.  
  1428. if ((unlockable_weapon) && (client > 0)) {
  1429. new slot = 0;
  1430. if (tf2_players[client][player_class] == TFClass_DemoMan) {
  1431. slot = 1;
  1432. }
  1433. new item_index = tf2_players[client][player_loadout0][slot];
  1434. switch (item_index) {
  1435. case 36, 41, 45, 61, 127, 130:
  1436. weapon_index++;
  1437. }
  1438. }
  1439. }
  1440. return weapon_index;
  1441. }
  1442.  
  1443.  
  1444.  
  1445. reset_player_data(player_index)
  1446. {
  1447. for (new i = 0; (i < MAX_LOG_WEAPONS); i++) {
  1448. player_weapons[player_index][i][wshots] = 0;
  1449. player_weapons[player_index][i][whits] = 0;
  1450. player_weapons[player_index][i][wkills] = 0;
  1451. player_weapons[player_index][i][wheadshots] = 0;
  1452. player_weapons[player_index][i][wteamkills] = 0;
  1453. player_weapons[player_index][i][wdamage] = 0;
  1454. player_weapons[player_index][i][wdeaths] = 0;
  1455. player_weapons[player_index][i][wgeneric] = 0;
  1456. player_weapons[player_index][i][whead] = 0;
  1457. player_weapons[player_index][i][wchest] = 0;
  1458. player_weapons[player_index][i][wstomach] = 0;
  1459. player_weapons[player_index][i][wleftarm] = 0;
  1460. player_weapons[player_index][i][wrightarm] = 0;
  1461. player_weapons[player_index][i][wleftleg] = 0;
  1462. player_weapons[player_index][i][wrightleg] = 0;
  1463.  
  1464. }
  1465.  
  1466.  
  1467. if (gameme_plugin[damage_display] == 1) {
  1468. for (new i = 1; (i <= MaxClients); i++) {
  1469. player_damage[player_index][i][dhits] = 0;
  1470. player_damage[player_index][i][dkills] = 0;
  1471. player_damage[player_index][i][dheadshots] = 0;
  1472. player_damage[player_index][i][ddamage] = 0;
  1473. player_damage[player_index][i][dkiller] = 0;
  1474. player_damage[player_index][i][dhpleft] = 0;
  1475. player_damage[player_index][i][dteamkill] = 0;
  1476. player_damage[player_index][i][dweapon] = 0;
  1477. }
  1478. }
  1479.  
  1480. if (gameme_plugin[live_active] == 1) {
  1481. gameme_players[player_index][parmor] = 0;
  1482. gameme_players[player_index][phealth] = 0;
  1483. gameme_players[player_index][ploc1] = 0;
  1484. gameme_players[player_index][ploc2] = 0;
  1485. gameme_players[player_index][ploc3] = 0;
  1486. gameme_players[player_index][pangle] = 0;
  1487. gameme_players[player_index][pmoney] = 0;
  1488. gameme_players[player_index][palive] = 0;
  1489. }
  1490.  
  1491. }
  1492.  
  1493.  
  1494. dump_player_data(player_index)
  1495. {
  1496. if (IsClientInGame(player_index)) {
  1497. new is_logged = 0;
  1498. for (new i = 0; (i < MAX_LOG_WEAPONS); i++) {
  1499. if (player_weapons[player_index][i][wshots] > 0) {
  1500. switch (gameme_plugin[mod_id]) {
  1501. case MOD_CSGO: {
  1502. 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]);
  1503. if (player_weapons[player_index][i][whits] > 0) {
  1504. 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]);
  1505. }
  1506. }
  1507. case MOD_CSS: {
  1508. 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]);
  1509. if (player_weapons[player_index][i][whits] > 0) {
  1510. 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]);
  1511. }
  1512. }
  1513. case MOD_DODS: {
  1514. 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]);
  1515. if (player_weapons[player_index][i][whits] > 0) {
  1516. 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]);
  1517. }
  1518. }
  1519. case MOD_L4D, MOD_L4DII: {
  1520. 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]);
  1521. if (player_weapons[player_index][i][whits] > 0) {
  1522. 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]);
  1523. }
  1524. }
  1525. case MOD_INSMOD: {
  1526. 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]);
  1527. if (player_weapons[player_index][i][whits] > 0) {
  1528. 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]);
  1529. }
  1530. }
  1531. case MOD_HL2MP: {
  1532. 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]);
  1533. if (player_weapons[player_index][i][whits] > 0) {
  1534. 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]);
  1535. }
  1536. }
  1537. case MOD_ZPS: {
  1538. 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]);
  1539. if (player_weapons[player_index][i][whits] > 0) {
  1540. 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]);
  1541. }
  1542. }
  1543. case MOD_TF2: {
  1544. 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]);
  1545. }
  1546. } // switch
  1547. is_logged++;
  1548. }
  1549. }
  1550. if (is_logged > 0) {
  1551. reset_player_data(player_index);
  1552. }
  1553. }
  1554.  
  1555. }
  1556.  
  1557.  
  1558. public Action: flush_weapon_logs(Handle:timer, any:index)
  1559. {
  1560. for (new i = 1; (i <= MaxClients); i++) {
  1561. dump_player_data(i);
  1562. }
  1563. }
  1564.  
  1565.  
  1566. public Action: spectator_player_timer(Handle:timer, any: caller)
  1567. {
  1568. if (((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) && (IsValidEntity(caller))) {
  1569. new observer_mode = GetEntProp(caller, Prop_Send, "m_iObserverMode");
  1570. if ((!IsFakeClient(caller)) && ((observer_mode == SPECTATOR_FIRSTPERSON) || (observer_mode == SPECTATOR_3RDPERSON))) {
  1571. new target = GetEntPropEnt(caller, Prop_Send, "m_hObserverTarget");
  1572. if ((target > 0) && (target <= MaxClients) && (IsClientInGame(target))) {
  1573.  
  1574. if ((player_messages[caller][target][supdated] == 1) || (gameme_players[caller][pspectator][starget] == 0)) {
  1575. for (new i = 0; (i <= MAXPLAYERS); i++) {
  1576. player_messages[i][target][supdated] = 0;
  1577. }
  1578. QueryIntGameMEStats("spectatorinfo", target, QuerygameMEStatsIntCallback, QUERY_TYPE_SPECTATOR);
  1579. }
  1580.  
  1581. if (target != gameme_players[caller][pspectator][starget]) {
  1582. gameme_players[caller][pspectator][srequested] = 0.0;
  1583. }
  1584.  
  1585. if (strcmp(player_messages[caller][target][smessage], "") != 0) {
  1586. if ((caller > 0) && (caller <= MaxClients) && (!IsFakeClient(caller)) && (IsClientInGame(caller))) {
  1587. if ((GetGameTime() - gameme_players[caller][pspectator][srequested]) > 5) {
  1588. new Handle: message_handle = StartMessageOne("KeyHintText", caller);
  1589. if (message_handle != INVALID_HANDLE) {
  1590. if (gameme_plugin[protobuf] == 1) {
  1591. PbAddString(message_handle, "hints", player_messages[caller][target][smessage]);
  1592. } else {
  1593. BfWriteByte(message_handle, 1);
  1594. BfWriteString(message_handle, player_messages[caller][target][smessage]);
  1595. }
  1596. EndMessage();
  1597. }
  1598. gameme_players[caller][pspectator][srequested] = GetGameTime();
  1599. }
  1600. }
  1601. } else {
  1602. if (target != gameme_players[caller][pspectator][starget]) {
  1603. if (gameme_plugin[mod_id] != MOD_CSGO) {
  1604. new Handle: message_handle = StartMessageOne("KeyHintText", caller);
  1605. if (message_handle != INVALID_HANDLE) {
  1606. if (gameme_plugin[protobuf] == 1) {
  1607. PbAddString(message_handle, "hints", "");
  1608. } else {
  1609. BfWriteByte(message_handle, 1);
  1610. BfWriteString(message_handle, "");
  1611. }
  1612. EndMessage();
  1613. }
  1614. }
  1615. gameme_players[caller][pspectator][srequested] = GetGameTime();
  1616. }
  1617. }
  1618. gameme_players[caller][pspectator][starget] = target;
  1619. }
  1620. }
  1621. }
  1622. }
  1623.  
  1624.  
  1625. public QuerygameMEStatsIntCallback(query_command, query_payload, query_caller[MAXPLAYERS + 1], query_target[MAXPLAYERS + 1], const String: query_message_prefix[], const String: query_message[])
  1626. {
  1627. if ((query_caller[0] > 0) && (query_command == RAW_MESSAGE_CALLBACK_INT_SPECTATOR)) {
  1628. if ((query_payload == QUERY_TYPE_SPECTATOR) && (query_target[0] > 0)) {
  1629. for (new i = 0; (i <= MAXPLAYERS); i++) {
  1630. if (query_caller[i] > -1) {
  1631. strcopy(player_messages[query_caller[i]][query_target[0]][smessage], 255, query_message);
  1632. ReplaceString(player_messages[query_caller[i]][query_target[0]][smessage], 255, "\\n", "\10");
  1633. gameme_players[query_caller[i]][pspectator][srequested] = 0.0;
  1634. }
  1635. }
  1636. }
  1637. }
  1638. }
  1639.  
  1640.  
  1641. public OnSocketError(Handle:socket, const errorType, const errorNum, any: arg) {
  1642. LogError("socket error %d (errno %d)", errorType, errorNum);
  1643. CloseHandle(socket);
  1644. gameme_plugin[live_socket] = SocketCreate(SOCKET_UDP, OnSocketError);
  1645. }
  1646.  
  1647.  
  1648. public Action:CollectData(Handle:timer, any:index)
  1649. {
  1650.  
  1651. if ((gameme_plugin[live_active] == 1) && (gameme_plugin[live_socket] != INVALID_HANDLE)) {
  1652. new String: network_packet[1500];
  1653.  
  1654. for(new i = 1; i <= MaxClients; i++) {
  1655. new player_index = i;
  1656. if (IsClientInGame(player_index)) {
  1657.  
  1658. if (gameme_players[player_index][palive] == 1) {
  1659.  
  1660. new Float: player_origin_float[3];
  1661. GetClientAbsOrigin(player_index, player_origin_float);
  1662.  
  1663. new player_origin[3];
  1664. player_origin[0] = RoundFloat(player_origin_float[0]);
  1665. player_origin[1] = RoundFloat(player_origin_float[1]);
  1666. player_origin[2] = RoundFloat(player_origin_float[2]);
  1667.  
  1668. new Float: player_angles_float[3];
  1669. GetClientAbsAngles(player_index, player_angles_float);
  1670. new player_angle;
  1671. player_angle = RoundFloat(player_angles_float[1]);
  1672.  
  1673. // player movement
  1674. if ((player_origin[0] != gameme_players[player_index][ploc1]) ||
  1675. (player_origin[1] != gameme_players[player_index][ploc2]) ||
  1676. (player_origin[2] != gameme_players[player_index][ploc3]) ||
  1677. (player_angle != gameme_players[player_index][pangle])) {
  1678.  
  1679. gameme_players[player_index][ploc1] = player_origin[0];
  1680. gameme_players[player_index][ploc2] = player_origin[1];
  1681. gameme_players[player_index][ploc3] = player_origin[2];
  1682. gameme_players[player_index][pangle] = player_angle;
  1683.  
  1684. decl String: send_message[128];
  1685. 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]);
  1686. // LogToGame("|%s|", send_message);
  1687.  
  1688. new send_message_len = strlen(send_message);
  1689. new network_packet_len = strlen(network_packet);
  1690. if ((network_packet_len + send_message_len) <= 1500) {
  1691. strcopy(network_packet[network_packet_len], 1500, send_message);
  1692. } else {
  1693. if (strcmp(network_packet, "") != 0) {
  1694. SocketSendTo(gameme_plugin[live_socket], network_packet, strlen(network_packet), gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port]);
  1695. // LogToGame("Send [%s:%d]: |%s|", gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port], network_packet);
  1696. network_packet[0] = '\0';
  1697. if (strcmp(send_message, "") != 0) {
  1698. strcopy(network_packet[1], 1500, send_message);
  1699. }
  1700. }
  1701. }
  1702.  
  1703. }
  1704.  
  1705.  
  1706. new health = GetClientHealth(player_index);
  1707. new armor = GetClientArmor(player_index);
  1708. decl String: player_weapon[32];
  1709. GetClientWeapon(player_index, player_weapon, 32);
  1710. new weapon_index;
  1711. if (gameme_plugin[mod_id] == MOD_CSS) {
  1712. weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, player_weapon[7]);
  1713. } else if (gameme_plugin[mod_id] == MOD_CSGO) {
  1714. weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, player_weapon[7]);
  1715. } else {
  1716. weapon_index = -1;
  1717. }
  1718.  
  1719. new money;
  1720. if (gameme_plugin[mod_id] == MOD_CSS) {
  1721. if (css_data[money_offset] != -1) {
  1722. money = GetEntData(player_index, css_data[money_offset]);
  1723. }
  1724. } else if (gameme_plugin[mod_id] == MOD_CSGO) {
  1725. money = 0;
  1726. } else {
  1727. money = 0;
  1728. }
  1729.  
  1730.  
  1731.  
  1732. // player equipment
  1733. if ((health != gameme_players[player_index][phealth]) ||
  1734. (armor != gameme_players[player_index][parmor]) ||
  1735. (money != gameme_players[player_index][pmoney]) ||
  1736. ((weapon_index > -1) && (weapon_index != gameme_players[player_index][pweapon]))) {
  1737.  
  1738. // LogToGame("Health (%d): %d, %d", player_index, health, gameme_players[player_index][phealth]);
  1739. // LogToGame("Armor (%d): %d, %d", player_index, armor, gameme_players[player_index][parmor]);
  1740. // LogToGame("Money (%d): %d, %d", player_index, money, gameme_players[player_index][pmoney]);
  1741. // LogToGame("Weapon (%d): %d, %d", player_index, weapon_index, gameme_players[player_index][pweapon]);
  1742.  
  1743. gameme_players[player_index][phealth] = health;
  1744. gameme_players[player_index][parmor] = armor;
  1745. gameme_players[player_index][pmoney] = money;
  1746. gameme_players[player_index][pweapon] = weapon_index;
  1747.  
  1748. new String: weapon_name[32];
  1749. if (gameme_players[player_index][pweapon] > -1) {
  1750. if (gameme_plugin[mod_id] == MOD_CSS) {
  1751. Format(weapon_name, 32, css_weapon_list[gameme_players[player_index][pweapon]]);
  1752. } else if (gameme_plugin[mod_id] == MOD_CSGO) {
  1753. Format(weapon_name, 32, csgo_weapon_list[gameme_players[player_index][pweapon]]);
  1754. }
  1755. }
  1756.  
  1757. decl String: send_message[128];
  1758. 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]);
  1759. // LogToGame("|%s|", send_message);
  1760.  
  1761. new send_message_len = strlen(send_message);
  1762. new network_packet_len = strlen(network_packet);
  1763. if ((network_packet_len + send_message_len) <= 1500) {
  1764. strcopy(network_packet[network_packet_len], 1500, send_message);
  1765. } else {
  1766. if (strcmp(network_packet, "") != 0) {
  1767. SocketSendTo(gameme_plugin[live_socket], network_packet, strlen(network_packet), gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port]);
  1768. // LogToGame("Send [%s:%d]: |%s|", gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port], network_packet);
  1769. network_packet[0] = '\0';
  1770. if (strcmp(send_message, "") != 0) {
  1771. strcopy(network_packet[1], 1500, send_message);
  1772. }
  1773. }
  1774. }
  1775.  
  1776. }
  1777. }
  1778. }
  1779. }
  1780.  
  1781. if (strcmp(network_packet, "") != 0) {
  1782. SocketSendTo(gameme_plugin[live_socket], network_packet, strlen(network_packet), gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port]);
  1783. // LogToGame("Send [%s:%d]: |%s|", gameme_plugin[gameme_live_address_value], gameme_plugin[gameme_live_address_port], network_packet);
  1784. }
  1785.  
  1786. }
  1787.  
  1788. }
  1789.  
  1790.  
  1791. public PanelDamageHandler(Handle:menu, MenuAction:action, param1, param2)
  1792. {
  1793. }
  1794.  
  1795.  
  1796. public build_damage_panel(player_index)
  1797. {
  1798.  
  1799. if ((gameme_plugin[damage_display] == 0) || ((!IsClientInGame(player_index)) || (IsFakeClient(player_index)))) {
  1800. return ;
  1801. }
  1802.  
  1803. new max_clients = GetMaxClients();
  1804.  
  1805. new String: attacked[8][128];
  1806. new attacked_index = 0;
  1807. new String: wounded[8][128];
  1808. new wounded_index = 0;
  1809. new String: killed[8][128];
  1810. new killed_index = 0;
  1811. new String: killer[8][128];
  1812. new killer_index = 0;
  1813.  
  1814. for (new i = 1; (i <= max_clients); i++) {
  1815. if (player_index == i) {
  1816. for (new j = 1; (j <= max_clients); j++) {
  1817. new wounded_damage = 0;
  1818. new wounded_hits = 0;
  1819. new is_kill = 0;
  1820. if (player_damage[i][j][DAMAGE_HITS] > 0) {
  1821. wounded_hits = player_damage[i][j][DAMAGE_HITS];
  1822. wounded_damage = player_damage[i][j][DAMAGE_DAMAGE];
  1823. if (player_damage[i][j][DAMAGE_KILLED] > 0) {
  1824. is_kill++;
  1825. }
  1826. }
  1827. if (wounded_hits > 0) {
  1828. if (IsClientConnected(j)) {
  1829. if (is_kill == 0) {
  1830. decl String: victim_name[64];
  1831. GetClientName(j, victim_name, 64);
  1832. if (wounded_index < sizeof(wounded)) {
  1833. if (wounded_hits == 1) {
  1834. Format(wounded[wounded_index], 128, " %s - %d %T, %d Hit", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hit", player_index);
  1835. } else {
  1836. Format(wounded[wounded_index], 128, " %s - %d %T, %d Hits", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hits", player_index);
  1837. }
  1838. wounded_index++;
  1839. }
  1840. } else {
  1841. decl String: victim_name[32];
  1842. GetClientName(j, victim_name, 32);
  1843. if (killed_index < sizeof(killed)) {
  1844. if (wounded_hits == 1) {
  1845. Format(killed[killed_index], 128, " %s - %d %T, %d %T", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hit", player_index);
  1846. } else {
  1847. Format(killed[killed_index], 128, " %s - %d %T, %d %T", victim_name, wounded_damage, "DamagePanel_Dmg", player_index, wounded_hits, "DamagePanel_Hits", player_index);
  1848. }
  1849. killed_index++;
  1850. }
  1851. }
  1852. }
  1853. }
  1854. }
  1855. } else {
  1856. for (new j = 1; (j <= max_clients); j++) {
  1857. if (j == player_index) {
  1858. new attacked_damage = 0;
  1859. new attacked_hits = 0;
  1860. new is_killer = 0;
  1861. new killer_hpleft = 0;
  1862. new killer_weapon = 0;
  1863. if (player_damage[i][j][DAMAGE_HITS] > 0) {
  1864. attacked_hits = player_damage[i][j][DAMAGE_HITS];
  1865. attacked_damage = player_damage[i][j][DAMAGE_DAMAGE];
  1866. if (player_damage[i][j][DAMAGE_KILLER] > 0) {
  1867. is_killer++;
  1868. killer_hpleft = player_damage[i][j][DAMAGE_HPLEFT];
  1869. killer_weapon = player_damage[i][j][DAMAGE_WEAPON];
  1870.  
  1871. player_damage[i][j][DAMAGE_KILLER] = 0;
  1872. player_damage[i][j][DAMAGE_HPLEFT] = 0;
  1873. player_damage[i][j][DAMAGE_WEAPON] = -1;
  1874. }
  1875. }
  1876. if (attacked_hits > 0) {
  1877. if (IsClientConnected(i)) {
  1878. if (is_killer == 0) {
  1879. decl String: attacker_name[64];
  1880. GetClientName(i, attacker_name, 64);
  1881. if (attacked_index < sizeof(attacked)) {
  1882. if (attacked_hits == 1) {
  1883. Format(attacked[attacked_index], 128, " %s - %d %T, %d %T", attacker_name, attacked_damage, "DamagePanel_Dmg", player_index, attacked_hits, "DamagePanel_Hit", player_index);
  1884. } else {
  1885. Format(attacked[attacked_index], 128, " %s - %d %T, %d %T", attacker_name, attacked_damage, "DamagePanel_Dmg", player_index, attacked_hits, "DamagePanel_Hits", player_index);
  1886. }
  1887. attacked_index++;
  1888. }
  1889. } else {
  1890. decl String: killer_name[64];
  1891. GetClientName(i, killer_name, 64);
  1892. if (killer_index < sizeof(killer)) {
  1893. if (gameme_plugin[mod_id] == MOD_CSGO) {
  1894. if (attacked_hits == 1) {
  1895. 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]);
  1896. } else {
  1897. 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]);
  1898. }
  1899. } else if (gameme_plugin[mod_id] == MOD_CSS) {
  1900. if (attacked_hits == 1) {
  1901. 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]);
  1902. } else {
  1903. 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]);
  1904. }
  1905. } else if (gameme_plugin[mod_id] == MOD_DODS) {
  1906. if (attacked_hits == 1) {
  1907. 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]);
  1908. } else {
  1909. 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]);
  1910. }
  1911. }
  1912. killer_index++;
  1913. }
  1914. }
  1915. }
  1916. }
  1917. }
  1918. }
  1919.  
  1920.  
  1921. }
  1922. }
  1923.  
  1924. if ((attacked_index > 0) || (wounded_index > 0) || (killed_index > 0) || (killer_index > 0)) {
  1925. new Handle:panel = CreatePanel();
  1926. SetPanelKeys(panel, 1023);
  1927.  
  1928. new is_attacked = 0;
  1929. for (new i = 0; (i < sizeof(attacked)); i++) {
  1930. if (strcmp(attacked[i], "") != 0) {
  1931. is_attacked++;
  1932. if (is_attacked == 1) {
  1933. decl String: attackers_caption[32];
  1934. Format(attackers_caption, 32, "%T", "DamagePanel_Attackers", player_index);
  1935. DrawPanelItem(panel, attackers_caption);
  1936. }
  1937. DrawPanelText(panel, attacked[i]);
  1938. } else {
  1939. break;
  1940. }
  1941. }
  1942.  
  1943. new is_killed = 0;
  1944. for (new i = 0; (i < sizeof(killed)); i++) {
  1945. if (strcmp(killed[i], "") != 0) {
  1946. is_killed++;
  1947. if (is_killed == 1) {
  1948. decl String: killed_caption[32];
  1949. Format(killed_caption, 32, "%T", "DamagePanel_Killed", player_index);
  1950. DrawPanelItem(panel, killed_caption);
  1951. }
  1952. DrawPanelText(panel, killed[i]);
  1953. } else {
  1954. break;
  1955. }
  1956. }
  1957.  
  1958. new is_wounded = 0;
  1959. for (new i = 0; (i < sizeof(wounded)); i++) {
  1960. if (strcmp(wounded[i], "") != 0) {
  1961. is_wounded++;
  1962. if (is_wounded == 1) {
  1963. decl String: wounded_caption[32];
  1964. Format(wounded_caption, 32, "%T", "DamagePanel_Wounded", player_index);
  1965. DrawPanelItem(panel, wounded_caption);
  1966. }
  1967. DrawPanelText(panel, wounded[i]);
  1968. } else {
  1969. break;
  1970. }
  1971. }
  1972.  
  1973. new is_killer = 0;
  1974. for (new i = 0; (i < sizeof(killer)); i++) {
  1975. if (strcmp(killer[i], "") != 0) {
  1976. is_killer++;
  1977. if (is_killer == 1) {
  1978. decl String: killer_caption[32];
  1979. Format(killer_caption, 32, "%T", "DamagePanel_Killer", player_index);
  1980. DrawPanelItem(panel, killer_caption);
  1981. }
  1982. DrawPanelText(panel, killer[i]);
  1983. } else {
  1984. break;
  1985. }
  1986. }
  1987.  
  1988. SendPanelToClient(panel, player_index, PanelDamageHandler, 15);
  1989. CloseHandle(panel);
  1990. }
  1991. }
  1992.  
  1993.  
  1994. public build_damage_chat(player_index)
  1995. {
  1996.  
  1997. if ((gameme_plugin[damage_display] == 0) || ((!IsClientInGame(player_index)) || (IsFakeClient(player_index)))) {
  1998. return ;
  1999. }
  2000.  
  2001. new max_clients = GetMaxClients();
  2002. decl String: killed_message[192];
  2003. new killer_index = 0;
  2004.  
  2005. for (new i = 1; (i <= max_clients); i++) {
  2006. if (i != player_index) {
  2007. for (new j = 1; (j <= max_clients); j++) {
  2008. if (j == player_index) {
  2009. new attacked_damage = 0;
  2010. new killer_hpleft = 0;
  2011. new is_killer = 0;
  2012. if (player_damage[i][j][DAMAGE_HITS] > 0) {
  2013. attacked_damage = player_damage[i][j][DAMAGE_DAMAGE];
  2014. if (player_damage[i][j][DAMAGE_KILLER] > 0) {
  2015. killer_hpleft = player_damage[i][j][DAMAGE_HPLEFT];
  2016. is_killer++;
  2017.  
  2018. player_damage[i][j][DAMAGE_KILLER] = 0;
  2019. player_damage[i][j][DAMAGE_HPLEFT] = 0;
  2020. player_damage[i][j][DAMAGE_WEAPON] = -1;
  2021. }
  2022. }
  2023.  
  2024. if (is_killer > 0) {
  2025. if (IsClientConnected(i)) {
  2026. decl String: killer_name[64];
  2027. GetClientName(i, killer_name, 64);
  2028. if (strcmp(gameme_plugin[message_prefix_value], "") == 0) {
  2029. Format(killed_message, 192, "%T", "DamageChat_Killedyou", player_index, killer_name, attacked_damage, killer_hpleft);
  2030. } else {
  2031. Format(killed_message, 192, "%s %T", gameme_plugin[message_prefix_value], "DamageChat_Killedyou", player_index, killer_name, attacked_damage, killer_hpleft);
  2032. }
  2033. killer_index++;
  2034. }
  2035. }
  2036. }
  2037. }
  2038. }
  2039. }
  2040.  
  2041. if (killer_index > 0) {
  2042. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  2043.  
  2044. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_DODS)) {
  2045. color_gameme_entities(killed_message);
  2046.  
  2047. if (gameme_plugin[mod_id] == MOD_DODS) {
  2048. PrintToChat(player_index, killed_message);
  2049. } else {
  2050. new Handle: message_handle = StartMessageOne("SayText2", player_index);
  2051. if (message_handle != INVALID_HANDLE) {
  2052. if (gameme_plugin[protobuf] == 1) {
  2053. PbSetInt(message_handle, "ent_idx", player_index);
  2054. PbSetBool(message_handle, "chat", false);
  2055. PbSetString(message_handle, "msg_name", killed_message);
  2056. PbAddString(message_handle, "params", "");
  2057. PbAddString(message_handle, "params", "");
  2058. PbAddString(message_handle, "params", "");
  2059. PbAddString(message_handle, "params", "");
  2060. } else {
  2061. BfWriteByte(message_handle, player_index);
  2062. BfWriteByte(message_handle, 0);
  2063. BfWriteString(message_handle, killed_message);
  2064. }
  2065. EndMessage();
  2066. }
  2067. }
  2068. }
  2069. }
  2070.  
  2071. }
  2072. }
  2073.  
  2074.  
  2075. public Event_CSGOPlayerFire(Handle: event, const String: name[], bool:dontBroadcast)
  2076. {
  2077. // "userid" "short"
  2078. // "weapon" "string" // weapon name used
  2079.  
  2080. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2081. if (userid > 0) {
  2082. decl String: weapon_str[32];
  2083. GetEventString(event, "weapon", weapon_str, 32);
  2084. ReplaceString(weapon_str, 32, "weapon_", "", false);
  2085. new weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, weapon_str);
  2086. if (weapon_index > -1) {
  2087. if ((weapon_index != 22) && // hegrenade
  2088. (weapon_index != 32) && // inferno
  2089. (weapon_index != 33) && // decoy
  2090. (weapon_index != 34) && // flashbang
  2091. (weapon_index != 35) && // smokegrenade
  2092. (weapon_index != 36) && // molotov
  2093. (weapon_index != 37)) { // incgrenade
  2094. player_weapons[userid][weapon_index][wshots]++;
  2095. }
  2096. }
  2097. }
  2098. }
  2099.  
  2100.  
  2101. public Event_CSSPlayerFire(Handle: event, const String: name[], bool:dontBroadcast)
  2102. {
  2103. // "userid" "short"
  2104. // "weapon" "string" // weapon name used
  2105.  
  2106. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2107. if (userid > 0) {
  2108. decl String: weapon_str[32];
  2109. GetEventString(event, "weapon", weapon_str, 32);
  2110. new weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, weapon_str);
  2111. if (weapon_index > -1) {
  2112. if ((weapon_index != 27) && // flashbang
  2113. (weapon_index != 11) && // hegrenade
  2114. (weapon_index != 26)) { // smokegrenade
  2115. player_weapons[userid][weapon_index][wshots]++;
  2116. }
  2117. }
  2118. }
  2119. }
  2120.  
  2121.  
  2122. public Event_DODSWeaponAttack(Handle: event, const String: name[], bool:dontBroadcast)
  2123. {
  2124. // "attacker" "short"
  2125. // "weapon" "byte"
  2126.  
  2127. new userid = GetClientOfUserId(GetEventInt(event, "attacker"));
  2128. if (userid > 0) {
  2129. new log_weapon_index = GetEventInt(event, "weapon");
  2130.  
  2131. new weapon_index = -1;
  2132. switch (log_weapon_index) {
  2133. case 1 :
  2134. weapon_index = 20;
  2135. case 2 :
  2136. weapon_index = 16;
  2137. case 3 :
  2138. weapon_index = 7;
  2139. case 4 :
  2140. weapon_index = 15;
  2141. case 5 :
  2142. weapon_index = 10;
  2143. case 6 :
  2144. weapon_index = 8;
  2145. case 7 :
  2146. weapon_index = 1;
  2147. case 8 :
  2148. weapon_index = 2;
  2149. case 9 :
  2150. weapon_index = 9;
  2151. case 10 :
  2152. weapon_index = 3;
  2153. case 11 :
  2154. weapon_index = 0;
  2155. case 12 :
  2156. weapon_index = 4;
  2157. case 13 :
  2158. weapon_index = 6;
  2159. case 14 :
  2160. weapon_index = 11;
  2161. case 15 :
  2162. weapon_index = 12;
  2163. case 16 :
  2164. weapon_index = 5;
  2165. case 17 :
  2166. weapon_index = 13;
  2167. case 18 :
  2168. weapon_index = 14;
  2169. case 19 :
  2170. weapon_index = 19;
  2171. case 20 :
  2172. weapon_index = 17;
  2173. case 23 :
  2174. weapon_index = 24;
  2175. case 24 :
  2176. weapon_index = 23;
  2177. case 25 :
  2178. weapon_index = 22;
  2179. case 26 :
  2180. weapon_index = 21;
  2181. case 31 :
  2182. weapon_index = 8;
  2183. case 33 :
  2184. weapon_index = 9;
  2185. case 34 :
  2186. weapon_index = 3;
  2187. case 35 :
  2188. weapon_index = 12;
  2189. case 36 :
  2190. weapon_index = 5;
  2191. case 38 :
  2192. weapon_index = 6;
  2193. }
  2194.  
  2195. if (weapon_index > -1) {
  2196. if ((weapon_index != 25) && // dod_bomb_target
  2197. (weapon_index != 21) && // riflegren_ger
  2198. (weapon_index != 22) && // riflegren_us
  2199. (weapon_index != 23) && // smoke_ger
  2200. (weapon_index != 24)) { // smoke_us
  2201. player_weapons[userid][weapon_index][wshots]++;
  2202. }
  2203. }
  2204. }
  2205.  
  2206. }
  2207.  
  2208.  
  2209. public Event_L4DPlayerFire(Handle: event, const String: name[], bool:dontBroadcast)
  2210. {
  2211. // "local" "1" // don't network this, its way too spammy
  2212. // "userid" "short"
  2213. // "weapon" "string" // used weapon name
  2214. // "weaponid" "short" // used weapon ID
  2215. // "count" "short" // number of bullets
  2216.  
  2217. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2218. if (userid > 0) {
  2219. decl String: weapon_str[32];
  2220. GetEventString(event, "weapon", weapon_str, 32);
  2221. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str);
  2222. if (weapon_index > -1) {
  2223. if ((weapon_index != 12) && // entityflame
  2224. (weapon_index != 6)) { // inferno
  2225. player_weapons[userid][weapon_index][wshots]++;
  2226. }
  2227. }
  2228. }
  2229. }
  2230.  
  2231.  
  2232. public Event_CSGOPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2233. {
  2234. // "userid" "short" // player index who was hurt
  2235. // "attacker" "short" // player index who attacked
  2236. // "health" "byte" // remaining health points
  2237. // "armor" "byte" // remaining armor points
  2238. // "weapon" "string" // weapon name attacker used, if not the world
  2239. // "dmg_health" "byte" // damage done to health
  2240. // "dmg_armor" "byte" // damage done to armor
  2241. // "hitgroup" "byte" // hitgroup that was damaged
  2242.  
  2243. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2244. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2245.  
  2246. if ((attacker > 0) && (attacker != victim)) {
  2247. decl String: weapon_str[32];
  2248. GetEventString(event, "weapon", weapon_str, 32);
  2249. new weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, weapon_str);
  2250. if (weapon_index > -1) {
  2251. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2252. player_weapons[attacker][weapon_index][wshots]++;
  2253. }
  2254. player_weapons[attacker][weapon_index][whits]++;
  2255. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  2256. new hitgroup = GetEventInt(event, "hitgroup");
  2257. if (hitgroup < 8) {
  2258. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2259. }
  2260.  
  2261.  
  2262. if (gameme_plugin[damage_display] == 1) {
  2263. player_damage[attacker][victim][dhits]++;
  2264. player_damage[attacker][victim][ddamage] += GetEventInt(event, "dmg_health");
  2265. }
  2266. }
  2267. }
  2268. }
  2269.  
  2270.  
  2271. public Event_CSSPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2272. {
  2273. // "userid" "short" // player index who was hurt
  2274. // "attacker" "short" // player index who attacked
  2275. // "health" "byte" // remaining health points
  2276. // "armor" "byte" // remaining armor points
  2277. // "weapon" "string" // weapon name attacker used, if not the world
  2278. // "dmg_health" "byte" // damage done to health
  2279. // "dmg_armor" "byte" // damage done to armor
  2280. // "hitgroup" "byte" // hitgroup that was damaged
  2281.  
  2282. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2283. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2284.  
  2285. if ((attacker > 0) && (attacker != victim)) {
  2286. decl String: weapon_str[32];
  2287. GetEventString(event, "weapon", weapon_str, 32);
  2288. new weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, weapon_str);
  2289. if (weapon_index > -1) {
  2290. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2291. player_weapons[attacker][weapon_index][wshots]++;
  2292. }
  2293. player_weapons[attacker][weapon_index][whits]++;
  2294. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  2295. new hitgroup = GetEventInt(event, "hitgroup");
  2296. if (hitgroup < 8) {
  2297. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2298. }
  2299.  
  2300. if (gameme_plugin[damage_display] == 1) {
  2301. player_damage[attacker][victim][dhits]++;
  2302. player_damage[attacker][victim][ddamage] += GetEventInt(event, "dmg_health");
  2303. }
  2304. }
  2305. }
  2306. }
  2307.  
  2308.  
  2309. public Event_DODSPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2310. {
  2311. // "userid" "short" // user ID who was hurt
  2312. // "attacker" "short" // user ID who attacked
  2313. // "weapon" "string" // weapon name attacker used
  2314. // "health" "byte" // health remaining
  2315. // "damage" "byte" // how much damage in this attack
  2316. // "hitgroup" "byte" // what hitgroup was hit
  2317.  
  2318. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2319. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2320.  
  2321. if ((attacker > 0) && (attacker != victim)) {
  2322. decl String: weapon_str[32];
  2323. GetEventString(event, "weapon", weapon_str, 32);
  2324. new weapon_index = get_weapon_index(dods_weapon_list, MAX_DODS_WEAPON_COUNT, weapon_str);
  2325. if (weapon_index > -1) {
  2326. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2327. player_weapons[attacker][weapon_index][wshots]++;
  2328. }
  2329. player_weapons[attacker][weapon_index][whits]++;
  2330. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "health");
  2331. new hitgroup = GetEventInt(event, "hitgroup");
  2332. if (hitgroup < 8) {
  2333. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2334. }
  2335.  
  2336. if (gameme_plugin[damage_display] == 1) {
  2337. player_damage[attacker][victim][dhits]++;
  2338. player_damage[attacker][victim][ddamage] += GetEventInt(event, "damage");
  2339. }
  2340. }
  2341. }
  2342. }
  2343.  
  2344.  
  2345. public Event_L4DPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2346. {
  2347. // "local" "1" // Not networked
  2348. // "userid" "short" // user ID who was hurt
  2349. // "attacker" "short" // user id who attacked
  2350. // "attackerentid" "long" // entity id who attacked, if attacker not a player, and userid therefore invalid
  2351. // "health" "short" // remaining health points
  2352. // "armor" "byte" // remaining armor points
  2353. // "weapon" "string" // weapon name attacker used, if not the world
  2354. // "dmg_health" "short" // damage done to health
  2355. // "dmg_armor" "byte" // damage done to armor
  2356. // "hitgroup" "byte" // hitgroup that was damaged
  2357. // "type" "long" // damage type
  2358.  
  2359. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2360. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2361.  
  2362. if ((attacker > 0) && (attacker != victim)) {
  2363. decl String: weapon_str[32];
  2364. GetEventString(event, "weapon", weapon_str, 32);
  2365. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str);
  2366. if (weapon_index > -1) {
  2367. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2368. player_weapons[attacker][weapon_index][wshots]++;
  2369. }
  2370. player_weapons[attacker][weapon_index][whits]++;
  2371. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  2372. new hitgroup = GetEventInt(event, "hitgroup");
  2373. if (hitgroup < 8) {
  2374. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2375. }
  2376.  
  2377. } else if (!strcmp(weapon_str, "insect_swarm")) {
  2378. if ((victim > 0) && (IsClientInGame(victim)) && (GetClientTeam(victim) == 2) && (!GetEntProp(victim, Prop_Send, "m_isIncapacitated"))) {
  2379. log_player_player_event(attacker, victim, "triggered", "spit_hurt");
  2380. }
  2381. }
  2382.  
  2383. }
  2384. }
  2385.  
  2386.  
  2387. public Event_L4DInfectedHurt(Handle: event, const String: name[], bool:dontBroadcast)
  2388. {
  2389. // "local" "1" // don't network this, its way too spammy
  2390. // "attacker" "short" // player userid who attacked
  2391. // "entityid" "long" // entity id of infected
  2392. // "hitgroup" "byte" // hitgroup that was damaged
  2393. // "amount" "short" // how much damage was done
  2394. // "type" "long" // damage type
  2395.  
  2396. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2397. if (attacker > 0) {
  2398. decl String: weapon_str[32];
  2399. GetClientWeapon(attacker, weapon_str, 32);
  2400. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str[7]);
  2401. if (weapon_index > -1) {
  2402. if (player_weapons[attacker][weapon_index][wshots] == 0) {
  2403. player_weapons[attacker][weapon_index][wshots]++;
  2404. }
  2405. player_weapons[attacker][weapon_index][whits]++;
  2406. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "amount");
  2407.  
  2408. new hitgroup = GetEventInt(event, "hitgroup");
  2409. if (hitgroup < 8) {
  2410. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  2411. }
  2412.  
  2413. }
  2414. }
  2415. }
  2416.  
  2417. public Event_CSGOPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2418. {
  2419. // this extents the original player_death by a new fields
  2420. // "userid" "short" // user ID who died
  2421. // "attacker" "short" // user ID who killed
  2422. // "assister" "short" // user ID who assisted in the kill
  2423. // "weapon" "string" // weapon name killer used
  2424. // "headshot" "bool" // singals a headshot
  2425. // "dominated" "short" // did killer dominate victim with this kill
  2426. // "revenge" "short" // did killer get revenge on victim with this kill
  2427. // "penetrated" "short" // number of objects shot penetrated before killing target
  2428.  
  2429. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2430. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2431.  
  2432. if ((victim > 0) && (attacker > 0)) {
  2433. if (attacker != victim) {
  2434. decl String: weapon_str[32];
  2435. GetEventString(event, "weapon", weapon_str, 32);
  2436. new weapon_index = get_weapon_index(csgo_weapon_list, MAX_CSGO_WEAPON_COUNT, weapon_str);
  2437. if (weapon_index > -1) {
  2438. player_weapons[attacker][weapon_index][wkills]++;
  2439. new headshot = GetEventBool(event, "headshot");
  2440. if (headshot == 1) {
  2441. player_weapons[attacker][weapon_index][wheadshots]++;
  2442. }
  2443. player_weapons[victim][weapon_index][wdeaths]++;
  2444.  
  2445. if (GetEventInt(event, "dominated")) {
  2446. log_player_player_event(attacker, victim, "triggered", "domination");
  2447. } else if (GetEventInt(event, "revenge")) {
  2448. log_player_player_event(attacker, victim, "triggered", "revenge");
  2449. }
  2450.  
  2451. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2452. player_weapons[attacker][weapon_index][wteamkills]++;
  2453. if (gameme_plugin[damage_display] == 1) {
  2454. player_damage[attacker][victim][dteamkill] += 1;
  2455. }
  2456. } else {
  2457. new assister = GetClientOfUserId(GetEventInt(event, "assister"));
  2458. if ((assister > 0) && (assister != victim)) {
  2459. log_player_player_event(assister, victim, "triggered", "kill_assist");
  2460. }
  2461. }
  2462.  
  2463. if (gameme_plugin[damage_display] == 1) {
  2464. player_damage[attacker][victim][dhpleft] = GetClientHealth(attacker);
  2465. player_damage[attacker][victim][dkills] += 1;
  2466. player_damage[attacker][victim][dkiller] = attacker;
  2467. player_damage[attacker][victim][dweapon] = weapon_index;
  2468. if (headshot == 1) {
  2469. player_damage[attacker][victim][dheadshots] += 1;
  2470. }
  2471.  
  2472. if (gameme_plugin[damage_display_type] == 2) {
  2473. build_damage_chat(victim);
  2474. } else {
  2475. build_damage_panel(victim);
  2476. }
  2477.  
  2478. }
  2479. }
  2480. }
  2481. dump_player_data(victim);
  2482.  
  2483. gameme_players[victim][palive] = 0;
  2484. if (gameme_plugin[display_spectator] == 1) {
  2485. if ((IsClientInGame(victim)) && (!IsFakeClient(victim))) {
  2486. gameme_players[victim][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, victim, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2487. }
  2488.  
  2489. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2490. player_messages[j][attacker][supdated] = 1;
  2491. player_messages[j][victim][supdated] = 1;
  2492. }
  2493. }
  2494. }
  2495. }
  2496.  
  2497.  
  2498. public Event_CSSPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2499. {
  2500. // this extents the original player_death by a new fields
  2501. // "userid" "short" // user ID who died
  2502. // "attacker" "short" // user ID who killed
  2503. // "weapon" "string" // weapon name killer used
  2504. // "headshot" "bool" // signals a headshot
  2505. // "dominated" "short" // did killer dominate victim with this kill
  2506. // "revenge" "short" // did killer get revenge on victim with this kill
  2507.  
  2508. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2509. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2510.  
  2511. if ((victim > 0) && (attacker > 0)) {
  2512. if (attacker != victim) {
  2513. decl String: weapon_str[32];
  2514. GetEventString(event, "weapon", weapon_str, 32);
  2515. new weapon_index = get_weapon_index(css_weapon_list, MAX_CSS_WEAPON_COUNT, weapon_str);
  2516. if (weapon_index > -1) {
  2517. player_weapons[attacker][weapon_index][wkills]++;
  2518. new headshot = GetEventBool(event, "headshot");
  2519. if (headshot == 1) {
  2520. player_weapons[attacker][weapon_index][wheadshots]++;
  2521. }
  2522. player_weapons[victim][weapon_index][wdeaths]++;
  2523.  
  2524. if (GetEventInt(event, "dominated")) {
  2525. log_player_player_event(attacker, victim, "triggered", "domination");
  2526. } else if (GetEventInt(event, "revenge")) {
  2527. log_player_player_event(attacker, victim, "triggered", "revenge");
  2528. }
  2529.  
  2530.  
  2531. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2532. player_weapons[attacker][weapon_index][wteamkills]++;
  2533. if (gameme_plugin[damage_display] == 1) {
  2534. player_damage[attacker][victim][dteamkill] += 1;
  2535. }
  2536. }
  2537.  
  2538. if (gameme_plugin[damage_display] == 1) {
  2539. player_damage[attacker][victim][dhpleft] = GetClientHealth(attacker);
  2540. player_damage[attacker][victim][dkills] += 1;
  2541. player_damage[attacker][victim][dkiller] = attacker;
  2542. player_damage[attacker][victim][dweapon] = weapon_index;
  2543. if (headshot == 1) {
  2544. player_damage[attacker][victim][dheadshots] += 1;
  2545. }
  2546.  
  2547. if (gameme_plugin[damage_display_type] == 2) {
  2548. build_damage_chat(victim);
  2549. } else {
  2550. build_damage_panel(victim);
  2551. }
  2552.  
  2553. }
  2554. }
  2555. }
  2556. dump_player_data(victim);
  2557.  
  2558. gameme_players[victim][palive] = 0;
  2559. if (gameme_plugin[display_spectator] == 1) {
  2560. if ((IsClientInGame(victim)) && (!IsFakeClient(victim))) {
  2561. gameme_players[victim][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, victim, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2562. }
  2563.  
  2564. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2565. player_messages[j][attacker][supdated] = 1;
  2566. player_messages[j][victim][supdated] = 1;
  2567. }
  2568. }
  2569. }
  2570. }
  2571.  
  2572.  
  2573. public Event_DODSPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2574. {
  2575. // this extents the original player_death
  2576. // "userid" "short" // user ID who died
  2577. // "attacker" "short" // user ID who killed
  2578. // "weapon" "string" // weapon name killed used
  2579.  
  2580. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2581. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2582.  
  2583. if ((victim > 0) && (attacker > 0)) {
  2584. if (attacker != victim) {
  2585. decl String: weapon_str[32];
  2586. GetEventString(event, "weapon", weapon_str, 32);
  2587. new weapon_index = get_weapon_index(dods_weapon_list, MAX_DODS_WEAPON_COUNT, weapon_str);
  2588. if (weapon_index > -1) {
  2589. player_weapons[attacker][weapon_index][wkills]++;
  2590. player_weapons[victim][weapon_index][wdeaths]++;
  2591.  
  2592. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2593. player_weapons[attacker][weapon_index][wteamkills]++;
  2594. if (gameme_plugin[damage_display] == 1) {
  2595. player_damage[attacker][victim][dteamkill] += 1;
  2596. }
  2597. }
  2598.  
  2599. if (gameme_plugin[damage_display] == 1) {
  2600. player_damage[attacker][victim][dhpleft] = GetClientHealth(attacker);
  2601. player_damage[attacker][victim][dkills] += 1;
  2602. player_damage[attacker][victim][dkiller] = attacker;
  2603. player_damage[attacker][victim][dweapon] = weapon_index;
  2604.  
  2605. if (gameme_plugin[damage_display_type] == 2) {
  2606. build_damage_chat(victim);
  2607. } else {
  2608. build_damage_panel(victim);
  2609. }
  2610. }
  2611. }
  2612. }
  2613. dump_player_data(victim);
  2614. }
  2615. }
  2616.  
  2617.  
  2618. public Event_L4DPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2619. {
  2620. // "userid" "short" // user ID who died
  2621. // "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. $
  2622. // "attacker" "short" // user ID who killed
  2623. // "attackername" "string" // What type of zombie, so we don't have zombie names
  2624. // "attackerentid" "long" // if killer not a player, the entindex of who killed. Again, use attacker first
  2625. // "weapon" "string" // weapon name killer used
  2626. // "headshot" "bool" // signals a headshot
  2627. // "attackerisbot" "bool" // is the attacker a bot
  2628. // "victimname" "string" // What type of zombie, so we don't have zombie names
  2629. // "victimisbot" "bool" // is the victim a bot
  2630. // "abort" "bool" // did the victim abort
  2631. // "type" "long" // damage type
  2632. // "victim_x" "float"
  2633. // "victim_y" "float"
  2634. // "victim_z" "float"
  2635.  
  2636. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2637. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2638. if ((victim > 0) && (attacker > 0)) {
  2639. if (attacker != victim) {
  2640. decl String: weapon_str[32];
  2641. GetEventString(event, "weapon", weapon_str, 32);
  2642. new weapon_index = get_weapon_index(l4d_weapon_list, MAX_L4D_WEAPON_COUNT, weapon_str);
  2643. if (weapon_index > -1) {
  2644. player_weapons[attacker][weapon_index][wkills]++;
  2645. new headshot = GetEventBool(event, "headshot");
  2646. if (headshot == 1) {
  2647. player_weapons[attacker][weapon_index][wheadshots]++;
  2648. }
  2649. player_weapons[victim][weapon_index][wdeaths]++;
  2650.  
  2651. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2652. player_weapons[attacker][weapon_index][wteamkills]++;
  2653. }
  2654. }
  2655. }
  2656. dump_player_data(victim);
  2657. }
  2658. }
  2659.  
  2660.  
  2661. public Event_HL2MPPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2662. {
  2663. // this extents the original player_death by a new fields
  2664. // "userid" "short" // user ID who died
  2665. // "attacker" "short" // user ID who killed
  2666. // "weapon" "string" // weapon name killer used
  2667.  
  2668. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2669. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2670.  
  2671. if ((victim > 0) && (attacker > 0)) {
  2672. if (attacker != victim) {
  2673. decl String: weapon_str[32];
  2674. GetEventString(event, "weapon", weapon_str, 32);
  2675. new weapon_index = get_weapon_index(hl2mp_weapon_list, MAX_HL2MP_WEAPON_COUNT, weapon_str);
  2676. if (weapon_index > -1) {
  2677. player_weapons[attacker][weapon_index][wkills]++;
  2678. player_weapons[victim][weapon_index][wdeaths]++;
  2679. if ((hl2mp_data[teamplay_enabled]) && (GetClientTeam(attacker) == GetClientTeam(victim))) {
  2680. player_weapons[attacker][weapon_index][wteamkills]++;
  2681. }
  2682. }
  2683. }
  2684. dump_player_data(victim);
  2685. }
  2686. }
  2687.  
  2688.  
  2689. public Event_ZPSPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  2690. {
  2691. // this extents the original player_death by a new fields
  2692. // "userid" "short" // user ID who died
  2693. // "attacker" "short" // user ID who killed
  2694. // "weapon" "string" // weapon name killer used
  2695.  
  2696. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  2697. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  2698.  
  2699. if ((victim > 0) && (attacker > 0)) {
  2700. if (attacker != victim) {
  2701. decl String: weapon_str[32];
  2702. GetEventString(event, "weapon", weapon_str, 32);
  2703. new weapon_index = get_weapon_index(zps_weapon_list, MAX_ZPS_WEAPON_COUNT, weapon_str);
  2704. if (weapon_index > -1) {
  2705. player_weapons[attacker][weapon_index][wkills]++;
  2706. player_weapons[victim][weapon_index][wdeaths]++;
  2707. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  2708. player_weapons[attacker][weapon_index][wteamkills]++;
  2709. }
  2710. }
  2711. }
  2712. dump_player_data(victim);
  2713. }
  2714. }
  2715.  
  2716.  
  2717. public Event_CSGOPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2718. {
  2719. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2720. if (userid > 0) {
  2721. reset_player_data(userid);
  2722. if (gameme_plugin[display_spectator] == 1) {
  2723. if (gameme_players[userid][pspectator][stimer] != INVALID_HANDLE) {
  2724. KillTimer(gameme_players[userid][pspectator][stimer]);
  2725. gameme_players[userid][pspectator][stimer] = INVALID_HANDLE;
  2726. }
  2727. }
  2728.  
  2729.  
  2730. if (IsClientInGame(userid)) {
  2731. new client_team = GetClientTeam(userid);
  2732. if ((client_team == 2) || (client_team == 3)) {
  2733.  
  2734. decl String: client_model[128];
  2735. GetClientModel(userid, client_model, 128);
  2736.  
  2737. new role_index = -1;
  2738. for (new i = 0; (i < MAX_CSGO_CODE_MODELS); i++) {
  2739. if (StrContains(client_model, csgo_code_models[i]) != -1) {
  2740. role_index = i;
  2741. }
  2742. }
  2743.  
  2744. if (role_index > -1) {
  2745. if (gameme_players[userid][prole] != role_index) {
  2746. gameme_players[userid][prole] = role_index;
  2747. LogToGame("\"%L\" changed role to \"%s\"", userid, csgo_code_models[role_index]);
  2748. }
  2749. }
  2750.  
  2751. } else if (client_team == 0) {
  2752.  
  2753. if (gameme_plugin[display_spectator] == 1) {
  2754. gameme_players[userid][pspectator][starget] = 0;
  2755. if (!IsFakeClient(userid)) {
  2756. gameme_players[userid][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, userid, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2757. }
  2758. }
  2759.  
  2760. }
  2761. }
  2762.  
  2763. }
  2764. }
  2765.  
  2766.  
  2767. public Event_CSSPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2768. {
  2769. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2770. if (userid > 0) {
  2771. reset_player_data(userid);
  2772. if (gameme_plugin[display_spectator] == 1) {
  2773. if (gameme_players[userid][pspectator][stimer] != INVALID_HANDLE) {
  2774. KillTimer(gameme_players[userid][pspectator][stimer]);
  2775. gameme_players[userid][pspectator][stimer] = INVALID_HANDLE;
  2776. }
  2777. }
  2778.  
  2779.  
  2780. if (IsClientInGame(userid)) {
  2781. new client_team = GetClientTeam(userid);
  2782. if ((client_team == 2) || (client_team == 3)) {
  2783.  
  2784. decl String: client_model[128];
  2785. GetClientModel(userid, client_model, 128);
  2786.  
  2787. new role_index = -1;
  2788. if (client_team == 2) {
  2789. for (new i = 0; (i < MAX_CSS_TS_MODELS); i++) {
  2790. if (strcmp(css_ts_models[i], client_model) == 0) {
  2791. role_index = i;
  2792. }
  2793. }
  2794. } else if (client_team == 3) {
  2795. for (new i = 0; (i < MAX_CSS_CT_MODELS); i++) {
  2796. if (strcmp(css_ct_models[i], client_model) == 0) {
  2797. role_index = i + MAX_CSS_TS_MODELS;
  2798. }
  2799. }
  2800. }
  2801.  
  2802. if (role_index > -1) {
  2803. if (gameme_players[userid][prole] != role_index) {
  2804. gameme_players[userid][prole] = role_index;
  2805. LogToGame("\"%L\" changed role to \"%s\"", userid, css_code_models[role_index]);
  2806. }
  2807. }
  2808.  
  2809. } else if (client_team == 0) {
  2810.  
  2811. if (gameme_plugin[display_spectator] == 1) {
  2812. gameme_players[userid][pspectator][starget] = 0;
  2813.  
  2814. if (!IsFakeClient(userid)) {
  2815. gameme_players[userid][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, userid, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2816. }
  2817. }
  2818.  
  2819. }
  2820. }
  2821.  
  2822. }
  2823. }
  2824.  
  2825.  
  2826. public Event_L4DPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2827. {
  2828. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2829. if (userid > 0) {
  2830. reset_player_data(userid);
  2831. }
  2832. }
  2833.  
  2834.  
  2835. public Event_HL2MPPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2836. {
  2837. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2838. if (userid > 0) {
  2839. reset_player_data(userid);
  2840. }
  2841. }
  2842.  
  2843.  
  2844. public Event_ZPSPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  2845. {
  2846. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  2847. if (userid > 0) {
  2848. reset_player_data(userid);
  2849. }
  2850. }
  2851.  
  2852.  
  2853. public Action: Event_CSPRoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  2854. {
  2855. LogToGame("World triggered \"Round_Start\"");
  2856. }
  2857.  
  2858.  
  2859. public Event_CSGORoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  2860. {
  2861. if (gameme_plugin[display_spectator] == 1) {
  2862. for (new i = 1; (i <= MaxClients); i++) {
  2863. if (gameme_players[i][pspectator][stimer] != INVALID_HANDLE) {
  2864. KillTimer(gameme_players[i][pspectator][stimer]);
  2865. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  2866. }
  2867.  
  2868. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2869. player_messages[i][j][supdated] = 1;
  2870. }
  2871.  
  2872. if ((i > 0) && (IsClientInGame(i)) && (!IsFakeClient(i)) && (IsClientObserver(i))) {
  2873. gameme_players[i][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, i, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2874. }
  2875. }
  2876. }
  2877. if (gameme_plugin[live_active] == 1) {
  2878. for (new i = 1; (i <= MaxClients); i++) {
  2879. gameme_players[i][palive] = 1;
  2880. }
  2881. }
  2882. }
  2883.  
  2884.  
  2885. public Event_CSSRoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  2886. {
  2887. if (gameme_plugin[display_spectator] == 1) {
  2888. for (new i = 1; (i <= MaxClients); i++) {
  2889.  
  2890. if (gameme_players[i][pspectator][stimer] != INVALID_HANDLE) {
  2891. KillTimer(gameme_players[i][pspectator][stimer]);
  2892. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  2893. }
  2894.  
  2895. for (new j = 0; (j <= MAXPLAYERS); j++) {
  2896. player_messages[i][j][supdated] = 1;
  2897. }
  2898.  
  2899. if ((i > 0) && (IsClientInGame(i)) && (!IsFakeClient(i)) && (IsClientObserver(i))) {
  2900. gameme_players[i][pspectator][stimer] = CreateTimer(SPECTATOR_TIMER_INTERVAL, spectator_player_timer, i, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
  2901. }
  2902. }
  2903. }
  2904. if (gameme_plugin[live_active] == 1) {
  2905. for (new i = 1; (i <= MaxClients); i++) {
  2906. gameme_players[i][palive] = 1;
  2907. }
  2908. }
  2909. }
  2910.  
  2911.  
  2912. public Event_CSGORoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2913. {
  2914. for (new i = 1; (i <= MaxClients); i++) {
  2915. if ((IsClientConnected(i)) && (IsClientInGame(i)) && (IsPlayerAlive(i))) {
  2916. if (gameme_plugin[damage_display_type] == 1) {
  2917. build_damage_panel(i);
  2918. }
  2919. }
  2920. dump_player_data(i);
  2921. }
  2922. }
  2923.  
  2924.  
  2925. public Event_CSSRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2926. {
  2927. for (new i = 1; (i <= MaxClients); i++) {
  2928. if ((IsClientConnected(i)) && (IsClientInGame(i)) && (IsPlayerAlive(i))) {
  2929. if (gameme_plugin[damage_display_type] == 1) {
  2930. build_damage_panel(i);
  2931. }
  2932. }
  2933. dump_player_data(i);
  2934. }
  2935. }
  2936.  
  2937.  
  2938. public Event_DODSRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2939. {
  2940. for (new i = 1; (i <= MaxClients); i++) {
  2941. if ((IsClientConnected(i)) && (IsClientInGame(i)) && (IsPlayerAlive(i))) {
  2942. if (gameme_plugin[damage_display_type] == 1) {
  2943. build_damage_panel(i);
  2944. }
  2945. }
  2946. dump_player_data(i);
  2947. }
  2948. }
  2949.  
  2950.  
  2951. public Event_L4DRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2952. {
  2953. for (new i = 1; (i <= MaxClients); i++) {
  2954. dump_player_data(i);
  2955. }
  2956. }
  2957.  
  2958.  
  2959. public Event_HL2MPRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2960. {
  2961. for (new i = 1; (i <= MaxClients); i++) {
  2962. dump_player_data(i);
  2963. }
  2964. }
  2965.  
  2966.  
  2967. public Event_ZPSRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2968. {
  2969. for (new i = 1; (i <= MaxClients); i++) {
  2970. dump_player_data(i);
  2971. }
  2972. }
  2973.  
  2974.  
  2975. public Event_CSPRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  2976. {
  2977. new team_index = GetEventInt(event, "winners");
  2978. if (strcmp(team_list[team_index], "") != 0) {
  2979. log_team_event(team_list[team_index], "Round_Win");
  2980. }
  2981. LogToGame("World triggered \"Round_End\"");
  2982. }
  2983.  
  2984.  
  2985. public Event_CSGOAnnounceWarmup(Handle: event, const String: name[], bool:dontBroadcast)
  2986. {
  2987. LogToGame("World triggered \"Round_Warmup_Start\"");
  2988. }
  2989.  
  2990.  
  2991. public Event_CSGOAnnounceMatchStart(Handle: event, const String: name[], bool:dontBroadcast)
  2992. {
  2993. for (new i = 0; (i <= MAXPLAYERS); i++) {
  2994. reset_player_data(i);
  2995. gameme_players[i][pgglevel] = 0;
  2996. }
  2997. LogToGame("World triggered \"Round_Match_Start\"");
  2998. }
  2999.  
  3000.  
  3001. public Event_CSGOGGLevelUp(Handle: event, const String: name[], bool:dontBroadcast)
  3002. {
  3003. // "userid" "short" // player who leveled up
  3004. // "weaponrank" "short"
  3005. // "weaponname" "string" // name of weapon being awarded
  3006.  
  3007. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  3008. if (player > 0) {
  3009.  
  3010. new level = GetEventInt(event,"weaponrank");
  3011. if (level >= 0) {
  3012. if (level > gameme_players[player][pgglevel]) {
  3013. log_player_event(player, "triggered", "gg_levelup");
  3014. } else if (level < gameme_players[player][pgglevel]) {
  3015. log_player_event(player, "triggered", "gg_leveldown");
  3016. }
  3017. gameme_players[player][pgglevel] = level;
  3018. }
  3019. }
  3020. }
  3021.  
  3022.  
  3023. public Event_CSGOGGWin(Handle: event, const String: name[], bool:dontBroadcast)
  3024. {
  3025. // "playerid" "short" // user ID who achieved the final gun game weapon
  3026.  
  3027. new player = GetClientOfUserId(GetEventInt(event, "playerid"));
  3028. if (player > 0) {
  3029. log_player_event(player, "triggered", "gg_win");
  3030. }
  3031. }
  3032.  
  3033.  
  3034. public Event_CSGOGGLeader(Handle: event, const String: name[], bool:dontBroadcast)
  3035. {
  3036. // "playerid" "short" // user ID that is currently in the lead
  3037.  
  3038. new player = GetClientOfUserId(GetEventInt(event, "playerid"));
  3039. if (player > 0) {
  3040. log_player_event(player, "triggered", "gg_leader");
  3041. }
  3042. }
  3043.  
  3044.  
  3045. public Event_RoundMVP(Handle: event, const String: name[], bool:dontBroadcast)
  3046. {
  3047. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  3048. if (player > 0) {
  3049. log_player_event(player, "triggered", "mvp");
  3050. }
  3051. }
  3052.  
  3053.  
  3054. public Event_TF2PlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  3055. {
  3056. // "userid" "short" // user ID who died
  3057. // "attacker" "short" // user ID who killed
  3058. // "weapon" "string" // weapon name killer used
  3059. // "weaponid" "short" // ID of weapon killed used
  3060. // "damagebits" "long" // bits of type of damage
  3061. // "customkill" "short" // type of custom kill
  3062. // "assister" "short" // user ID of assister
  3063. // "weapon_logclassname" "string" // weapon name that should be printed on the log
  3064. // "stun_flags" "short" // victim's stun flags at the moment of death
  3065. // "death_flags" "short" //death flags.
  3066.  
  3067. new death_flags = GetEventInt(event, "death_flags");
  3068. if ((death_flags & TF_DEATHFLAG_DEADRINGER) == TF_DEATHFLAG_DEADRINGER) {
  3069. return;
  3070. }
  3071.  
  3072. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  3073. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  3074.  
  3075. if ((attacker > 0) && (victim > 0) && (attacker <= MaxClients)) {
  3076.  
  3077. tf2_players[victim][jump_status] = TF2_JUMP_NONE;
  3078. tf2_players[victim][carry_object] = false;
  3079.  
  3080. new custom_kill = GetEventInt(event, "customkill");
  3081. if (custom_kill > 0) {
  3082. new victim_team_index = GetClientTeam(victim);
  3083. new player_team_index = GetClientTeam(attacker);
  3084.  
  3085. if (victim_team_index == player_team_index) {
  3086. if (custom_kill == TF_CUSTOM_SUICIDE) {
  3087. log_player_event(attacker, "triggered", "force_suicide");
  3088. }
  3089. } else {
  3090. if (custom_kill == TF_CUSTOM_HEADSHOT) {
  3091. log_player_event(attacker, "triggered", "headshot");
  3092. } else if (custom_kill == TF_CUSTOM_BACKSTAB) {
  3093. log_player_player_event(attacker, victim, "triggered", "backstab");
  3094. }
  3095. }
  3096. }
  3097.  
  3098. if (attacker != victim) {
  3099. switch(tf2_players[attacker][jump_status]) {
  3100. case 2:
  3101. log_player_event(attacker, "triggered", "rocket_jump_kill");
  3102. case 3:
  3103. log_player_event(attacker, "triggered", "sticky_jump_kill");
  3104. }
  3105.  
  3106. new bits = GetEventInt(event, "damagebits");
  3107. if ((bits & DMG_ACID) && (attacker > 0) && (custom_kill != TF_CUSTOM_HEADSHOT)) {
  3108. log_player_event(attacker, "triggered", "crit_kill");
  3109. } else if (bits & DMG_DROWN) {
  3110. log_player_event(attacker, "triggered", "drowned");
  3111. }
  3112. if ((death_flags & TF_DEATHFLAG_FIRSTBLOOD) == TF_DEATHFLAG_FIRSTBLOOD) {
  3113. log_player_event(attacker, "triggered", "first_blood");
  3114. }
  3115. if ((custom_kill == TF_CUSTOM_HEADSHOT) && (victim <= MaxClients) && (IsClientInGame(victim)) && ((GetEntityFlags(victim) & (FL_ONGROUND | FL_INWATER)) == 0)) {
  3116. log_player_event(attacker, "triggered", "airshot_headshot");
  3117. }
  3118. }
  3119.  
  3120. decl String: weapon_log_name[64];
  3121. GetEventString(event, "weapon_logclassname", weapon_log_name, 64);
  3122. new weapon_index = get_tf2_weapon_index(weapon_log_name, attacker);
  3123. if (weapon_index != -1) {
  3124. player_weapons[attacker][weapon_index][wkills]++;
  3125. if (custom_kill == TF_CUSTOM_HEADSHOT) {
  3126. player_weapons[attacker][weapon_index][wheadshots]++;
  3127. }
  3128. player_weapons[victim][weapon_index][wdeaths]++;
  3129. if (GetClientTeam(victim) == GetClientTeam(attacker)) {
  3130. player_weapons[attacker][weapon_index][wteamkills]++;
  3131. }
  3132. }
  3133. dump_player_data(victim);
  3134. gameme_players[victim][palive] = 0;
  3135. }
  3136. }
  3137.  
  3138.  
  3139. public Event_TF2PlayerTeleported(Handle: event, const String: name[], bool:dontBroadcast)
  3140. {
  3141. // "userid" "short" // userid of the player
  3142. // "builderid" "short" // userid of the player who built the teleporter
  3143.  
  3144. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  3145. new builder = GetClientOfUserId(GetEventInt(event, "builderid"));
  3146. if (((player > 0) && (builder > 0)) && (player != builder)) {
  3147. log_player_player_event(builder, player, "triggered", "player_teleported", 1);
  3148. }
  3149. }
  3150.  
  3151.  
  3152. public OnGameFrame()
  3153. {
  3154. switch (gameme_plugin[mod_id]) {
  3155. case MOD_HL2MP: {
  3156. new bow_entity;
  3157. while (PopStackCell(hl2mp_data[boltchecks], bow_entity)) {
  3158. if (!IsValidEntity(bow_entity)) {
  3159. continue;
  3160. }
  3161. new owner = GetEntDataEnt2(bow_entity, hl2mp_data[crossbow_owner_offset]);
  3162. if ((owner < 0) || (owner > MaxClients)) {
  3163. continue;
  3164. }
  3165. player_weapons[owner][HL2MP_CROSSBOW][wshots]++;
  3166. }
  3167. }
  3168. case MOD_TF2: {
  3169. new entity;
  3170. if ((gameme_plugin[sdkhook_available]) && (tf2_data[stun_ball_id] > -1)) {
  3171. while (PopStackCell(tf2_data[stun_balls], entity)) {
  3172. if (IsValidEntity(entity)) {
  3173. new owner = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
  3174. if ((owner > 0) && (owner <= MaxClients)) {
  3175. player_weapons[owner][tf2_data[stun_ball_id]][wshots]++;
  3176. }
  3177. }
  3178. }
  3179. }
  3180.  
  3181. while (PopStackCell(tf2_data[wearables], entity)) {
  3182. if (IsValidEntity(entity)) {
  3183. new owner = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
  3184. if ((owner > 0) && (owner <= MaxClients)) {
  3185.  
  3186. new item_index = GetEntProp(entity, Prop_Send, "m_iItemDefinitionIndex");
  3187. decl String: tmp_str[16];
  3188. Format(tmp_str, 16, "%d", item_index);
  3189.  
  3190. if (KvJumpToKey(tf2_data[items_kv], tmp_str)) {
  3191. KvGetString(tf2_data[items_kv], "item_slot", tmp_str, 16);
  3192. new slot;
  3193. if (GetTrieValue(tf2_data[slots_trie], tmp_str, slot)) {
  3194. if ((slot == 0) && (tf2_players[owner][player_class] == TFClass_DemoMan)) {
  3195. slot++;
  3196. }
  3197. if (tf2_players[owner][player_loadout0][slot] != item_index) {
  3198. tf2_players[owner][player_loadout0][slot] = item_index;
  3199. tf2_players[owner][player_loadout_updated] = true;
  3200. }
  3201. tf2_players[owner][player_loadout1][slot] = entity;
  3202. }
  3203. KvGoBack(tf2_data[items_kv]);
  3204. }
  3205. }
  3206. }
  3207. }
  3208.  
  3209. new client_count = GetClientCount();
  3210. for (new i = 1; i <= client_count; i++) {
  3211. if ((IsClientInGame(i)) && (GetEntData(i, tf2_data[carry_offset], 1))) {
  3212. tf2_players[i][carry_object] = true;
  3213. }
  3214. }
  3215.  
  3216. }
  3217.  
  3218. }
  3219. }
  3220.  
  3221.  
  3222. public OnEntityCreated(entity, const String: classname[]) {
  3223. switch (gameme_plugin[mod_id]) {
  3224. case MOD_HL2MP: {
  3225. if (strcmp(classname, "crossbow_bolt") == 0) {
  3226. PushStackCell(hl2mp_data[boltchecks], entity);
  3227. }
  3228. }
  3229. case MOD_TF2: {
  3230. if(StrEqual(classname, "tf_projectile_stun_ball")) {
  3231. PushStackCell(tf2_data[stun_balls], EntIndexToEntRef(entity));
  3232. } else if(StrEqual(classname, "tf_wearable_item_demoshield") || StrEqual(classname, "tf_wearable_item")) {
  3233. PushStackCell(tf2_data[wearables], EntIndexToEntRef(entity));
  3234. }
  3235. }
  3236. }
  3237. }
  3238.  
  3239.  
  3240. public Action: OnClientCommandKeyValues(int client, KeyValues: kv)
  3241. {
  3242. if (gameme_plugin[mod_id] == MOD_CSGO) {
  3243. decl String: command[PLATFORM_MAX_PATH];
  3244. if ((KvGetSectionName(kv, command, sizeof(command))) && (StrEqual(command, "ClanTagChanged", false))) {
  3245. decl String: clan[192];
  3246. if (KvGetString(kv, "tag", clan, sizeof(clan), "")) {
  3247. if (strcmp(clan, "") != 0) {
  3248. log_player_settings(client, "triggered", "clantag", clan);
  3249. }
  3250. }
  3251. }
  3252. }
  3253. return Plugin_Continue;
  3254. }
  3255.  
  3256.  
  3257. public Action:OnTF2GameLog(const String: message[])
  3258. {
  3259. if (tf2_data[block_next_logging]) {
  3260. tf2_data[block_next_logging] = false;
  3261. return Plugin_Handled;
  3262. }
  3263. return Plugin_Continue;
  3264. }
  3265.  
  3266.  
  3267. public OnLogLocationsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3268. {
  3269. if (strcmp(newVal, "") != 0) {
  3270. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0)) {
  3271. if (((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3272. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3273.  
  3274. if (gameme_plugin[enable_log_locations] != INVALID_HANDLE) {
  3275. new enable_log_locations_cvar = GetConVarInt(gameme_plugin[enable_log_locations]);
  3276. if (enable_log_locations_cvar == 1) {
  3277. gameme_plugin[log_locations] = 1;
  3278. LogToGame("gameME location logging activated");
  3279. } else if (enable_log_locations_cvar == 0) {
  3280. gameme_plugin[log_locations] = 0;
  3281. LogToGame("gameME location logging deactivated");
  3282. }
  3283. } else {
  3284. gameme_plugin[log_locations] = 0;
  3285. }
  3286.  
  3287. }
  3288. }
  3289. }
  3290. }
  3291.  
  3292.  
  3293. public OnDisplaySpectatorinfoChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3294. {
  3295. if (strcmp(newVal, "") != 0) {
  3296. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0)) {
  3297. if (((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3298. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3299.  
  3300. if (gameme_plugin[display_spectatorinfo] != INVALID_HANDLE) {
  3301. new display_info = GetConVarInt(gameme_plugin[display_spectatorinfo]);
  3302. if (display_info == 1) {
  3303. gameme_plugin[display_spectator] = 1;
  3304. LogToGame("gameME spectator displaying activated");
  3305. } else if (display_info == 0) {
  3306. gameme_plugin[display_spectator] = 0;
  3307. for (new i = 0; (i <= MAXPLAYERS); i++) {
  3308. if (gameme_players[i][pspectator][stimer] != INVALID_HANDLE) {
  3309. KillTimer(gameme_players[i][pspectator][stimer]);
  3310. gameme_players[i][pspectator][stimer] = INVALID_HANDLE;
  3311. }
  3312. }
  3313. LogToGame("gameME spectator displaying deactivated");
  3314. }
  3315. } else {
  3316. gameme_plugin[display_spectator] = 0;
  3317. }
  3318. }
  3319. }
  3320. }
  3321. }
  3322.  
  3323.  
  3324. public OnDamageDisplayChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3325. {
  3326. if (strcmp(newVal, "") != 0) {
  3327. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0) || (strcmp(newVal, "2") == 0)) {
  3328.  
  3329. if (((strcmp(newVal, "2") == 0) && (strcmp(oldVal, "2") != 0)) ||
  3330. ((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3331. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3332.  
  3333. if (gameme_plugin[enable_damage_display] != INVALID_HANDLE) {
  3334. new enable_damage_display_cvar = GetConVarInt(gameme_plugin[enable_damage_display]);
  3335. if (enable_damage_display_cvar == 1) {
  3336. gameme_plugin[damage_display] = 1;
  3337. gameme_plugin[damage_display_type] = 1;
  3338. LogToGame("gameME damage display activated [Mode: Menu]");
  3339. } else if (enable_damage_display_cvar == 2) {
  3340. gameme_plugin[damage_display] = 1;
  3341. gameme_plugin[damage_display_type] = 2;
  3342. LogToGame("gameME damage display activated [Mode: Chat]");
  3343. } else if (enable_damage_display_cvar == 0) {
  3344. gameme_plugin[damage_display] = 0;
  3345. LogToGame("gameME damage display deactivated");
  3346. }
  3347. } else {
  3348. gameme_plugin[damage_display] = 0;
  3349. }
  3350.  
  3351. }
  3352. }
  3353. }
  3354. }
  3355.  
  3356.  
  3357. public OngameMELiveChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3358. {
  3359. if (strcmp(newVal, "") != 0) {
  3360. if ((strcmp(newVal, "0") == 0) || (strcmp(newVal, "1") == 0)) {
  3361.  
  3362. if (((strcmp(newVal, "1") == 0) && (strcmp(oldVal, "1") != 0)) ||
  3363. ((strcmp(newVal, "0") == 0) && (strcmp(oldVal, "0") != 0))) {
  3364.  
  3365. if (gameme_plugin[enable_gameme_live] != INVALID_HANDLE) {
  3366. if ((gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_CSGO)) {
  3367. if ((strcmp(gameme_plugin[gameme_live_address_value], "") != 0) &&
  3368. (strcmp(gameme_plugin[gameme_live_address_port], "") != 0)) {
  3369. new enable_gameme_live_cvar = GetConVarInt(gameme_plugin[enable_gameme_live]);
  3370. if (enable_gameme_live_cvar == 1) {
  3371. gameme_plugin[live_active] = 1;
  3372. start_gameme_live();
  3373. LogToGame("gameME Live! activated");
  3374. } else if (enable_gameme_live_cvar == 0) {
  3375. gameme_plugin[live_active] = 0;
  3376. if (gameme_plugin[live_socket] != INVALID_HANDLE) {
  3377. CloseHandle(gameme_plugin[live_socket]);
  3378. }
  3379. LogToGame("gameME Live! disabled");
  3380. }
  3381. } else {
  3382. if (strcmp(newVal, "1") == 0) {
  3383. SetConVarInt(gameme_plugin[enable_gameme_live], 0);
  3384. } else {
  3385. LogToGame("gameME Live! cannot be activated, no gameME Live! address assigned");
  3386. }
  3387. gameme_plugin[live_active] = 0;
  3388. }
  3389. }
  3390. }
  3391. }
  3392. }
  3393. }
  3394. }
  3395.  
  3396.  
  3397. public OnLiveAddressChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3398. {
  3399.  
  3400. if (strcmp(newVal, "") != 0) {
  3401. if (gameme_plugin[gameme_live_address] != INVALID_HANDLE) {
  3402. decl String: gameme_live_cvar_value[32];
  3403. GetConVarString(gameme_plugin[gameme_live_address], gameme_live_cvar_value, 32);
  3404. if (strcmp(gameme_live_cvar_value, "") != 0) {
  3405. decl String: SplitArray[2][16];
  3406. new split_count = ExplodeString(gameme_live_cvar_value, ":", SplitArray, 2, 16);
  3407. if (split_count == 2) {
  3408. strcopy(gameme_plugin[gameme_live_address_value], 32, SplitArray[0]);
  3409. gameme_plugin[gameme_live_address_port] = StringToInt(SplitArray[1]);
  3410. }
  3411. }
  3412. }
  3413. }
  3414. }
  3415.  
  3416.  
  3417. public OnTagsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3418. {
  3419. if (gameme_plugin[ignore_next_tag_change]){
  3420. return;
  3421. }
  3422.  
  3423. new count = GetArraySize(gameme_plugin[custom_tags]);
  3424. for (new i = 0; (i < count); i++) {
  3425. decl String: tag[128];
  3426. GetArrayString(gameme_plugin[custom_tags], i, tag, 128);
  3427. AddPluginServerTag(tag);
  3428. }
  3429. }
  3430.  
  3431.  
  3432. public OnProtectAddressChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3433. {
  3434.  
  3435. if (strcmp(newVal, "") != 0) {
  3436. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3437. decl String: protect_address_cvar_value[32];
  3438. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 32);
  3439. if (strcmp(protect_address_cvar_value, "") != 0) {
  3440. decl String: SplitArray[2][16];
  3441. new split_count = ExplodeString(protect_address_cvar_value, ":", SplitArray, 2, 16);
  3442. if (split_count == 2) {
  3443. strcopy(gameme_plugin[protect_address_value], 32, SplitArray[0]);
  3444. gameme_plugin[protect_address_port] = StringToInt(SplitArray[1]);
  3445. }
  3446. }
  3447.  
  3448. decl String: log_command[192];
  3449. Format(log_command, 192, "logaddress_add %s", newVal);
  3450. ServerCommand(log_command);
  3451.  
  3452. for (new i = 0; (i <= MAXPLAYERS); i++) {
  3453. gameme_players[i][prole] = -1;
  3454. }
  3455. }
  3456. }
  3457. }
  3458.  
  3459.  
  3460. public Action: ProtectLoggingChange(args)
  3461. {
  3462. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3463. decl String: protect_address_cvar_value[192];
  3464. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 192);
  3465. if (args >= 1) {
  3466. decl String: log_action[192];
  3467. GetCmdArg(1, log_action, 192);
  3468. if ((strcmp(log_action, "off") == 0) || (strcmp(log_action, "0") == 0)) {
  3469. if (strcmp(protect_address_cvar_value, "") != 0) {
  3470. LogToGame("gameME address protection active, logging reenabled!");
  3471. ServerCommand("log 1");
  3472. }
  3473. } else if ((strcmp(log_action, "on") == 0) || (strcmp(log_action, "1") == 0)) {
  3474. for (new i = 0; (i <= MAXPLAYERS); i++) {
  3475. gameme_players[i][prole] = -1;
  3476. }
  3477. }
  3478.  
  3479. }
  3480. }
  3481. return Plugin_Continue;
  3482. }
  3483.  
  3484.  
  3485. public Action: ProtectForwardingChange(args)
  3486. {
  3487. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3488. decl String: protect_address_cvar_value[32];
  3489. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 32);
  3490. if (strcmp(protect_address_cvar_value, "") != 0) {
  3491. if (args == 1) {
  3492. decl String: log_action[192];
  3493. GetCmdArg(1, log_action, 192);
  3494. if (strcmp(log_action, protect_address_cvar_value) == 0) {
  3495. decl String: log_command[192];
  3496. Format(log_command, 192, "logaddress_add %s", protect_address_cvar_value);
  3497. LogToGame("gameME address protection active, logaddress readded!");
  3498. ServerCommand(log_command);
  3499. }
  3500. } else if (args > 1) {
  3501. new String: log_action[192];
  3502. for (new i = 1; i <= args; i++) {
  3503. decl String: temp_argument[192];
  3504. GetCmdArg(i, temp_argument, 192);
  3505. strcopy(log_action[strlen(log_action)], 192, temp_argument);
  3506. }
  3507. if (strcmp(log_action, protect_address_cvar_value) == 0) {
  3508. decl String: log_command[192];
  3509. Format(log_command, 192, "logaddress_add %s", protect_address_cvar_value);
  3510. LogToGame("gameME address protection active, logaddress readded!");
  3511. ServerCommand(log_command);
  3512. }
  3513. }
  3514. }
  3515. }
  3516. return Plugin_Continue;
  3517. }
  3518.  
  3519.  
  3520. public Action: ProtectForwardingDelallChange(args)
  3521. {
  3522. if (gameme_plugin[protect_address] != INVALID_HANDLE) {
  3523. decl String: protect_address_cvar_value[32];
  3524. GetConVarString(gameme_plugin[protect_address], protect_address_cvar_value, 32);
  3525. if (strcmp(protect_address_cvar_value, "") != 0) {
  3526. decl String: log_command[192];
  3527. Format(log_command, 192, "logaddress_add %s", protect_address_cvar_value);
  3528. LogToGame("gameME address protection active, logaddress readded!");
  3529. ServerCommand(log_command);
  3530. }
  3531. }
  3532. return Plugin_Continue;
  3533. }
  3534.  
  3535.  
  3536. public OnBlockChatCommandsValuesChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3537. {
  3538. if (strcmp(newVal, "clear") == 0) {
  3539. ClearTrie(gameme_plugin[blocked_commands]);
  3540. LogToGame("Server triggered \"%s\"", "blocked_commands_cleared");
  3541. } else {
  3542. if (strcmp(newVal, "") != 0) {
  3543. decl String: BlockedCommands[32][64];
  3544. new block_commands_count = ExplodeString(String:newVal, " ", BlockedCommands, 32, 64);
  3545. for (new i = 0; (i < block_commands_count); i++) {
  3546. SetTrieValue(gameme_plugin[blocked_commands], BlockedCommands[i], 1);
  3547. }
  3548. }
  3549. }
  3550. }
  3551.  
  3552.  
  3553. public OnMessagePrefixChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3554. {
  3555. strcopy(gameme_plugin[message_prefix_value], 32, newVal);
  3556. color_gameme_entities(gameme_plugin[message_prefix_value]);
  3557. }
  3558.  
  3559.  
  3560. public Action: MessagePrefixClear(args)
  3561. {
  3562. strcopy(gameme_plugin[message_prefix_value], 32, "");
  3563. }
  3564.  
  3565.  
  3566. public OnTeamPlayChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3567. {
  3568. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  3569. hl2mp_data[teamplay_enabled] = GetConVarBool(hl2mp_data[teamplay]);
  3570. }
  3571. }
  3572.  
  3573.  
  3574. public OnTF2CriticalHitsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
  3575. {
  3576. tf2_data[critical_hits_enabled] = GetConVarBool(tf2_data[critical_hits]);
  3577. if(!tf2_data[critical_hits_enabled]) {
  3578. for(new i = 1; i <= MaxClients; i++) {
  3579. dump_player_data(i);
  3580. }
  3581. }
  3582. }
  3583.  
  3584.  
  3585. public Action: TF2_CalcIsAttackCritical(attacker, weapon, String: weaponname[], &bool: result)
  3586. {
  3587. if ((gameme_plugin[sdkhook_available]) && (attacker > 0) && (attacker <= MaxClients)) {
  3588. new weapon_index = get_tf2_weapon_index(weaponname[TF2_WEAPON_PREFIX_LENGTH], attacker);
  3589. if (weapon_index != -1) {
  3590. player_weapons[attacker][weapon_index][wshots]++;
  3591. }
  3592. }
  3593. return Plugin_Continue;
  3594. }
  3595.  
  3596.  
  3597. log_player_settings(client, String: verb[32], const String: settings_name[], const String: settings_value[])
  3598. {
  3599. if (client > 0) {
  3600. LogToGame("\"%L\" %s \"%s\" (value \"%s\")", client, verb, settings_name, settings_value);
  3601. } else {
  3602. LogToGame("\"%s\" %s \"%s\" (value \"%s\")", "Server", verb, settings_name, settings_value);
  3603. }
  3604. }
  3605.  
  3606.  
  3607. log_player_event(client, String: verb[32], String: player_event[192], additional_player = 0, display_location = 0)
  3608. {
  3609. if (client > 0) {
  3610. if (display_location > 0) {
  3611. new Float: player_origin[3];
  3612. GetClientAbsOrigin(client, player_origin);
  3613. if ((additional_player > 0) && (client != additional_player)) {
  3614. 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);
  3615. } else {
  3616. LogToGame("\"%L\" %s \"%s\" (position \"%d %d %d\")", client, verb, player_event, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));
  3617. }
  3618. } else {
  3619. if ((additional_player > 0) && (client != additional_player)) {
  3620. LogToGame("\"%L\" %s \"%s\" (player \"%L\")", client, verb, player_event, additional_player);
  3621. } else {
  3622. LogToGame("\"%L\" %s \"%s\"", client, verb, player_event);
  3623. }
  3624. }
  3625. }
  3626. }
  3627.  
  3628.  
  3629. log_player_player_event(client, victim, String: verb[32], String: player_event[192], display_location = 0)
  3630. {
  3631. if ((client > 0) && (victim > 0)) {
  3632. if (display_location > 0) {
  3633. new Float: player_origin[3];
  3634. GetClientAbsOrigin(client, player_origin);
  3635.  
  3636. new Float: victim_origin[3];
  3637. GetClientAbsOrigin(victim, victim_origin);
  3638.  
  3639. 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]));
  3640. } else {
  3641. LogToGame("\"%L\" %s \"%s\" against \"%L\"", client, verb, player_event, victim);
  3642. }
  3643. }
  3644. }
  3645.  
  3646.  
  3647. log_team_event(String: team_name[32], String: team_action[192], String: team_objective[192] = "")
  3648. {
  3649. if (strcmp(team_name, "") != 0) {
  3650. if (strcmp(team_objective, "") != 0) {
  3651. LogToGame("Team \"%s\" triggered \"%s\" (object \"%s\")", team_name, team_action, team_objective);
  3652. } else {
  3653. LogToGame("Team \"%s\" triggered \"%s\"", team_name, team_action);
  3654. }
  3655. }
  3656. }
  3657.  
  3658.  
  3659. log_player_location(String: event[32], client, additional_player = 0)
  3660. {
  3661. if (client > 0) {
  3662. new Float: player_origin[3];
  3663. GetClientAbsOrigin(client, player_origin);
  3664. if ((additional_player > 0) && (client != additional_player)) {
  3665. new Float: additional_player_origin[3];
  3666. GetClientAbsOrigin(additional_player, additional_player_origin);
  3667. 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]));
  3668. } else {
  3669. LogToGame("\"%L\" located on \"%s\" (position \"%d %d %d\")", client, event, RoundFloat(player_origin[0]), RoundFloat(player_origin[1]), RoundFloat(player_origin[2]));
  3670. }
  3671. }
  3672. }
  3673.  
  3674.  
  3675. find_player_team_slot(team_index)
  3676. {
  3677. if (team_index > -1) {
  3678. ColorSlotArray[team_index] = -1;
  3679. for (new i = 1; i <= MaxClients; i++) {
  3680. if ((IsClientInGame(i)) && (GetClientTeam(i) == team_index)) {
  3681. ColorSlotArray[team_index] = i;
  3682. break;
  3683. }
  3684. }
  3685. }
  3686. }
  3687.  
  3688.  
  3689. stock validate_team_colors()
  3690. {
  3691. for (new i = 0; (i < sizeof(ColorSlotArray)); i++) {
  3692. new color_client = ColorSlotArray[i];
  3693. if (color_client > 0) {
  3694. if ((IsClientInGame(color_client)) && (GetClientTeam(color_client) != color_client)) {
  3695. find_player_team_slot(i);
  3696. }
  3697. } else {
  3698. if ((i == 2) || (i == 3)) {
  3699. find_player_team_slot(i);
  3700. }
  3701. }
  3702. }
  3703. }
  3704.  
  3705.  
  3706. public native_color_gameme_entities(Handle: plugin, numParams)
  3707. {
  3708. if (numParams < 1) {
  3709. return 0;
  3710. }
  3711.  
  3712. new message_length;
  3713. GetNativeStringLength(1, message_length);
  3714. if (message_length <= 0) {
  3715. return 0;
  3716. }
  3717.  
  3718. new String: message[message_length + 1];
  3719. GetNativeString(1, message, message_length + 1);
  3720.  
  3721. color_gameme_entities(message);
  3722. SetNativeString(1, message, strlen(message) + 1);
  3723.  
  3724. return 1;
  3725. }
  3726.  
  3727.  
  3728. color_gameme_entities(String: message[])
  3729. {
  3730. ReplaceString(message, 192, "x08", "\x08");
  3731. ReplaceString(message, 192, "x07", "\x07");
  3732. ReplaceString(message, 192, "x05", "\x05");
  3733. ReplaceString(message, 192, "x04", "\x04");
  3734. ReplaceString(message, 192, "x03", "\x03");
  3735. ReplaceString(message, 192, "x01", "\x01");
  3736. ReplaceString(message, 192, "x||0", "x0");
  3737. }
  3738.  
  3739.  
  3740. public OnClientDisconnect(client)
  3741. {
  3742. if (client > 0) {
  3743. 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)) {
  3744. dump_player_data(client);
  3745. reset_player_data(client);
  3746. }
  3747. if (IsClientInGame(client)) {
  3748. 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)) {
  3749. new team_index = GetClientTeam(client);
  3750. if (client == ColorSlotArray[team_index]) {
  3751. ColorSlotArray[team_index] = -1;
  3752. }
  3753. }
  3754. }
  3755.  
  3756. if ((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS)) {
  3757. if (gameme_players[client][pspectator][stimer] != INVALID_HANDLE) {
  3758. KillTimer(gameme_players[client][pspectator][stimer]);
  3759. gameme_players[client][pspectator][stimer] = INVALID_HANDLE;
  3760. }
  3761. for (new j = 0; (j <= MAXPLAYERS); j++) {
  3762. player_messages[j][client][supdated] = 1;
  3763. strcopy(player_messages[j][client][smessage], 255, "");
  3764. }
  3765. }
  3766.  
  3767. }
  3768. }
  3769.  
  3770.  
  3771. stock get_team_index(String: team_name[])
  3772. {
  3773. new loop_break = 0;
  3774. new index = 0;
  3775. while ((loop_break == 0) && (index < sizeof(team_list))) {
  3776. if (strcmp(team_name, team_list[index], true) == 0) {
  3777. loop_break++;
  3778. }
  3779. index++;
  3780. }
  3781. if (loop_break == 0) {
  3782. return -1;
  3783. } else {
  3784. return index - 1;
  3785. }
  3786. }
  3787.  
  3788.  
  3789. public native_display_menu(Handle: plugin, numParams)
  3790. {
  3791. if (numParams < 4) {
  3792. return;
  3793. }
  3794.  
  3795. new client = GetNativeCell(1);
  3796. new time = GetNativeCell(2);
  3797.  
  3798. new message_length;
  3799. GetNativeStringLength(3, message_length);
  3800. if (message_length <= 0) {
  3801. return;
  3802. }
  3803. new String: message[message_length + 1];
  3804. GetNativeString(3, message, message_length + 1);
  3805.  
  3806. new handler = GetNativeCell(4);
  3807. display_menu(client, time, message, handler);
  3808.  
  3809. return;
  3810. }
  3811.  
  3812.  
  3813. display_menu(player_index, time, String: full_message[], need_handler = 0)
  3814. {
  3815. ReplaceString(full_message, 1024, "\\n", "\10");
  3816. if (need_handler == 0) {
  3817. InternalShowMenu(player_index, full_message, time);
  3818. } else {
  3819. 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);
  3820. }
  3821. }
  3822.  
  3823.  
  3824. public InternalMenuHandler(Handle:menu, MenuAction: action, param1, param2)
  3825. {
  3826. new client = param1;
  3827. if (IsClientInGame(client)) {
  3828. if (action == MenuAction_Select) {
  3829. decl String: player_event[192];
  3830. IntToString(param2, player_event, 192);
  3831. log_player_event(client, "selected", player_event);
  3832. } else if (action == MenuAction_Cancel) {
  3833. new String: player_event[192] = "cancel";
  3834. log_player_event(client, "selected", player_event);
  3835. }
  3836. }
  3837. }
  3838.  
  3839.  
  3840. get_param(index, argument_count)
  3841. {
  3842. decl String: param[128];
  3843. if (index <= argument_count) {
  3844. GetCmdArg(index, param, 128);
  3845. return StringToInt(param);
  3846. }
  3847. return -1;
  3848. }
  3849.  
  3850.  
  3851. get_query_id()
  3852. {
  3853. global_query_id++;
  3854. if (global_query_id > 65535) {
  3855. global_query_id = 1;
  3856. }
  3857. return global_query_id;
  3858. }
  3859.  
  3860.  
  3861. find_callback(query_id)
  3862. {
  3863. new index = -1;
  3864. new size = GetArraySize(QueryCallbackArray);
  3865.  
  3866. for (new i = 0; i < size; i++) {
  3867. decl data[callback_data];
  3868. GetArrayArray(QueryCallbackArray, i, data, sizeof(data));
  3869. if ((data[callback_data_id] == query_id) && (data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  3870. index = i;
  3871. break;
  3872. }
  3873. }
  3874. return index;
  3875. }
  3876.  
  3877.  
  3878. public native_query_gameme_stats(Handle: plugin, numParams)
  3879. {
  3880. if (numParams < 4) {
  3881. return;
  3882. }
  3883. decl String: cb_type[255];
  3884. GetNativeString(1, cb_type, 255);
  3885. new cb_client = GetNativeCell(2);
  3886. new Function: cb_function = GetNativeCell(3);
  3887. new cb_payload = GetNativeCell(4);
  3888.  
  3889. new cb_limit = 1;
  3890. if (numParams >= 5) {
  3891. cb_limit = GetNativeCell(5);
  3892. }
  3893.  
  3894. if (cb_client < 1) {
  3895. new queryid = get_query_id();
  3896.  
  3897. decl data[callback_data];
  3898. data[callback_data_id] = queryid;
  3899. data[callback_data_time] = GetGameTime();
  3900. data[callback_data_client] = cb_client;
  3901. data[callback_data_plugin] = plugin;
  3902. data[callback_data_function] = cb_function;
  3903. data[callback_data_payload] = cb_payload;
  3904. data[callback_data_limit] = cb_limit;
  3905. if (QueryCallbackArray != INVALID_HANDLE) {
  3906. PushArrayArray(QueryCallbackArray, data);
  3907. }
  3908.  
  3909. new String: query_payload[32];
  3910. IntToString(queryid, query_payload, 32);
  3911. log_player_settings(cb_client, "requested", cb_type, query_payload);
  3912. } else {
  3913. if (IsClientInGame(cb_client)) {
  3914. new userid = GetClientUserId(cb_client);
  3915. if (userid > 0) {
  3916. new queryid = get_query_id();
  3917.  
  3918. decl data[callback_data];
  3919. data[callback_data_id] = queryid;
  3920. data[callback_data_time] = GetGameTime();
  3921. data[callback_data_client] = cb_client;
  3922. data[callback_data_plugin] = plugin;
  3923. data[callback_data_function] = cb_function;
  3924. data[callback_data_payload] = cb_payload;
  3925. data[callback_data_limit] = cb_limit;
  3926.  
  3927. if (QueryCallbackArray != INVALID_HANDLE) {
  3928. PushArrayArray(QueryCallbackArray, data);
  3929.  
  3930. new String: query_payload[32];
  3931. IntToString(queryid, query_payload, 32);
  3932. log_player_settings(cb_client, "requested", cb_type, query_payload);
  3933. }
  3934. }
  3935. }
  3936. }
  3937. }
  3938.  
  3939.  
  3940. public Action: gameme_raw_message(args)
  3941. {
  3942.  
  3943. if (args < 1) {
  3944. PrintToServer("Usage: gameme_raw_message <type><array> - retrieve internal gameME Stats data");
  3945. return Plugin_Handled;
  3946. }
  3947.  
  3948. new argument_count = GetCmdArgs();
  3949. new type = get_param(1, argument_count);
  3950. switch (type) {
  3951.  
  3952. case RAW_MESSAGE_CALLBACK_PLAYER, RAW_MESSAGE_RANK, RAW_MESSAGE_PLACE, RAW_MESSAGE_KDEATH, RAW_MESSAGE_SESSION_DATA: {
  3953. if (argument_count >= 48) {
  3954. new query_id = get_param(2, argument_count);
  3955. new userid = get_param(3, argument_count);
  3956. new client = GetClientOfUserId(userid);
  3957. if (client > 0) {
  3958.  
  3959. new Handle: pack = CreateDataPack();
  3960.  
  3961. // total values
  3962. WritePackCell(pack, get_param(4, argument_count)); // rank
  3963. WritePackCell(pack, get_param(5, argument_count)); // players
  3964. WritePackCell(pack, get_param(6, argument_count)); // skill
  3965. WritePackCell(pack, get_param(7, argument_count)); // kills
  3966. WritePackCell(pack, get_param(8, argument_count)); // deaths
  3967.  
  3968. decl String: kpd_param[16];
  3969. GetCmdArg(9, kpd_param, 16);
  3970. WritePackFloat(pack, StringToFloat(kpd_param)); // kpd
  3971.  
  3972. WritePackCell(pack, get_param(10, argument_count)); // suicides
  3973. WritePackCell(pack, get_param(11, argument_count)); // headshots
  3974.  
  3975. decl String: hpk_param[16];
  3976. GetCmdArg(12, hpk_param, 16);
  3977. WritePackFloat(pack, StringToFloat(hpk_param)); // hpk
  3978.  
  3979. decl String: acc_param[16];
  3980. GetCmdArg(13, acc_param, 16);
  3981. WritePackFloat(pack, StringToFloat(acc_param)); // accuracy
  3982.  
  3983. WritePackCell(pack, get_param(14, argument_count)); // connection_time
  3984. WritePackCell(pack, get_param(15, argument_count)); // kill_assists
  3985. WritePackCell(pack, get_param(16, argument_count)); // kills_assisted
  3986. WritePackCell(pack, get_param(17, argument_count)); // points_healed
  3987. WritePackCell(pack, get_param(18, argument_count)); // flags_captured
  3988. WritePackCell(pack, get_param(19, argument_count)); // custom_wins
  3989. WritePackCell(pack, get_param(20, argument_count)); // kill_streak
  3990. WritePackCell(pack, get_param(21, argument_count)); // death_streak
  3991.  
  3992. // session values
  3993. WritePackCell(pack, get_param(22, argument_count)); // session_pos_change
  3994. WritePackCell(pack, get_param(23, argument_count)); // session_skill_change
  3995. WritePackCell(pack, get_param(24, argument_count)); // session_kills
  3996. WritePackCell(pack, get_param(25, argument_count)); // session_deaths
  3997.  
  3998. decl String: session_kpd_param[16];
  3999. GetCmdArg(26, session_kpd_param, 16);
  4000. WritePackFloat(pack, StringToFloat(session_kpd_param)); // session_kpd
  4001.  
  4002. WritePackCell(pack, get_param(27, argument_count)); // session_suicides
  4003. WritePackCell(pack, get_param(28, argument_count)); // session_headshots
  4004.  
  4005. decl String: session_hpk_param[16];
  4006. GetCmdArg(29, session_hpk_param, 16);
  4007. WritePackFloat(pack, StringToFloat(session_hpk_param)); // session_hpk
  4008.  
  4009. decl String: session_acc_param[16];
  4010. GetCmdArg(30, session_acc_param, 16);
  4011. WritePackFloat(pack, StringToFloat(session_acc_param)); // session_accuracy
  4012.  
  4013. WritePackCell(pack, get_param(31, argument_count)); // session_time
  4014. WritePackCell(pack, get_param(32, argument_count)); // session_kill_assists
  4015. WritePackCell(pack, get_param(33, argument_count)); // session_kills_assisted
  4016. WritePackCell(pack, get_param(34, argument_count)); // session_points_healed
  4017. WritePackCell(pack, get_param(35, argument_count)); // session_flags_captured
  4018. WritePackCell(pack, get_param(36, argument_count)); // session_custom_wins
  4019. WritePackCell(pack, get_param(37, argument_count)); // session_kill_streak
  4020. WritePackCell(pack, get_param(38, argument_count)); // session_death_streak
  4021.  
  4022. decl String: session_fav_weapon[32];
  4023. GetCmdArg(39, session_fav_weapon, 32);
  4024. if (StrEqual(session_fav_weapon, "-")) {
  4025. session_fav_weapon = "No Fav Weapon";
  4026. }
  4027. WritePackString(pack, session_fav_weapon); // fav weapons
  4028.  
  4029. // global values
  4030. WritePackCell(pack, get_param(40, argument_count)); // global_rank
  4031. WritePackCell(pack, get_param(41, argument_count)); // global_players
  4032. WritePackCell(pack, get_param(42, argument_count)); // global_kills
  4033. WritePackCell(pack, get_param(43, argument_count)); // global_deaths
  4034.  
  4035. decl String: global_kpd_param[16];
  4036. GetCmdArg(44, global_kpd_param, 16);
  4037. WritePackFloat(pack, StringToFloat(global_kpd_param)); // global_kpd
  4038.  
  4039. WritePackCell(pack, get_param(45, argument_count)); // global_headshots
  4040.  
  4041. decl String: global_hpk_param[16];
  4042. GetCmdArg(46, global_hpk_param, 16);
  4043. WritePackFloat(pack, StringToFloat(global_hpk_param)); // global_hpk
  4044.  
  4045. // country
  4046. decl String: country_code[16];
  4047. GetCmdArg(47, country_code, 16);
  4048. WritePackString(pack, country_code); // player country
  4049.  
  4050.  
  4051. decl Action: result;
  4052. if (type == RAW_MESSAGE_CALLBACK_PLAYER) {
  4053. if (query_id > 0) {
  4054. new cb_array_index = find_callback(query_id);
  4055. if (cb_array_index >= 0) {
  4056. decl data[callback_data];
  4057. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4058. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4059. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4060. Call_PushCell(RAW_MESSAGE_CALLBACK_PLAYER);
  4061.  
  4062. Call_PushCell(data[callback_data_payload]);
  4063. Call_PushCell(client);
  4064.  
  4065. Call_PushCellRef(pack);
  4066. Call_Finish(_:result);
  4067.  
  4068. if (data[callback_data_limit] == 1) {
  4069. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4070. }
  4071. }
  4072. }
  4073. }
  4074. } else {
  4075. switch (type) {
  4076. case RAW_MESSAGE_RANK: {
  4077. Call_StartForward(gameMEStatsRankForward);
  4078. Call_PushCell(RAW_MESSAGE_RANK);
  4079. }
  4080. case RAW_MESSAGE_PLACE: {
  4081. Call_StartForward(gameMEStatsPublicCommandForward);
  4082. Call_PushCell(RAW_MESSAGE_PLACE);
  4083. }
  4084. case RAW_MESSAGE_KDEATH: {
  4085. Call_StartForward(gameMEStatsPublicCommandForward);
  4086. Call_PushCell(RAW_MESSAGE_KDEATH);
  4087. }
  4088. case RAW_MESSAGE_SESSION_DATA: {
  4089. Call_StartForward(gameMEStatsPublicCommandForward);
  4090. Call_PushCell(RAW_MESSAGE_SESSION_DATA);
  4091. }
  4092. }
  4093. Call_PushCell(client);
  4094. Call_PushString(gameme_plugin[message_prefix_value]);
  4095.  
  4096. Call_PushCellRef(pack);
  4097. Call_Finish(_: result);
  4098. }
  4099.  
  4100. CloseHandle(pack);
  4101. }
  4102.  
  4103. }
  4104. }
  4105. case RAW_MESSAGE_CALLBACK_TOP10, RAW_MESSAGE_TOP10: {
  4106. if (argument_count >= 4) {
  4107. new query_id = get_param(2, argument_count);
  4108. new userid = get_param(3, argument_count);
  4109. if (((userid > 0) && (type == RAW_MESSAGE_TOP10)) ||
  4110. ((userid == -1) && (type == RAW_MESSAGE_CALLBACK_TOP10))) {
  4111.  
  4112. new client = GetClientOfUserId(userid);
  4113. if ((client < 1) && (type == RAW_MESSAGE_TOP10)) {
  4114. return Plugin_Handled;
  4115. }
  4116.  
  4117. new Handle: pack = CreateDataPack();
  4118. if (argument_count == 4) {
  4119. WritePackCell(pack, -1); // total_players
  4120. } else {
  4121. new count = 0;
  4122. for (new i = 4; (i <= argument_count); i++) {
  4123. if (((i + 3) <= argument_count)) {
  4124. count++;
  4125. i = i + 3;
  4126. }
  4127. }
  4128. WritePackCell(pack, count); // total_players
  4129.  
  4130. new rank = 0;
  4131. for (new i = 4; (i <= argument_count); i++) {
  4132. if (((i + 3) <= argument_count)) {
  4133. rank++;
  4134.  
  4135. WritePackCell(pack, rank); // rank
  4136. WritePackCell(pack, get_param(i, argument_count)); // skill
  4137.  
  4138. decl String: name[64];
  4139. GetCmdArg((i + 1), name, 64);
  4140. WritePackString(pack, name); // name
  4141.  
  4142. decl String: kpd_param[16];
  4143. GetCmdArg((i + 2), kpd_param, 16);
  4144. WritePackFloat(pack, StringToFloat(kpd_param)); // kpd
  4145.  
  4146. decl String: hpk_param[16];
  4147. GetCmdArg((i + 3), hpk_param, 16);
  4148. WritePackFloat(pack, StringToFloat(hpk_param)); // hpk
  4149.  
  4150. i = i + 3;
  4151. }
  4152. }
  4153. }
  4154.  
  4155. decl Action: result;
  4156. if (type == RAW_MESSAGE_CALLBACK_TOP10) {
  4157. if (query_id > 0) {
  4158. new cb_array_index = find_callback(query_id);
  4159. if (cb_array_index >= 0) {
  4160. decl data[callback_data];
  4161. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4162. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4163. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4164. Call_PushCell(RAW_MESSAGE_CALLBACK_TOP10);
  4165. Call_PushCell(data[callback_data_payload]);
  4166. Call_PushCellRef(pack);
  4167. Call_Finish(_:result);
  4168.  
  4169. if (data[callback_data_limit] == 1) {
  4170. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4171. }
  4172. }
  4173. }
  4174. }
  4175. } else {
  4176.  
  4177. Call_StartForward(gameMEStatsTop10Forward);
  4178. Call_PushCell(RAW_MESSAGE_TOP10);
  4179. Call_PushCell(client);
  4180. Call_PushString(gameme_plugin[message_prefix_value]);
  4181. Call_PushCellRef(pack);
  4182. Call_Finish(_:result);
  4183.  
  4184. }
  4185.  
  4186. CloseHandle(pack);
  4187. }
  4188. }
  4189. }
  4190. case RAW_MESSAGE_CALLBACK_NEXT, RAW_MESSAGE_NEXT: {
  4191. if (argument_count >= 4) {
  4192. new query_id = get_param(2, argument_count);
  4193. new userid = get_param(3, argument_count);
  4194. new client = GetClientOfUserId(userid);
  4195. if (client > 0) {
  4196.  
  4197. new Handle: pack = CreateDataPack();
  4198.  
  4199. if (argument_count == 4) {
  4200. WritePackCell(pack, -1); // total_players
  4201. } else {
  4202. new count = 0;
  4203. for (new i = 4; (i <= argument_count); i++) {
  4204. if (((i + 4) <= argument_count)) {
  4205. count++;
  4206. i = i + 4;
  4207. }
  4208. }
  4209. WritePackCell(pack, count); // total_players
  4210.  
  4211. for (new i = 4; (i <= argument_count); i++) {
  4212. if (((i + 4) <= argument_count)) {
  4213.  
  4214. WritePackCell(pack, get_param(i, argument_count)); // rank
  4215. WritePackCell(pack, get_param((i + 1), argument_count)); // skill
  4216.  
  4217. decl String: name[64];
  4218. GetCmdArg((i + 2), name, 64);
  4219. WritePackString(pack, name); // name
  4220.  
  4221. decl String: kpd_param[16];
  4222. GetCmdArg((i + 3), kpd_param, 16);
  4223. WritePackFloat(pack, StringToFloat(kpd_param)); // kpd
  4224.  
  4225. decl String: hpk_param[16];
  4226. GetCmdArg((i + 4), hpk_param, 16);
  4227. WritePackFloat(pack, StringToFloat(hpk_param)); // hpk
  4228.  
  4229. i = i + 4;
  4230. }
  4231. }
  4232. }
  4233.  
  4234. decl Action: result;
  4235. if (type == RAW_MESSAGE_CALLBACK_NEXT) {
  4236. if (query_id > 0) {
  4237. new cb_array_index = find_callback(query_id);
  4238. if (cb_array_index >= 0) {
  4239. decl data[callback_data];
  4240. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4241. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4242. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4243. Call_PushCell(RAW_MESSAGE_CALLBACK_NEXT);
  4244. Call_PushCell(data[callback_data_payload]);
  4245. Call_PushCell(client);
  4246. Call_PushCellRef(pack);
  4247. Call_Finish(_:result);
  4248.  
  4249. if (data[callback_data_limit] == 1) {
  4250. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4251. }
  4252. }
  4253. }
  4254. }
  4255. } else {
  4256.  
  4257. Call_StartForward(gameMEStatsNextForward);
  4258. Call_PushCell(RAW_MESSAGE_NEXT);
  4259. Call_PushCell(client);
  4260. Call_PushString(gameme_plugin[message_prefix_value]);
  4261. Call_PushCellRef(pack);
  4262. Call_Finish(_:result);
  4263.  
  4264. }
  4265. CloseHandle(pack);
  4266. }
  4267. }
  4268. }
  4269. case RAW_MESSAGE_CALLBACK_INT_CLOSE: {
  4270. if (argument_count >= 2) {
  4271. new query_id = get_param(2, argument_count);
  4272. new cb_array_index = find_callback(query_id);
  4273. if (cb_array_index >= 0) {
  4274. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4275. }
  4276. }
  4277. }
  4278. case RAW_MESSAGE_CALLBACK_INT_SPECTATOR: {
  4279. if (argument_count >= 5) {
  4280. new query_id = get_param(2, argument_count);
  4281.  
  4282. new caller[MAXPLAYERS + 1] = {-1, ...};
  4283. decl String: caller_id[512];
  4284. GetCmdArg(3, caller_id, 512);
  4285. if (StrContains(caller_id, ",") > -1) {
  4286. decl String: CallerRecipients[MaxClients][16];
  4287. new recipient_count = ExplodeString(caller_id, ",", CallerRecipients, MaxClients, 16);
  4288. for (new i = 0; (i < recipient_count); i++) {
  4289. caller[i] = GetClientOfUserId(StringToInt(CallerRecipients[i]));
  4290. }
  4291. } else {
  4292. caller[0] = GetClientOfUserId(StringToInt(caller_id));
  4293. }
  4294.  
  4295. new target[MAXPLAYERS + 1] = {-1, ...};
  4296. decl String: target_id[512];
  4297. GetCmdArg(4, target_id, 512);
  4298. if (StrContains(target_id, ",") > -1) {
  4299. decl String: TargetRecipients[MaxClients][16];
  4300. new recipient_count = ExplodeString(target_id, ",", TargetRecipients, MaxClients, 16);
  4301. for (new i = 0; (i < recipient_count); i++) {
  4302. target[i] = GetClientOfUserId(StringToInt(TargetRecipients[i]));
  4303. }
  4304. } else {
  4305. target[0] = GetClientOfUserId(StringToInt(target_id));
  4306. }
  4307.  
  4308.  
  4309. if ((caller[0] > -1) && (target[0] > -1) && (query_id > 0)) {
  4310. decl String: message[1024];
  4311. GetCmdArg(5, message, 1024);
  4312.  
  4313. new cb_array_index = find_callback(query_id);
  4314. if (cb_array_index >= 0) {
  4315. decl data[callback_data];
  4316. GetArrayArray(QueryCallbackArray, cb_array_index, data, sizeof(data));
  4317. if ((data[callback_data_plugin] != INVALID_HANDLE) && (data[callback_data_function] != INVALID_FUNCTION)) {
  4318. decl Action: result;
  4319. Call_StartFunction(data[callback_data_plugin], data[callback_data_function]);
  4320. Call_PushCell(RAW_MESSAGE_CALLBACK_INT_SPECTATOR);
  4321. Call_PushCell(data[callback_data_payload]);
  4322. Call_PushArray(caller, MAXPLAYERS + 1);
  4323. Call_PushArray(target, MAXPLAYERS + 1);
  4324. Call_PushString(gameme_plugin[message_prefix_value]);
  4325. Call_PushString(message);
  4326. Call_Finish(_:result);
  4327.  
  4328. if (data[callback_data_limit] == 1) {
  4329. RemoveFromArray(QueryCallbackArray, cb_array_index);
  4330. }
  4331. }
  4332. }
  4333.  
  4334. }
  4335. }
  4336. }
  4337.  
  4338. }
  4339.  
  4340. return Plugin_Handled;
  4341. }
  4342.  
  4343.  
  4344. public Action: gameme_psay(args)
  4345. {
  4346. if (args < 2) {
  4347. PrintToServer("Usage: gameme_psay <userid><colored><message> - sends private message");
  4348. return Plugin_Handled;
  4349. }
  4350.  
  4351. decl String: client_id[192];
  4352. GetCmdArg(1, client_id, 192);
  4353. if (StrContains(client_id, ",") > -1) {
  4354. decl String: MessageRecipients[MaxClients][16];
  4355. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4356. for (new i = 0; (i < recipient_count); i++) {
  4357. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4358. }
  4359. } else {
  4360. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4361. }
  4362.  
  4363. decl String: colored_param[32];
  4364. GetCmdArg(2, colored_param, 32);
  4365. new is_colored = 0;
  4366. new ignore_param = 0;
  4367. if (strcmp(colored_param, "1") == 0) {
  4368. is_colored = 1;
  4369. ignore_param = 1;
  4370. } else if (strcmp(colored_param, "2") == 0) {
  4371. is_colored = 2;
  4372. ignore_param = 1;
  4373. } else if (strcmp(colored_param, "3") == 0) {
  4374. is_colored = 3;
  4375. ignore_param = 1;
  4376. } else if (strcmp(colored_param, "0") == 0) {
  4377. ignore_param = 1;
  4378. }
  4379.  
  4380. decl String: argument_string[1024];
  4381. GetCmdArgString(argument_string, 1024);
  4382. new copy_start_length = strlen(client_id) + 3;
  4383. if (ignore_param == 1) {
  4384. copy_start_length += strlen(colored_param) + 1;
  4385. }
  4386. copy_start_length += 1;
  4387.  
  4388. new String: client_message[192];
  4389. strcopy(client_message, 192, argument_string[copy_start_length]);
  4390. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4391. client_message[strlen(client_message)-1] = 0;
  4392. }
  4393.  
  4394. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4395. new color_index = -1;
  4396. 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)) {
  4397.  
  4398. if (is_colored > 1) {
  4399. validate_team_colors();
  4400. if (is_colored == 2) {
  4401. if (ColorSlotArray[2] > -1) {
  4402. color_index = ColorSlotArray[2];
  4403. }
  4404. } else if (is_colored == 3) {
  4405. if (ColorSlotArray[3] > -1) {
  4406. color_index = ColorSlotArray[3];
  4407. }
  4408. }
  4409. color_gameme_entities(client_message);
  4410. } else if (is_colored == 1) {
  4411. color_gameme_entities(client_message);
  4412. }
  4413.  
  4414. new bool: setupColorForRecipients = false;
  4415. if (color_index == -1) {
  4416. setupColorForRecipients = true;
  4417. }
  4418.  
  4419. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4420. new recipient_client = -1;
  4421. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4422.  
  4423. new player_index = GetClientOfUserId(recipient_client);
  4424. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4425. if (setupColorForRecipients == true) {
  4426. color_index = player_index;
  4427. }
  4428.  
  4429. if (gameme_plugin[mod_id] == MOD_DODS) {
  4430. PrintToChat(player_index, client_message);
  4431. } else {
  4432. new Handle: message_handle = StartMessageOne("SayText2", player_index);
  4433. if (message_handle != INVALID_HANDLE) {
  4434. if (gameme_plugin[protobuf] == 1) {
  4435. PbSetInt(message_handle, "ent_idx", color_index);
  4436. PbSetBool(message_handle, "chat", false);
  4437. PbSetString(message_handle, "msg_name", client_message);
  4438. PbAddString(message_handle, "params", "");
  4439. PbAddString(message_handle, "params", "");
  4440. PbAddString(message_handle, "params", "");
  4441. PbAddString(message_handle, "params", "");
  4442. } else {
  4443. BfWriteByte(message_handle, color_index);
  4444. BfWriteByte(message_handle, 0);
  4445. BfWriteString(message_handle, client_message);
  4446. }
  4447. EndMessage();
  4448. }
  4449. }
  4450. }
  4451. }
  4452. } else {
  4453. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4454. new recipient_client = -1;
  4455. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4456.  
  4457. new player_index = GetClientOfUserId(recipient_client);
  4458. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4459. PrintToChat(player_index, client_message);
  4460. }
  4461. }
  4462. }
  4463. }
  4464.  
  4465. return Plugin_Handled;
  4466. }
  4467.  
  4468.  
  4469. public Action: gameme_csay(args)
  4470. {
  4471. if (args < 1) {
  4472. PrintToServer("Usage: gameme_csay <message> - display center message");
  4473. return Plugin_Handled;
  4474. }
  4475.  
  4476. new String: display_message[192];
  4477. GetCmdArg(1, display_message, 192);
  4478.  
  4479. if (strcmp(display_message, "") != 0) {
  4480. PrintCenterTextAll(display_message);
  4481. }
  4482.  
  4483. return Plugin_Handled;
  4484. }
  4485.  
  4486.  
  4487. public Action: gameme_msay(args)
  4488. {
  4489. if (args < 3) {
  4490. PrintToServer("Usage: gameme_msay <time><userid><message> - sends hud message");
  4491. return Plugin_Handled;
  4492. }
  4493.  
  4494. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  4495. return Plugin_Handled;
  4496. }
  4497.  
  4498. decl String: display_time[16];
  4499. GetCmdArg(1, display_time, 16);
  4500.  
  4501. decl String: client_id[32];
  4502. GetCmdArg(2, client_id, 32);
  4503.  
  4504. decl String: handler_param[32];
  4505. GetCmdArg(3, handler_param, 32);
  4506.  
  4507. new need_handler = 0;
  4508. if ((strcmp(handler_param, "1") == 0) || (strcmp(handler_param, "0") == 0)) {
  4509. need_handler = 1;
  4510. }
  4511.  
  4512. decl String: argument_string[1024];
  4513. GetCmdArgString(argument_string, 1024);
  4514. new copy_start_length = strlen(display_time) + 3 + strlen(client_id) + 3;
  4515. if (need_handler == 1) {
  4516. copy_start_length += 2;
  4517. }
  4518. copy_start_length += 1;
  4519.  
  4520. new String: client_message[1024];
  4521. strcopy(client_message, 1024, argument_string[copy_start_length]);
  4522. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4523. client_message[strlen(client_message)-1] = 0;
  4524. }
  4525.  
  4526. new time = StringToInt(display_time);
  4527. if (time <= 0) {
  4528. time = 10;
  4529. }
  4530.  
  4531. new client = StringToInt(client_id);
  4532. if (client > 0) {
  4533. new player_index = GetClientOfUserId(client);
  4534. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4535. if (strcmp(client_message, "") != 0) {
  4536. display_menu(player_index, time, client_message, need_handler);
  4537. }
  4538. }
  4539. }
  4540.  
  4541. return Plugin_Handled;
  4542. }
  4543.  
  4544.  
  4545. public Action: gameme_tsay(args)
  4546. {
  4547. if (args < 3) {
  4548. PrintToServer("Usage: gameme_tsay <time><userid><message> - sends hud message");
  4549. return Plugin_Handled;
  4550. }
  4551.  
  4552. decl String: display_time[16];
  4553. GetCmdArg(1, display_time, 16);
  4554.  
  4555. decl String: client_id[32];
  4556. GetCmdArg(2, client_id, 32);
  4557.  
  4558. decl String: argument_string[1024];
  4559. GetCmdArgString(argument_string, 1024);
  4560. new copy_start_length = strlen(display_time) + 3 + strlen(client_id) + 3;
  4561. copy_start_length += 1;
  4562.  
  4563. new String: client_message[192];
  4564. strcopy(client_message, 192, argument_string[copy_start_length]);
  4565. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4566. client_message[strlen(client_message)-1] = 0;
  4567. }
  4568.  
  4569. new client = StringToInt(client_id);
  4570. if ((client > 0) && (strcmp(client_message, "") != 0)) {
  4571. new player_index = GetClientOfUserId(client);
  4572. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4573. new Handle:values = CreateKeyValues("msg");
  4574. KvSetString(values, "title", client_message);
  4575. KvSetNum(values, "level", 1);
  4576. KvSetString(values, "time", display_time);
  4577. CreateDialog(player_index, values, DialogType_Msg);
  4578. CloseHandle(values);
  4579. }
  4580. }
  4581.  
  4582. return Plugin_Handled;
  4583. }
  4584.  
  4585.  
  4586. public Action: gameme_hint(args)
  4587. {
  4588. if (args < 2) {
  4589. PrintToServer("Usage: gameme_hint <userid><message> - send hint message");
  4590. return Plugin_Handled;
  4591. }
  4592.  
  4593. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  4594. return Plugin_Handled;
  4595. }
  4596.  
  4597. decl String: client_id[512];
  4598. GetCmdArg(1, client_id, 512);
  4599. if (StrContains(client_id, ",") > -1) {
  4600. decl String: MessageRecipients[MaxClients][16];
  4601. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4602. for (new i = 0; (i < recipient_count); i++) {
  4603. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4604. }
  4605. } else {
  4606. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4607. }
  4608.  
  4609. decl String: argument_string[1024];
  4610. GetCmdArgString(argument_string, 1024);
  4611. new copy_start_length = strlen(client_id) + 3;
  4612. copy_start_length++;
  4613.  
  4614. new String: client_message[192];
  4615. strcopy(client_message, 192, argument_string[copy_start_length]);
  4616. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4617. client_message[strlen(client_message)-1] = 0;
  4618. }
  4619.  
  4620. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4621. if (strcmp(client_message, "") != 0) {
  4622. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4623. new recipient_client = -1;
  4624. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4625.  
  4626. new player_index = GetClientOfUserId(recipient_client);
  4627. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4628. PrintHintText(player_index, client_message);
  4629. }
  4630. }
  4631. }
  4632. }
  4633.  
  4634. return Plugin_Handled;
  4635. }
  4636.  
  4637.  
  4638. public Action: gameme_khint(args)
  4639. {
  4640. if (args < 2) {
  4641. PrintToServer("Usage: gameme_khint <userid><message> - send khint message");
  4642. return Plugin_Handled;
  4643. }
  4644.  
  4645. decl String: client_id[512];
  4646. GetCmdArg(1, client_id, 512);
  4647. if (StrContains(client_id, ",") > -1) {
  4648. decl String: MessageRecipients[MaxClients][16];
  4649. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4650. for (new i = 0; (i < recipient_count); i++) {
  4651. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4652. }
  4653. } else {
  4654. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4655. }
  4656.  
  4657. decl String: argument_string[1024];
  4658. GetCmdArgString(argument_string, 1024);
  4659. new copy_start_length = strlen(client_id) + 3;
  4660. copy_start_length++;
  4661.  
  4662. new String: client_message[255];
  4663. strcopy(client_message, 255, argument_string[copy_start_length]);
  4664. while ((strlen(client_message) > 0) && (client_message[strlen(client_message)-1] == 34)) {
  4665. client_message[strlen(client_message)-1] = 0;
  4666. }
  4667. ReplaceString(client_message, 255, "\\n", "\10");
  4668.  
  4669. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4670. if (strcmp(client_message, "") != 0) {
  4671. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4672. new recipient_client = -1;
  4673. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4674.  
  4675. new player_index = GetClientOfUserId(recipient_client);
  4676. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4677. new Handle: message_handle = StartMessageOne("KeyHintText", player_index);
  4678. if (message_handle != INVALID_HANDLE) {
  4679. if (gameme_plugin[protobuf] == 1) {
  4680. PbAddString(message_handle, "hints", client_message);
  4681. } else {
  4682. BfWriteByte(message_handle, 1);
  4683. BfWriteString(message_handle, client_message);
  4684. }
  4685. EndMessage();
  4686. }
  4687. }
  4688. }
  4689. }
  4690. }
  4691.  
  4692. return Plugin_Handled;
  4693. }
  4694.  
  4695.  
  4696. public Action: gameme_browse(args)
  4697. {
  4698. if (args < 2) {
  4699. PrintToServer("Usage: gameme_browse <userid><url> - open client ingame browser");
  4700. return Plugin_Handled;
  4701. }
  4702.  
  4703. decl String: client_id[512];
  4704. GetCmdArg(1, client_id, 512);
  4705. if (StrContains(client_id, ",") > -1) {
  4706. decl String: MessageRecipients[MaxClients][16];
  4707. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4708. for (new i = 0; (i < recipient_count); i++) {
  4709. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4710. }
  4711. } else {
  4712. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4713. }
  4714.  
  4715. new String: client_url[192];
  4716. GetCmdArg(2, client_url, 192);
  4717.  
  4718. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4719. if (strcmp(client_url, "") != 0) {
  4720. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4721. new recipient_client = -1;
  4722. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4723.  
  4724. new player_index = GetClientOfUserId(recipient_client);
  4725. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4726. ShowMOTDPanel(player_index, "gameME", client_url, MOTDPANEL_TYPE_URL);
  4727. }
  4728. }
  4729. }
  4730. }
  4731.  
  4732. return Plugin_Handled;
  4733. }
  4734.  
  4735.  
  4736. public Action: gameme_swap(args)
  4737. {
  4738. if (args < 1) {
  4739. PrintToServer("Usage: gameme_swap <userid> - swaps players to the opposite team (css only)");
  4740. return Plugin_Handled;
  4741. }
  4742.  
  4743. if (gameme_plugin[mod_id] != MOD_CSS) {
  4744. return Plugin_Handled;
  4745. }
  4746.  
  4747. decl String: client_id[32];
  4748. GetCmdArg(1, client_id, 32);
  4749.  
  4750. new client = StringToInt(client_id);
  4751. if (client > 0) {
  4752. new player_index = GetClientOfUserId(client);
  4753. if ((player_index > 0) && (IsClientInGame(player_index))) {
  4754. swap_player(player_index);
  4755. }
  4756. }
  4757. return Plugin_Handled;
  4758. }
  4759.  
  4760.  
  4761. public Action: gameme_redirect(args)
  4762. {
  4763. if (args < 3) {
  4764. PrintToServer("Usage: gameme_redirect <time><userid><address><reason> - asks player to be redirected to specified gameserver");
  4765. return Plugin_Handled;
  4766. }
  4767.  
  4768. decl String: display_time[16];
  4769. GetCmdArg(1, display_time, 16);
  4770.  
  4771. decl String: client_id[512];
  4772. GetCmdArg(2, client_id, 512);
  4773. if (StrContains(client_id, ",") > -1) {
  4774. decl String: MessageRecipients[MaxClients][16];
  4775. new recipient_count = ExplodeString(client_id, ",", MessageRecipients, MaxClients, 16);
  4776. for (new i = 0; (i < recipient_count); i++) {
  4777. PushStackCell(gameme_plugin[message_recipients], StringToInt(MessageRecipients[i]));
  4778. }
  4779. } else {
  4780. PushStackCell(gameme_plugin[message_recipients], StringToInt(client_id));
  4781. }
  4782.  
  4783. new String: server_address[192];
  4784. GetCmdArg(3, server_address, 192);
  4785.  
  4786. decl String: argument_string[1024];
  4787. GetCmdArgString(argument_string, 1024);
  4788. new copy_start_length = strlen(display_time) + 3 + strlen(client_id) + 3 + strlen(server_address) + 3;
  4789. copy_start_length++;
  4790.  
  4791. new String: redirect_reason[192];
  4792. strcopy(redirect_reason, 192, argument_string[copy_start_length]);
  4793. while ((strlen(redirect_reason) > 0) && (redirect_reason[strlen(redirect_reason)-1] == 34)) {
  4794. redirect_reason[strlen(redirect_reason)-1] = 0;
  4795. }
  4796.  
  4797. if (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4798. if (strcmp(server_address, "") != 0) {
  4799.  
  4800. while (IsStackEmpty(gameme_plugin[message_recipients]) == false) {
  4801. new recipient_client = -1;
  4802. PopStackCell(gameme_plugin[message_recipients], recipient_client);
  4803.  
  4804. new player_index = GetClientOfUserId(recipient_client);
  4805. if ((player_index > 0) && (!IsFakeClient(player_index)) && (IsClientInGame(player_index))) {
  4806. new Handle:top_values = CreateKeyValues("msg");
  4807. KvSetString(top_values, "title", redirect_reason);
  4808. KvSetNum(top_values, "level", 1);
  4809. KvSetString(top_values, "time", display_time);
  4810. CreateDialog(player_index, top_values, DialogType_Msg);
  4811. CloseHandle(top_values);
  4812.  
  4813. new Float: display_time_float;
  4814. display_time_float = StringToFloat(display_time);
  4815. DisplayAskConnectBox(player_index, display_time_float, server_address);
  4816. }
  4817. }
  4818. }
  4819. }
  4820.  
  4821. return Plugin_Handled;
  4822. }
  4823.  
  4824.  
  4825. public Action: gameme_player_action(args)
  4826. {
  4827. if (args < 2) {
  4828. PrintToServer("Usage: gameme_player_action <client><action> - trigger player action to be handled from gameME");
  4829. return Plugin_Handled;
  4830. }
  4831.  
  4832. decl String: client_id[32];
  4833. GetCmdArg(1, client_id, 32);
  4834.  
  4835. decl String: player_action[192];
  4836. GetCmdArg(2, player_action, 192);
  4837.  
  4838. new client = StringToInt(client_id);
  4839. if (client > 0) {
  4840. log_player_event(client, "triggered", player_action);
  4841. }
  4842.  
  4843. return Plugin_Handled;
  4844. }
  4845.  
  4846.  
  4847. public Action: gameme_team_action(args)
  4848. {
  4849. if (args < 2) {
  4850. PrintToServer("Usage: gameme_team_action <team_name><action>(objective) - trigger team action to be handled from gameME");
  4851. return Plugin_Handled;
  4852. }
  4853.  
  4854. decl String: team_name[32];
  4855. GetCmdArg(1, team_name, 32);
  4856.  
  4857. decl String: team_action[192];
  4858. GetCmdArg(2, team_action, 192);
  4859.  
  4860. if (args > 2) {
  4861. decl String: team_objective[192];
  4862. GetCmdArg(3, team_objective, 192);
  4863. log_team_event(team_name, team_action, team_objective);
  4864. } else {
  4865. log_team_event(team_name, team_action);
  4866. }
  4867.  
  4868. return Plugin_Handled;
  4869. }
  4870.  
  4871.  
  4872. public Action: gameme_world_action(args)
  4873. {
  4874. if (args < 1) {
  4875. PrintToServer("Usage: gameme_world_action <action> - trigger world action to be handled from gameME");
  4876. return Plugin_Handled;
  4877. }
  4878.  
  4879. decl String: world_action[192];
  4880. GetCmdArg(1, world_action, 192);
  4881.  
  4882. LogToGame("World triggered \"%s\"", world_action);
  4883.  
  4884. return Plugin_Handled;
  4885. }
  4886.  
  4887.  
  4888. is_command_blocked(String: command[])
  4889. {
  4890. new index;
  4891. if(GetTrieValue(gameme_plugin[blocked_commands], command, index)) {
  4892. return 1;
  4893. }
  4894. return 0;
  4895. }
  4896.  
  4897.  
  4898. public Action: gameme_block_commands(client, args)
  4899. {
  4900. if (client) {
  4901. if (client == 0) {
  4902. return Plugin_Continue;
  4903. }
  4904. new block_chat_commands_enabled = GetConVarInt(gameme_plugin[block_chat_commands]);
  4905.  
  4906. decl String: user_command[192];
  4907. GetCmdArgString(user_command, 192);
  4908.  
  4909. decl String: origin_command[192];
  4910. new start_index = 0;
  4911. new command_length = strlen(user_command);
  4912. if (command_length > 0) {
  4913. if (user_command[0] == 34) {
  4914. start_index = 1;
  4915. if (user_command[command_length - 1] == 34) {
  4916. user_command[command_length - 1] = 0;
  4917. }
  4918. }
  4919. strcopy(origin_command, 192, user_command[start_index]);
  4920. }
  4921.  
  4922. new String: command_type[32] = "say";
  4923. if (command_length > 0) {
  4924. if (block_chat_commands_enabled > 0) {
  4925. if (IsClientInGame(client)) {
  4926. if (is_command_blocked(user_command[start_index]) > 0) {
  4927. if ((strcmp("gameme", user_command[start_index]) == 0) ||
  4928. (strcmp("/gameme", user_command[start_index]) == 0) ||
  4929. (strcmp("!gameme", user_command[start_index]) == 0) ||
  4930. (strcmp("gameme_menu", user_command[start_index]) == 0) ||
  4931. (strcmp("/gameme_menu", user_command[start_index]) == 0) ||
  4932. (strcmp("!gameme_menu", user_command[start_index]) == 0)) {
  4933. DisplayMenu(gameme_plugin[menu_main], client, MENU_TIME_FOREVER);
  4934. }
  4935. log_player_event(client, command_type, origin_command);
  4936. return Plugin_Stop;
  4937. } else {
  4938. if ((strcmp("gameme", user_command[start_index]) == 0) ||
  4939. (strcmp("/gameme", user_command[start_index]) == 0) ||
  4940. (strcmp("!gameme", user_command[start_index]) == 0) ||
  4941. (strcmp("gameme_menu", user_command[start_index]) == 0) ||
  4942. (strcmp("/gameme_menu", user_command[start_index]) == 0) ||
  4943. (strcmp("!gameme_menu", user_command[start_index]) == 0)) {
  4944. DisplayMenu(gameme_plugin[menu_main], client, MENU_TIME_FOREVER);
  4945. }
  4946. }
  4947. }
  4948. } else {
  4949. if (IsClientInGame(client)) {
  4950. if ((strcmp("gameme", user_command[start_index]) == 0) ||
  4951. (strcmp("/gameme", user_command[start_index]) == 0) ||
  4952. (strcmp("!gameme", user_command[start_index]) == 0) ||
  4953. (strcmp("gameme_menu", user_command[start_index]) == 0) ||
  4954. (strcmp("/gameme_menu", user_command[start_index]) == 0) ||
  4955. (strcmp("!gameme_menu", user_command[start_index]) == 0)) {
  4956. DisplayMenu(gameme_plugin[menu_main], client, MENU_TIME_FOREVER);
  4957. }
  4958. }
  4959. return Plugin_Continue;
  4960. }
  4961. }
  4962. }
  4963. return Plugin_Continue;
  4964. }
  4965.  
  4966.  
  4967. public Action: gameME_Event_PlyDeath(Handle: event, const String: name[], bool:dontBroadcast)
  4968. {
  4969. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  4970. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  4971.  
  4972. if (attacker > 0) {
  4973. new headshot = 0;
  4974. headshot = GetEventBool(event, "headshot");
  4975.  
  4976. if (((gameme_plugin[mod_id] == MOD_CSGO) || (gameme_plugin[mod_id] == MOD_CSS) || (gameme_plugin[mod_id] == MOD_CSP)) && (victim > 0)) {
  4977. if (headshot == 1) {
  4978. new player_team_index = GetClientTeam(attacker);
  4979. new victim_team_index = GetClientTeam(victim);
  4980. if (victim_team_index != player_team_index) {
  4981. log_player_event(attacker, "triggered", "headshot");
  4982. }
  4983. }
  4984. if ((gameme_plugin[log_locations] == 1) && ((gameme_plugin[mod_id] != MOD_CSP))) {
  4985. if (attacker != victim) {
  4986. log_player_location("kill", attacker, victim);
  4987. } else {
  4988. log_player_location("suicide", attacker);
  4989. }
  4990. }
  4991. }
  4992.  
  4993. if ((gameme_plugin[mod_id] == MOD_L4D) || (gameme_plugin[mod_id] == MOD_L4DII)) {
  4994. if (headshot == 1) {
  4995. log_player_event(attacker, "triggered", "headshot");
  4996. }
  4997. if (gameme_plugin[mod_id] == MOD_L4DII) {
  4998. decl String: weapon[32];
  4999. GetEventString(event, "weapon", weapon, 32);
  5000. if (strncmp(weapon, "melee", 5) == 0) {
  5001. new new_weapon_index = GetEntDataEnt2(attacker, l4dii_data[active_weapon_offset]);
  5002. if (IsValidEdict(new_weapon_index)) {
  5003. GetEdictClassname(new_weapon_index, weapon, 32);
  5004. if (strncmp(weapon[7], "melee", 5) == 0) {
  5005. GetEntPropString(new_weapon_index, Prop_Data, "m_strMapSetScriptName", weapon, 32);
  5006. SetEventString(event, "weapon", weapon);
  5007. }
  5008. }
  5009. }
  5010. }
  5011. }
  5012.  
  5013. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  5014. decl String: weapon[32];
  5015. GetEventString(event, "weapon", weapon, 32);
  5016. if (strcmp(weapon, "crossbow_bolt") == 0) {
  5017. if (hl2mp_players[victim][nextbow_hitgroup] == HITGROUP_HEAD) {
  5018. log_player_event(attacker, "triggered", "headshot");
  5019. }
  5020. } else {
  5021. if (hl2mp_players[victim][next_hitgroup] == HITGROUP_HEAD) {
  5022. log_player_event(attacker, "triggered", "headshot");
  5023. }
  5024. }
  5025. }
  5026.  
  5027. if (gameme_plugin[mod_id] == MOD_ZPS) {
  5028. if (zps_players[victim][next_hitgroup] == HITGROUP_HEAD) {
  5029. log_player_event(attacker, "triggered", "headshot");
  5030. }
  5031. }
  5032.  
  5033. if (gameme_plugin[mod_id] == MOD_TF2) {
  5034. new customkill = GetEventInt(event, "customkill");
  5035. new weapon = GetEventInt(event, "weaponid");
  5036. switch (customkill) {
  5037. case TF_CUSTOM_BURNING_ARROW, TF_CUSTOM_FLYINGBURN: {
  5038. decl String: log_weapon[64];
  5039. GetEventString(event, "weapon_logclassname", log_weapon, 64);
  5040. if (log_weapon[0] != 'd') {
  5041. SetEventString(event, "weapon_logclassname", "tf_projectile_arrow_fire");
  5042. }
  5043. }
  5044. case TF_CUSTOM_TAUNT_UBERSLICE: {
  5045. if (weapon == TF_WEAPON_BONESAW) {
  5046. SetEventString(event, "weapon_logclassname", "taunt_medic");
  5047. SetEventString(event, "weapon", "taunt_medic");
  5048. }
  5049. }
  5050. case TF_CUSTOM_DECAPITATION_BOSS: {
  5051. log_player_event(attacker, "triggered", "killed_by_horseman");
  5052. }
  5053. }
  5054. }
  5055.  
  5056. if (gameme_plugin[log_locations] == 1) {
  5057. if (((gameme_plugin[mod_id] == MOD_INSMOD) || (gameme_plugin[mod_id] == MOD_HL2MP) || (gameme_plugin[mod_id] == MOD_DODS)) && (victim > 0)) {
  5058. if (attacker != victim) {
  5059. log_player_location("kill", attacker, victim);
  5060. }
  5061. }
  5062. }
  5063.  
  5064. }
  5065.  
  5066. return Plugin_Continue;
  5067. }
  5068.  
  5069.  
  5070. public Action: gameME_Event_PlyTeamChange(Handle: event, const String: name[], bool:dontBroadcast)
  5071. {
  5072. new userid = GetEventInt(event, "userid");
  5073. if (userid > 0) {
  5074. new player_index = GetClientOfUserId(userid);
  5075. if (player_index > 0) {
  5076. for (new i = 0; (i < sizeof(ColorSlotArray)); i++) {
  5077. new color_client = ColorSlotArray[i];
  5078. if (color_client > -1) {
  5079. if (color_client == player_index) {
  5080. ColorSlotArray[i] = -1;
  5081. }
  5082. }
  5083. }
  5084. }
  5085. }
  5086. return Plugin_Continue;
  5087. }
  5088.  
  5089.  
  5090. public Action: gameME_Event_PlyBombDropped(Handle: event, const String: name[], bool:dontBroadcast)
  5091. {
  5092. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5093. if (player > 0) {
  5094. if (gameme_plugin[log_locations] == 1) {
  5095. log_player_location("Dropped_The_Bomb", player);
  5096. }
  5097.  
  5098. if (gameme_plugin[display_spectator] == 1) {
  5099. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5100. player_messages[i][player][supdated] = 1;
  5101. }
  5102. }
  5103. }
  5104.  
  5105. return Plugin_Continue;
  5106. }
  5107.  
  5108.  
  5109. public Action: gameME_Event_PlyBombPickup(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("Got_The_Bomb", player);
  5115. }
  5116. if (gameme_plugin[display_spectator] == 1) {
  5117. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5118. player_messages[i][player][supdated] = 1;
  5119. }
  5120. }
  5121. }
  5122.  
  5123. return Plugin_Continue;
  5124. }
  5125.  
  5126.  
  5127. public Action: gameME_Event_PlyBombPlanted(Handle: event, const String: name[], bool:dontBroadcast)
  5128. {
  5129. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5130. if (player > 0) {
  5131. if (gameme_plugin[log_locations] == 1) {
  5132. log_player_location("Planted_The_Bomb", player);
  5133. }
  5134. if (gameme_plugin[display_spectator] == 1) {
  5135. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5136. player_messages[i][player][supdated] = 1;
  5137. }
  5138. }
  5139. }
  5140.  
  5141. return Plugin_Continue;
  5142. }
  5143.  
  5144.  
  5145. public Action: gameME_Event_PlyBombDefused(Handle: event, const String: name[], bool:dontBroadcast)
  5146. {
  5147. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5148. if (player > 0) {
  5149. if (gameme_plugin[log_locations] == 1) {
  5150. log_player_location("Defused_The_Bomb", player);
  5151. }
  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. return Plugin_Continue;
  5160. }
  5161.  
  5162.  
  5163. public Action: gameME_Event_PlyHostageKill(Handle: event, const String: name[], bool:dontBroadcast)
  5164. {
  5165. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5166. if (player > 0) {
  5167. if (gameme_plugin[log_locations] == 1) {
  5168. log_player_location("Killed_A_Hostage", player);
  5169. }
  5170.  
  5171. if (gameme_plugin[display_spectator] == 1) {
  5172. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5173. player_messages[i][player][supdated] = 1;
  5174. }
  5175. }
  5176. }
  5177. return Plugin_Continue;
  5178. }
  5179.  
  5180.  
  5181. public Action: gameME_Event_PlyHostageResc(Handle: event, const String: name[], bool:dontBroadcast)
  5182. {
  5183. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5184. if (player > 0) {
  5185. if (gameme_plugin[log_locations] == 1) {
  5186. log_player_location("Rescued_A_Hostage", player);
  5187. }
  5188.  
  5189. if (gameme_plugin[display_spectator] == 1) {
  5190. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5191. player_messages[i][player][supdated] = 1;
  5192. }
  5193. }
  5194. }
  5195. return Plugin_Continue;
  5196. }
  5197.  
  5198.  
  5199. swap_player(player_index)
  5200. {
  5201. if (IsClientInGame(player_index)) {
  5202. new player_team_index = GetClientTeam(player_index);
  5203. decl String: player_team[32];
  5204. player_team = team_list[player_team_index];
  5205.  
  5206. if (strcmp(player_team, "CT") == 0) {
  5207. if (IsPlayerAlive(player_index)) {
  5208. CS_SwitchTeam(player_index, CS_TEAM_T);
  5209. CS_RespawnPlayer(player_index);
  5210. new new_model = GetRandomInt(0, 3);
  5211. SetEntityModel(player_index, css_ts_models[new_model]);
  5212. } else {
  5213. CS_SwitchTeam(player_index, CS_TEAM_T);
  5214. }
  5215. } else if (strcmp(player_team, "TERRORIST") == 0) {
  5216. if (IsPlayerAlive(player_index)) {
  5217. CS_SwitchTeam(player_index, CS_TEAM_CT);
  5218. CS_RespawnPlayer(player_index);
  5219. new new_model = GetRandomInt(0, 3);
  5220. SetEntityModel(player_index, css_ct_models[new_model]);
  5221. new weapon_entity = GetPlayerWeaponSlot(player_index, 4);
  5222. if (weapon_entity > 0) {
  5223. decl String: class_name[32];
  5224. GetEdictClassname(weapon_entity, class_name, 32);
  5225. if (strcmp(class_name, "weapon_c4") == 0) {
  5226. RemovePlayerItem(player_index, weapon_entity);
  5227. }
  5228. }
  5229. } else {
  5230. CS_SwitchTeam(player_index, CS_TEAM_CT);
  5231. }
  5232. }
  5233. }
  5234. }
  5235.  
  5236.  
  5237. public CreateGameMEMenuMain(&Handle: MenuHandle)
  5238. {
  5239. MenuHandle = CreateMenu(gameMEMainCommandHandler, MenuAction_Display | MenuAction_DisplayItem | MenuAction_Select | MenuAction_Cancel);
  5240.  
  5241. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  5242.  
  5243. SetMenuTitle(MenuHandle, "gameME - Main Menu");
  5244.  
  5245. AddMenuItem(MenuHandle, "IngameMenu_Menu1", "Display Rank");
  5246. AddMenuItem(MenuHandle, "IngameMenu_Menu2", "Next Players");
  5247. AddMenuItem(MenuHandle, "IngameMenu_Menu3", "Top10 Players");
  5248. AddMenuItem(MenuHandle, "IngameMenu_Menu4", "Auto Ranking");
  5249. AddMenuItem(MenuHandle, "IngameMenu_Menu5", "Console Events");
  5250. AddMenuItem(MenuHandle, "IngameMenu_Menu6", "Toggle Ranking Display");
  5251. AddMenuItem(MenuHandle, "IngameMenu_Menu16" ,"Reset Statistics");
  5252.  
  5253. } else {
  5254.  
  5255. SetMenuTitle(MenuHandle, "gameME - Main Menu");
  5256.  
  5257. AddMenuItem(MenuHandle, "IngameMenu_Menu1", "Display Rank");
  5258. AddMenuItem(MenuHandle, "IngameMenu_Menu2", "Next Players");
  5259. AddMenuItem(MenuHandle, "IngameMenu_Menu3", "Top10 Players");
  5260. AddMenuItem(MenuHandle, "IngameMenu_Menu7", "Clans Ranking");
  5261. AddMenuItem(MenuHandle, "IngameMenu_Menu8", "Server Status");
  5262. AddMenuItem(MenuHandle, "IngameMenu_Menu9", "Statsme");
  5263.  
  5264. AddMenuItem(MenuHandle, "IngameMenu_Menu4", "Auto Ranking");
  5265. AddMenuItem(MenuHandle, "IngameMenu_Menu5", "Console Events");
  5266. AddMenuItem(MenuHandle, "IngameMenu_Menu10", "Weapon Usage");
  5267. AddMenuItem(MenuHandle, "IngameMenu_Menu11", "Weapons Accuracy");
  5268. AddMenuItem(MenuHandle, "IngameMenu_Menu12", "Weapons Targets");
  5269. AddMenuItem(MenuHandle, "IngameMenu_Menu13", "Player Kills");
  5270.  
  5271. AddMenuItem(MenuHandle, "IngameMenu_Menu6" , "Toggle Ranking Display");
  5272. AddMenuItem(MenuHandle, "IngameMenu_Menu16" ,"Reset Statistics");
  5273. AddMenuItem(MenuHandle, "IngameMenu_Menu14", "VAC Cheaterlist");
  5274. AddMenuItem(MenuHandle, "IngameMenu_Menu15", "Display Help");
  5275. }
  5276.  
  5277. SetMenuPagination(MenuHandle, 8);
  5278. }
  5279.  
  5280.  
  5281. public CreateGameMEMenuAuto(&Handle: MenuHandle)
  5282. {
  5283. MenuHandle = CreateMenu(gameMEAutoCommandHandler, MenuAction_Display | MenuAction_DisplayItem | MenuAction_Select | MenuAction_Cancel);
  5284.  
  5285. SetMenuTitle(MenuHandle, "gameME - Auto-Ranking");
  5286.  
  5287. AddMenuItem(MenuHandle, "AutoMenu_Menu1", "Enable on round-start");
  5288. AddMenuItem(MenuHandle, "AutoMenu_Menu2", "Enable on round-end");
  5289. AddMenuItem(MenuHandle, "AutoMenu_Menu3", "Enable on player death");
  5290. AddMenuItem(MenuHandle, "AutoMenu_Menu4", "Disable");
  5291.  
  5292. SetMenuPagination(MenuHandle, 8);
  5293. }
  5294.  
  5295.  
  5296. public CreateGameMEMenuEvents(&Handle: MenuHandle)
  5297. {
  5298. MenuHandle = CreateMenu(gameMEEventsCommandHandler, MenuAction_Display | MenuAction_DisplayItem | MenuAction_Select | MenuAction_Cancel);
  5299.  
  5300. SetMenuTitle(MenuHandle, "gameME - Console Events");
  5301.  
  5302. AddMenuItem(MenuHandle, "ConsoleMenu_Menu1", "Enable Events");
  5303. AddMenuItem(MenuHandle, "ConsoleMenu_Menu2", "Disable Events");
  5304. AddMenuItem(MenuHandle, "ConsoleMenu_Menu3", "Enable Global Chat");
  5305. AddMenuItem(MenuHandle, "ConsoleMenu_Menu4", "Disable Global Chat");
  5306.  
  5307. SetMenuPagination(MenuHandle, 8);
  5308. }
  5309.  
  5310.  
  5311. make_player_command(client, String: player_command[192])
  5312. {
  5313. if (client > 0) {
  5314. log_player_event(client, "say", player_command);
  5315. }
  5316. }
  5317.  
  5318.  
  5319. public gameMEMainCommandHandler(Handle:menu, MenuAction:action, param1, param2)
  5320. {
  5321. if (action == MenuAction_DisplayItem) {
  5322.  
  5323. decl String: info[64];
  5324. GetMenuItem(menu, param2, info, sizeof(info), _, "", 0);
  5325.  
  5326. decl String: buffer[255];
  5327. Format(buffer, sizeof(buffer), "%T", info, param1);
  5328.  
  5329. return RedrawMenuItem(buffer);
  5330.  
  5331. } else if (action == MenuAction_Display) {
  5332.  
  5333. decl String: buffer[255];
  5334. Format(buffer, sizeof(buffer), "%T", "IngameMenu_Caption", param1);
  5335.  
  5336. new Handle: panel = Handle: param2;
  5337. SetPanelTitle(panel, buffer);
  5338.  
  5339. } else if (action == MenuAction_Select) {
  5340.  
  5341. if (IsClientInGame(param1)) {
  5342. if (gameme_plugin[mod_id] == MOD_HL2MP) {
  5343. switch (param2) {
  5344. case 0 :
  5345. make_player_command(param1, "/rank");
  5346. case 1 :
  5347. make_player_command(param1, "/next");
  5348. case 2 :
  5349. make_player_command(param1, "/top10");
  5350. case 3 :
  5351. DisplayMenu(gameme_plugin[menu_auto], param1, MENU_TIME_FOREVER);
  5352. case 4 :
  5353. DisplayMenu(gameme_plugin[menu_events], param1, MENU_TIME_FOREVER);
  5354. case 5 :
  5355. make_player_command(param1, "/gameme_hideranking");
  5356. case 6 :
  5357. make_player_command(param1, "/gameme_reset");
  5358. }
  5359. } else {
  5360. switch (param2) {
  5361. case 0 :
  5362. make_player_command(param1, "/rank");
  5363. case 1 :
  5364. make_player_command(param1, "/next");
  5365. case 2 :
  5366. make_player_command(param1, "/top10");
  5367. case 3 :
  5368. make_player_command(param1, "/clans");
  5369. case 4 :
  5370. make_player_command(param1, "/status");
  5371. case 5 :
  5372. make_player_command(param1, "/statsme");
  5373. case 6 :
  5374. DisplayMenu(gameme_plugin[menu_auto], param1, MENU_TIME_FOREVER);
  5375. case 7 :
  5376. DisplayMenu(gameme_plugin[menu_events], param1, MENU_TIME_FOREVER);
  5377. case 8 :
  5378. make_player_command(param1, "/weapons");
  5379. case 9 :
  5380. make_player_command(param1, "/accuracy");
  5381. case 10 :
  5382. make_player_command(param1, "/targets");
  5383. case 11 :
  5384. make_player_command(param1, "/kills");
  5385. case 12 :
  5386. make_player_command(param1, "/gameme_hideranking");
  5387. case 13 :
  5388. make_player_command(param1, "/gameme_reset");
  5389. case 14 :
  5390. make_player_command(param1, "/cheaters");
  5391. case 15 :
  5392. make_player_command(param1, "/help");
  5393.  
  5394.  
  5395. }
  5396. }
  5397. }
  5398. }
  5399.  
  5400. return 0;
  5401. }
  5402.  
  5403.  
  5404. public gameMEAutoCommandHandler(Handle:menu, MenuAction:action, param1, param2)
  5405. {
  5406. if (action == MenuAction_DisplayItem) {
  5407.  
  5408. decl String: info[64];
  5409. GetMenuItem(menu, param2, info, sizeof(info), _, "", 0);
  5410.  
  5411. decl String: buffer[255];
  5412. Format(buffer, sizeof(buffer), "%T", info, param1);
  5413.  
  5414. return RedrawMenuItem(buffer);
  5415.  
  5416. } else if (action == MenuAction_Display) {
  5417.  
  5418. decl String: buffer[255];
  5419. Format(buffer, sizeof(buffer), "%T", "IngameMenu_Caption", param1);
  5420.  
  5421. new Handle: panel = Handle: param2;
  5422. SetPanelTitle(panel, buffer);
  5423.  
  5424. } else if (action == MenuAction_Select) {
  5425.  
  5426. if (IsClientInGame(param1)) {
  5427. switch (param2) {
  5428. case 0 :
  5429. make_player_command(param1, "/gameme_auto start rank");
  5430. case 1 :
  5431. make_player_command(param1, "/gameme_auto end rank");
  5432. case 2 :
  5433. make_player_command(param1, "/gameme_auto kill rank");
  5434. case 3 :
  5435. make_player_command(param1, "/gameme_auto clear");
  5436. }
  5437. }
  5438. }
  5439.  
  5440. return 0;
  5441. }
  5442.  
  5443.  
  5444. public gameMEEventsCommandHandler(Handle:menu, MenuAction:action, param1, param2)
  5445. {
  5446. if (action == MenuAction_DisplayItem) {
  5447.  
  5448. decl String: info[64];
  5449. GetMenuItem(menu, param2, info, sizeof(info), _, "", 0);
  5450.  
  5451. decl String: buffer[255];
  5452. Format(buffer, sizeof(buffer), "%T", info, param1);
  5453.  
  5454. return RedrawMenuItem(buffer);
  5455.  
  5456. } else if (action == MenuAction_Display) {
  5457.  
  5458. decl String: buffer[255];
  5459. Format(buffer, sizeof(buffer), "%T", "IngameMenu_Caption", param1);
  5460.  
  5461. new Handle: panel = Handle: param2;
  5462. SetPanelTitle(panel, buffer);
  5463.  
  5464. } else if (action == MenuAction_Select) {
  5465.  
  5466. if (IsClientInGame(param1)) {
  5467. switch (param2) {
  5468. case 0 :
  5469. make_player_command(param1, "/gameme_display 1");
  5470. case 1 :
  5471. make_player_command(param1, "/gameme_display 0");
  5472. case 2 :
  5473. make_player_command(param1, "/gameme_chat 1");
  5474. case 3 :
  5475. make_player_command(param1, "/gameme_chat 0");
  5476. }
  5477. }
  5478. }
  5479.  
  5480. return 0;
  5481. }
  5482.  
  5483.  
  5484. //
  5485. //
  5486. // Third Party Addons
  5487. //
  5488. //
  5489.  
  5490.  
  5491. /*
  5492. *
  5493. * Advanced Logging for
  5494. * Left 4 Dead,
  5495. * Left 4 Dead 2,
  5496. * Team Fortress 2,
  5497. * Insurgency,
  5498. * Half-Life 2: Deathmatch
  5499. * Copyright (C) 2011 Nicholas Hastings (psychonic)
  5500. *
  5501. * This program is free software; you can redistribute it and/or
  5502. * modify it under the terms of the GNU General Public License
  5503. * as published by the Free Software Foundation; either version 2
  5504. * of the License, or (at your option) any later version.
  5505. *
  5506. * This program is distributed in the hope that it will be useful,
  5507. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5508. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  5509. * GNU General Public License for more details.
  5510. *
  5511. * You should have received a copy of the GNU General Public License
  5512. * along with this program; if not, write to the Free Software
  5513. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  5514. */
  5515.  
  5516.  
  5517. public Event_L4DRescueSurvivor(Handle: event, const String: name[], bool:dontBroadcast)
  5518. {
  5519. new player = GetClientOfUserId(GetEventInt(event, "rescuer"));
  5520. if (player > 0) {
  5521. log_player_event(player, "triggered", "rescued_survivor");
  5522. }
  5523. }
  5524.  
  5525.  
  5526. public Event_L4DHeal(Handle: event, const String: name[], bool:dontBroadcast)
  5527. {
  5528. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5529. if ((player > 0) && (player != GetClientOfUserId(GetEventInt(event, "subject")))) {
  5530. log_player_event(player, "triggered", "healed_teammate");
  5531. }
  5532. }
  5533.  
  5534.  
  5535. public Event_L4DRevive(Handle: event, const String: name[], bool:dontBroadcast)
  5536. {
  5537. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5538. if (player > 0) {
  5539. log_player_event(player, "triggered", "revived_teammate");
  5540. }
  5541. }
  5542.  
  5543.  
  5544. public Event_L4DStartleWitch(Handle: event, const String: name[], bool:dontBroadcast)
  5545. {
  5546. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5547. if ((player > 0) && ((gameme_plugin[mod_id] != MOD_L4DII) || (GetEventBool(event, "first")))) {
  5548. log_player_event(player, "triggered", "startled_witch");
  5549. }
  5550. }
  5551.  
  5552.  
  5553. public Event_L4DPounce(Handle: event, const String: name[], bool:dontBroadcast)
  5554. {
  5555. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5556. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5557.  
  5558. if (victim > 0) {
  5559. log_player_player_event(player, victim, "triggered", "pounce");
  5560. } else {
  5561. log_player_event(player, "triggered", "pounce");
  5562. }
  5563. }
  5564.  
  5565.  
  5566. public Event_L4DBoomered(Handle: event, const String: name[], bool:dontBroadcast)
  5567. {
  5568. new player = GetClientOfUserId(GetEventInt(event, "attacker"));
  5569. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  5570.  
  5571. if ((player > 0) && ((gameme_plugin[mod_id] != MOD_L4DII) || (GetEventBool(event, "by_boomer")))) {
  5572. if (victim > 0) {
  5573. log_player_player_event(player, victim, "triggered", "vomit");
  5574. } else {
  5575. log_player_event(player, "triggered", "vomit");
  5576. }
  5577. }
  5578. }
  5579.  
  5580.  
  5581. public Event_L4DFF(Handle: event, const String: name[], bool:dontBroadcast)
  5582. {
  5583. new player = GetClientOfUserId(GetEventInt(event, "attacker"));
  5584. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5585.  
  5586. if ((player > 0) && (player == GetClientOfUserId(GetEventInt(event, "guilty")))) {
  5587. if (victim > 0) {
  5588. log_player_player_event(player, victim, "triggered", "friendly_fire");
  5589. } else {
  5590. log_player_event(player, "triggered", "friendly_fire");
  5591. }
  5592. }
  5593. }
  5594.  
  5595.  
  5596. public Event_L4DWitchKilled(Handle: event, const String: name[], bool:dontBroadcast)
  5597. {
  5598. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5599. if ((player > 0) && (GetEventBool(event, "oneshot"))) {
  5600. log_player_event(player, "triggered", "cr0wned");
  5601. }
  5602. }
  5603.  
  5604.  
  5605. public Event_L4DDefib(Handle: event, const String: name[], bool:dontBroadcast)
  5606. {
  5607. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5608. if (player > 0) {
  5609. log_player_event(player, "triggered", "defibrillated_teammate");
  5610. }
  5611. }
  5612.  
  5613.  
  5614. public Event_L4DAdrenaline(Handle: event, const String: name[], bool:dontBroadcast)
  5615. {
  5616. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5617. if (player > 0) {
  5618. log_player_event(player, "triggered", "used_adrenaline");
  5619. }
  5620. }
  5621.  
  5622.  
  5623. public Event_L4DJockeyRide(Handle: event, const String: name[], bool:dontBroadcast)
  5624. {
  5625. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5626. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5627.  
  5628. if (player > 0) {
  5629. if (victim > 0) {
  5630. log_player_player_event(player, victim, "triggered", "jockey_ride");
  5631. } else {
  5632. log_player_event(player, "triggered", "jockey_ride");
  5633. }
  5634. }
  5635. }
  5636.  
  5637.  
  5638. public Event_L4DChargerPummelStart(Handle: event, const String: name[], bool:dontBroadcast)
  5639. {
  5640. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5641. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5642.  
  5643. if (player > 0) {
  5644. if (victim > 0) {
  5645. log_player_player_event(player, victim, "triggered", "charger_pummel");
  5646. } else {
  5647. log_player_event(player, "triggered", "charger_pummel");
  5648. }
  5649. }
  5650. }
  5651.  
  5652.  
  5653. public Event_L4DVomitBombTank(Handle: event, const String: name[], bool:dontBroadcast)
  5654. {
  5655. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5656. if (player > 0) {
  5657. log_player_event(player, "triggered", "bilebomb_tank");
  5658. }
  5659. }
  5660.  
  5661.  
  5662. public Event_L4DScavengeEnd(Handle: event, const String: name[], bool:dontBroadcast)
  5663. {
  5664. new team_index = GetEventInt(event, "winners");
  5665. if (strcmp(team_list[team_index], "") != 0) {
  5666. log_team_event(team_list[team_index], "scavenge_win");
  5667. }
  5668. }
  5669.  
  5670.  
  5671. public Event_L4DVersusEnd(Handle: event, const String: name[], bool:dontBroadcast)
  5672. {
  5673. new team_index = GetEventInt(event, "winners");
  5674. if (strcmp(team_list[team_index], "") != 0) {
  5675. log_team_event(team_list[team_index], "versus_win");
  5676. }
  5677. }
  5678.  
  5679.  
  5680. public Event_L4dChargerKilled(Handle: event, const String: name[], bool:dontBroadcast)
  5681. {
  5682. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  5683. new victim = GetClientOfUserId(GetEventInt(event, "charger"));
  5684. if ((attacker > 0) && (IsClientInGame(attacker))) {
  5685. if (GetEventBool(event, "melee") && GetEventBool(event, "charging")) {
  5686. if ((victim > 0) && (IsClientInGame(victim))) {
  5687. log_player_player_event(attacker, victim, "triggered", "level_a_charge");
  5688. } else {
  5689. log_player_event(attacker, "triggered", "level_a_charge");
  5690. }
  5691. }
  5692. }
  5693. }
  5694.  
  5695.  
  5696. public Event_L4DAward(Handle: event, const String: name[], bool:dontBroadcast)
  5697. {
  5698. // "userid" "short" // player who earned the award
  5699. // "entityid" "long" // client likes ent id
  5700. // "subjectentid" "long" // entity id of other party in the award, if any
  5701. // "award" "short" // id of award earned
  5702.  
  5703. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5704. if (player > 0) {
  5705. switch (GetEventInt(event, "award")) {
  5706. case 21:
  5707. log_player_event(player, "triggered", "hunter_punter");
  5708. case 27:
  5709. log_player_event(player, "triggered", "tounge_twister");
  5710. case 67:
  5711. log_player_event(player, "triggered", "protect_teammate");
  5712. case 80:
  5713. log_player_event(player, "triggered", "no_death_on_tank");
  5714. case 136:
  5715. log_player_event(player, "triggered", "killed_all_survivors");
  5716. }
  5717. }
  5718. }
  5719.  
  5720.  
  5721. public Event_TF2StealSandvich(Handle: event, const String: name[], bool:dontBroadcast)
  5722. {
  5723. // "owner" "short"
  5724. // "target" "short"
  5725.  
  5726. new owner = GetClientOfUserId(GetEventInt(event, "owner"));
  5727. new target = GetClientOfUserId(GetEventInt(event, "target"));
  5728.  
  5729. if ((owner > 0) && (target > 0)) {
  5730. log_player_player_event(target, owner, "triggered", "steal_sandvich");
  5731. }
  5732. }
  5733.  
  5734.  
  5735. public Event_TF2Stunned(Handle: event, const String: name[], bool:dontBroadcast)
  5736. {
  5737. // "stunner" "short"
  5738. // "victim" "short"
  5739. // "victim_capping" "bool"
  5740. // "big_stun" "bool"
  5741.  
  5742. new stunner = GetClientOfUserId(GetEventInt(event, "stunner"));
  5743. new victim = GetClientOfUserId(GetEventInt(event, "victim"));
  5744. if ((stunner > 0) && (victim > 0)) {
  5745.  
  5746. log_player_player_event(stunner, victim, "triggered", "stun");
  5747. if ((GetEntityFlags(victim) & (FL_ONGROUND | FL_INWATER)) == 0) {
  5748. log_player_event(stunner, "triggered", "airshot_stun");
  5749. }
  5750. }
  5751. }
  5752.  
  5753.  
  5754. public Action: Event_TF2Jarated(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
  5755. {
  5756. new client = BfReadByte(bf);
  5757. new victim = BfReadByte(bf);
  5758.  
  5759. if ((client > 0) && (victim > 0) && (IsClientInGame(client)) && (IsClientInGame(victim))) {
  5760. if (TF2_IsPlayerInCondition(victim, TFCond_Jarated)) {
  5761. log_player_player_event(client, victim, "triggered", "jarate");
  5762. } else if (TF2_IsPlayerInCondition(victim, TFCond_Milked)) {
  5763. log_player_player_event(client, victim, "triggered", "madmilk");
  5764. }
  5765. }
  5766. return Plugin_Continue;
  5767. }
  5768.  
  5769.  
  5770. public Action: Event_TF2ShieldBlocked(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
  5771. {
  5772. new victim = BfReadByte(bf);
  5773. new client = BfReadByte(bf);
  5774.  
  5775. if ((client > 0) && (victim > 0)) {
  5776. log_player_player_event(client, victim, "triggered", "shield_blocked");
  5777. }
  5778. return Plugin_Continue;
  5779. }
  5780.  
  5781.  
  5782. public Action: Event_TF2SoundHook(clients[64], &numClients, String: sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags)
  5783. {
  5784. if ((entity <= MaxClients) &&(clients[0] == entity) && (tf2_players[entity][player_class] == TFClass_Heavy) && (StrEqual(sample, "vo/SandwichEat09.wav"))) {
  5785.  
  5786. switch (tf2_players[entity][player_loadout0][1]) {
  5787. case TF2_LUNCHBOX_CHOCOLATE: {
  5788. log_player_event(entity, "triggered", "dalokohs");
  5789. new Float: time = GetGameTime();
  5790. if ((time - tf2_players[entity][dalokohs]) > 30) {
  5791. log_player_event(entity, "triggered", "dalokohs_healthboost");
  5792. }
  5793. tf2_players[entity][dalokohs] = time;
  5794. if (GetClientHealth(entity) < 350) {
  5795. log_player_event(entity, "triggered", "dalokohs_healself");
  5796. }
  5797. }
  5798. case TF2_LUNCHBOX_STEAK: {
  5799. log_player_event(entity, "triggered", "steak");
  5800. }
  5801. default: {
  5802. log_player_event(entity, "triggered", "sandvich");
  5803. if (GetClientHealth(entity) < 300) {
  5804. log_player_event(entity, "triggered", "sandvich_healself");
  5805. }
  5806. }
  5807. }
  5808.  
  5809.  
  5810. }
  5811. return Plugin_Continue;
  5812. }
  5813.  
  5814.  
  5815. public Event_TF2WinPanel(Handle: event, const String: name[], bool:dontBroadcast)
  5816. {
  5817. new player1 = GetEventInt(event, "player_1");
  5818. new player2 = GetEventInt(event, "player_2");
  5819. new player3 = GetEventInt(event, "player_3");
  5820.  
  5821. if ((player1 > 0) && (IsClientInGame(player1))) {
  5822. log_player_event(player1, "triggered", "mvp1");
  5823. }
  5824. if ((player2 > 0) && (IsClientInGame(player2))) {
  5825. log_player_event(player2, "triggered", "mvp2");
  5826. }
  5827. if ((player3 > 0) && (IsClientInGame(player3))) {
  5828. log_player_event(player3, "triggered", "mvp3");
  5829. }
  5830. }
  5831.  
  5832.  
  5833. public Event_TF2EscortScore(Handle: event, const String: name[], bool:dontBroadcast)
  5834. {
  5835. new player = GetEventInt(event, "player");
  5836. if (player > 0) {
  5837. log_player_event(player, "triggered", "escort_score");
  5838. }
  5839. }
  5840.  
  5841.  
  5842. public Event_TF2DeployBuffBanner(Handle: event, const String: name[], bool:dontBroadcast)
  5843. {
  5844. new player = GetClientOfUserId(GetEventInt(event, "buff_owner"));
  5845. if (player > 0) {
  5846. log_player_event(player, "triggered", "buff_deployed");
  5847. }
  5848.  
  5849. }
  5850.  
  5851.  
  5852. public Event_TF2MedicDefended(Handle: event, const String: name[], bool:dontBroadcast)
  5853. {
  5854. new player = GetClientOfUserId(GetEventInt(event, "userid"));
  5855. if (player > 0) {
  5856. log_player_event(player, "triggered", "defended_medic");
  5857. }
  5858. }
  5859.  
  5860.  
  5861. public Action: Event_TF2ObjectDestroyedPre(Handle: event, const String: name[], bool:dontBroadcast)
  5862. {
  5863. if (GetEntProp(GetEventInt(event, "index"), Prop_Send, "m_bMiniBuilding", 1)) {
  5864. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  5865. new userid = GetEventInt(event, "userid");
  5866. new victim = GetClientOfUserId(userid);
  5867.  
  5868. if ((attacker > 0) && (victim > 0) && (attacker <= MAXPLAYERS) && (victim <= MAXPLAYERS) && (IsClientInGame(victim)) && (IsClientInGame(attacker))) {
  5869. decl String: weapon_str[32];
  5870. GetEventString(event, "weapon", weapon_str, 32);
  5871. new Float: player_origin[3];
  5872. GetClientAbsOrigin(attacker, player_origin);
  5873. 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]));
  5874. }
  5875. tf2_data[block_next_logging] = true;
  5876. }
  5877. return Plugin_Continue;
  5878. }
  5879.  
  5880.  
  5881. public Action: Event_TF2PlayerBuiltObjectPre(Handle: event, const String: name[], bool:dontBroadcast)
  5882. {
  5883. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  5884. if (client > 0) {
  5885. if (tf2_players[client][carry_object]) {
  5886. tf2_players[client][carry_object] = false;
  5887. tf2_data[block_next_logging] = true;
  5888. } else {
  5889. if (GetEntProp(GetEventInt(event, "index"), Prop_Send, "m_bMiniBuilding", 1)) {
  5890. if ((client > 0) && (client <= MAXPLAYERS) && (IsClientInGame(client))) {
  5891. new Float: player_origin[3];
  5892. GetClientAbsOrigin(client, player_origin);
  5893. 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]));
  5894. }
  5895. tf2_data[block_next_logging] = true;
  5896. }
  5897. }
  5898. }
  5899. return Plugin_Continue;
  5900. }
  5901.  
  5902.  
  5903. public Event_TF2PlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  5904. {
  5905. new Float: time = GetGameTime();
  5906. new userid = GetEventInt(event, "userid");
  5907. new client = GetClientOfUserId(userid);
  5908. new TFClassType: spawn_class = TFClassType: GetEventInt(event, "class");
  5909.  
  5910. tf2_players[client][jump_status] = TF2_JUMP_NONE;
  5911. dump_player_data(client);
  5912.  
  5913. if (time == tf2_players[client][object_removed]) {
  5914. new obj_type;
  5915. decl String: obj_name[24];
  5916. while (PopStackCell(tf2_players[client][object_list], obj_type)) {
  5917. switch (obj_type) {
  5918. case TF2_OBJ_DISPENSER:
  5919. obj_name = "OBJ_DISPENSER";
  5920. case TF2_OBJ_TELEPORTER:
  5921. obj_name = "OBJ_TELEPORTER";
  5922. case TF2_OBJ_SENTRYGUN:
  5923. obj_name = "OBJ_SENTRYGUN";
  5924. case TF2_OBJ_SENTRYGUN_MINI:
  5925. obj_name = "OBJ_SENTRYGUN_MINI";
  5926. default:
  5927. continue;
  5928. }
  5929. new Float: player_origin[3];
  5930. GetClientAbsOrigin(client, player_origin);
  5931. 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]));
  5932. }
  5933. }
  5934.  
  5935. tf2_players[client][player_class] = spawn_class;
  5936. tf2_players[client][dalokohs] = -30.0;
  5937. }
  5938.  
  5939.  
  5940. public Event_TF2RoundStart(Handle: event, const String: name[], bool:dontBroadcast)
  5941. {
  5942. if (gameme_plugin[live_active] == 1) {
  5943. for (new i = 0; (i <= MAXPLAYERS); i++) {
  5944. gameme_players[i][palive] = 1;
  5945. }
  5946. }
  5947. }
  5948.  
  5949.  
  5950. public Event_TF2RoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  5951. {
  5952. for (new i = 1; (i <= MaxClients); i++) {
  5953. dump_player_data(i);
  5954. }
  5955. }
  5956.  
  5957.  
  5958. public Event_TF2ObjectRemoved(Handle: event, const String: name[], bool:dontBroadcast)
  5959. {
  5960. new Float: time = GetGameTime();
  5961. new userid = GetEventInt(event, "userid");
  5962. new client = GetClientOfUserId(userid);
  5963.  
  5964. if (time != tf2_players[client][object_removed]) {
  5965. tf2_players[client][object_removed] = time;
  5966. while (PopStack(tf2_players[client][object_list])) {
  5967. continue;
  5968. }
  5969. }
  5970. new obj_type = GetEventInt(event, "objecttype");
  5971. new obj_index = GetEventInt(event, "index");
  5972. if ((IsValidEdict(obj_index)) && (GetEntProp(GetEventInt(event, "index"), Prop_Send, "m_bMiniBuilding", 1))) {
  5973. obj_type = TF2_OBJ_SENTRYGUN_MINI;
  5974. }
  5975. PushStackCell(tf2_players[client][object_list], obj_type);
  5976. }
  5977.  
  5978.  
  5979. public Event_TF2PostInvApp(Handle: event, const String: name[], bool:dontBroadcast)
  5980. {
  5981. CreateTimer(0.2, check_player_loadout, GetEventInt(event, "userid"));
  5982. }
  5983.  
  5984.  
  5985. public Action: check_player_loadout(Handle: timer, any: userid)
  5986. {
  5987. new client = GetClientOfUserId(userid);
  5988. if ((client == 0) || (!IsClientInGame(client))) {
  5989. return Plugin_Stop;
  5990. }
  5991.  
  5992. new bool: is_new_loadout = false;
  5993. for (new check_slot = 0; check_slot <= 5; check_slot++) {
  5994. if ((tf2_players[client][player_loadout1][check_slot] != 0) && (IsValidEntity(tf2_players[client][player_loadout1][check_slot]))) {
  5995. continue;
  5996. }
  5997. new entity = GetPlayerWeaponSlot(client, check_slot);
  5998. if (entity == -1) {
  5999. if ((gameme_plugin[sdkhook_available]) && (check_slot < 3) && ((tf2_players[client][player_class] == TFClass_Soldier) || (tf2_players[client][player_class] == TFClass_DemoMan))) {
  6000. tf2_players[client][player_loadout1][check_slot] = -1;
  6001. continue;
  6002. }
  6003. if (tf2_players[client][player_loadout0][check_slot] == -1) {
  6004. continue;
  6005. }
  6006. tf2_players[client][player_loadout0][check_slot] = -1;
  6007. tf2_players[client][player_loadout1][check_slot] = -1;
  6008. is_new_loadout = true;
  6009. } else {
  6010. new item_index = GetEntProp(entity, Prop_Send, "m_iItemDefinitionIndex");
  6011. if (tf2_players[client][player_loadout0][check_slot] != item_index) {
  6012. tf2_players[client][player_loadout0][check_slot] = item_index;
  6013. is_new_loadout = true;
  6014. }
  6015. tf2_players[client][player_loadout1][check_slot] = EntIndexToEntRef(entity);
  6016. }
  6017. }
  6018.  
  6019. if (gameme_plugin[sdkhook_available]) {
  6020. if (is_new_loadout) {
  6021. tf2_players[client][player_loadout_updated] = true;
  6022. }
  6023. CreateTimer(0.2, log_weapon_loadout, userid);
  6024. } else {
  6025. if (is_new_loadout) {
  6026. log_weapon_loadout(INVALID_HANDLE, userid);
  6027. }
  6028. }
  6029. return Plugin_Stop;
  6030. }
  6031.  
  6032.  
  6033. public Action: log_weapon_loadout(Handle: timer, any: userid)
  6034. {
  6035. new client = GetClientOfUserId(userid);
  6036. if ((client > 0) && (IsClientInGame(client))) {
  6037. for (new i = 0; i < TF2_MAX_LOADOUT_SLOTS; i++) {
  6038. if ((tf2_players[client][player_loadout0][i] != -1) && (!IsValidEntity(tf2_players[client][player_loadout1][i])) || (tf2_players[client][player_loadout1][i] == 0)) {
  6039. tf2_players[client][player_loadout0][i] = -1;
  6040. tf2_players[client][player_loadout1][i] = -1;
  6041. tf2_players[client][player_loadout_updated] = true;
  6042. }
  6043. }
  6044. if (tf2_players[client][player_loadout_updated] == false) {
  6045. return Plugin_Stop;
  6046. }
  6047. tf2_players[client][player_loadout_updated] = false;
  6048. 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]);
  6049. }
  6050. return Plugin_Stop;
  6051. }
  6052.  
  6053.  
  6054. public Action: OnTF2TakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
  6055. {
  6056. if ((attacker > 0) && (attacker <= MaxClients) && (attacker != victim) && (inflictor > MaxClients) && (damage > 0.0) && (IsValidEntity(inflictor)) && ((GetEntityFlags(victim) & (FL_ONGROUND | FL_INWATER)) == 0)) {
  6057. decl String: weapon_str[64];
  6058. GetEdictClassname(inflictor, weapon_str, 64);
  6059. if ((weapon_str[3] == 'p') && (weapon_str[4] == 'r')) {
  6060. switch(weapon_str[14]) {
  6061. case 'r': {
  6062. log_player_event(attacker, "triggered", "airshot_rocket");
  6063. if (tf2_players[attacker][jump_status] == TF2_JUMP_ROCKET) {
  6064. log_player_event(attacker, "triggered", "air2airshot_rocket");
  6065. }
  6066. }
  6067. case 'p': {
  6068. if (weapon_str[18] != 0) {
  6069. log_player_event(attacker, "triggered", "airshot_sticky");
  6070. if (tf2_players[attacker][jump_status] == TF2_JUMP_STICKY) {
  6071. log_player_event(attacker, "triggered", "air2airshot_sticky");
  6072. }
  6073. } else {
  6074. log_player_event(attacker, "triggered", "airshot_pipebomb");
  6075. if (tf2_players[attacker][jump_status] == TF2_JUMP_STICKY) {
  6076. log_player_event(attacker, "triggered", "air2airshot_pipebomb");
  6077. }
  6078. }
  6079. }
  6080. case 'a': {
  6081. log_player_event(attacker, "triggered", "airshot_arrow");
  6082. }
  6083. case 'f': {
  6084. if (damage > 10.0) {
  6085. log_player_event(attacker, "triggered", "airshot_flare");
  6086. }
  6087. }
  6088. }
  6089. }
  6090. }
  6091. return Plugin_Continue;
  6092. }
  6093.  
  6094.  
  6095. public OnTF2TakeDamage_Post(victim, attacker, inflictor, Float:damage, damagetype)
  6096. {
  6097. if ((attacker > 0) && (attacker <= MaxClients)) {
  6098. new weapon_index = -1;
  6099. new idamage = RoundFloat(damage);
  6100. decl String: weapon_str[64];
  6101.  
  6102. if (inflictor <= MaxClients) {
  6103. if (damagetype & DMG_BURN) {
  6104. return;
  6105. }
  6106. if ((inflictor == attacker) && (damagetype & 1) && (damage == 1000.0)) {
  6107. return;
  6108. }
  6109. GetClientWeapon(attacker, weapon_str, 64);
  6110. weapon_index = get_tf2_weapon_index(weapon_str[TF2_WEAPON_PREFIX_LENGTH], attacker);
  6111. } else if (IsValidEdict(inflictor)) {
  6112. GetEdictClassname(inflictor, weapon_str, 64);
  6113. if (weapon_str[TF2_WEAPON_PREFIX_LENGTH] == 'g') {
  6114. return;
  6115. } else if (weapon_str[3] == 'p') {
  6116. weapon_index = get_tf2_weapon_index(weapon_str, attacker, inflictor);
  6117. } else {
  6118. if ((!(damagetype & DMG_CRUSH)) && (damagetype & DMG_CLUB) && (StrEqual(weapon_str, "tf_weapon_bat_wood"))) {
  6119. weapon_index = get_tf2_weapon_index("ball", attacker);
  6120. } else {
  6121. weapon_index = get_tf2_weapon_index(weapon_str[TF2_WEAPON_PREFIX_LENGTH], attacker);
  6122. }
  6123. }
  6124. }
  6125.  
  6126. if (weapon_index > -1) {
  6127. player_weapons[attacker][weapon_index][wdamage] += idamage;
  6128. player_weapons[attacker][weapon_index][whits]++;
  6129. }
  6130. }
  6131. }
  6132.  
  6133.  
  6134. public Event_TF2RocketJump(Handle:event, const String:name[], bool:dontBroadcast)
  6135. {
  6136. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6137. if (client > 0) {
  6138. new status = tf2_players[client][jump_status];
  6139. if (status == TF2_JUMP_ROCKET_START) {
  6140. tf2_players[client][jump_status] = TF2_JUMP_ROCKET;
  6141. log_player_event(client, "triggered", "rocket_jump");
  6142. } else if (status != TF2_JUMP_ROCKET) {
  6143. tf2_players[client][jump_status] = TF2_JUMP_ROCKET_START;
  6144. }
  6145. }
  6146. }
  6147.  
  6148.  
  6149. public Event_TF2StickyJump(Handle:event, const String:name[], bool:dontBroadcast)
  6150. {
  6151. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6152. if (client > 0) {
  6153. if (tf2_players[client][jump_status] != TF2_JUMP_STICKY) {
  6154. tf2_players[client][jump_status] = TF2_JUMP_STICKY;
  6155. log_player_event(client, "triggered", "sticky_jump");
  6156. }
  6157. }
  6158. }
  6159.  
  6160.  
  6161. public Event_TF2JumpLanded(Handle:event, const String:name[], bool:dontBroadcast)
  6162. {
  6163. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6164. if (client > 0) {
  6165. tf2_players[client][jump_status] = TF2_JUMP_NONE;
  6166.  
  6167. }
  6168. }
  6169.  
  6170.  
  6171. public Event_TF2ObjectDeflected(Handle:event, const String:name[], bool:dontBroadcast)
  6172. {
  6173. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6174. new owner = GetClientOfUserId(GetEventInt(event, "ownerid"));
  6175.  
  6176. if ((client > 0) && (owner > 0)) {
  6177. new weapon_id = GetEventInt(event, "weaponid");
  6178.  
  6179. switch (weapon_id) {
  6180. case TF_WEAPON_NONE: {
  6181. log_player_player_event(client, owner, "triggered", "airblast_player", 1);
  6182. }
  6183. case TF_WEAPON_COMPOUND_BOW: {
  6184. if (gameme_plugin[sdkhook_available]) {
  6185. new weapon_index = get_tf2_weapon_index("deflect_arrow");
  6186. if (weapon_index > -1) {
  6187. player_weapons[client][weapon_index][wshots]++;
  6188. }
  6189. }
  6190. }
  6191. case TF_WEAPON_FLAREGUN: {
  6192. if (gameme_plugin[sdkhook_available]) {
  6193. new weapon_index = get_tf2_weapon_index("deflect_flare");
  6194. if(weapon_index > -1) {
  6195. player_weapons[client][weapon_index][wshots]++;
  6196. }
  6197. }
  6198. }
  6199. case TF_WEAPON_ROCKETLAUNCHER: {
  6200. if (gameme_plugin[sdkhook_available]) {
  6201. new weapon_index = get_tf2_weapon_index("deflect_rocket");
  6202. if(weapon_index > -1) {
  6203. player_weapons[client][weapon_index][wshots]++;
  6204. }
  6205. }
  6206. }
  6207. case TF_WEAPON_DIRECTHIT: {
  6208. if (gameme_plugin[sdkhook_available]) {
  6209. new weapon_index = get_tf2_weapon_index("deflect_rocket");
  6210. if(weapon_index > -1) {
  6211. player_weapons[client][weapon_index][wshots]++;
  6212. }
  6213. }
  6214. }
  6215. case TF_WEAPON_GRENADE_DEMOMAN: {
  6216. if (gameme_plugin[sdkhook_available]) {
  6217. new weapon_index = get_tf2_weapon_index("deflect_promode");
  6218. if(weapon_index > -1) {
  6219. player_weapons[client][weapon_index][wshots]++;
  6220. }
  6221. }
  6222. }
  6223. }
  6224.  
  6225. }
  6226. }
  6227.  
  6228.  
  6229. public OnHL2MPFireBullets(attacker, shots, String: weapon_str[])
  6230. {
  6231. if ((attacker > 0) && (attacker <= MaxClients)) {
  6232. decl String: weapon_name[32];
  6233. GetClientWeapon(attacker, weapon_name, 32);
  6234. new weapon_index = get_weapon_index(hl2mp_weapon_list, MAX_HL2MP_WEAPON_COUNT, weapon_name[7]);
  6235. if (weapon_index > -1) {
  6236. player_weapons[attacker][weapon_index][wshots]++;
  6237. }
  6238. }
  6239. }
  6240.  
  6241.  
  6242. public OnHL2MPTraceAttack(victim, attacker, inflictor, Float: damage, damagetype, ammotype, hitbox, hitgroup)
  6243. {
  6244. if ((hitgroup > 0) && (attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6245. if (IsValidEntity(inflictor)) {
  6246. decl String: inflictorclsname[64];
  6247. if ((GetEntityNetClass(inflictor, inflictorclsname, sizeof(inflictorclsname)) && (strcmp(inflictorclsname, "CCrossbowBolt") == 0))) {
  6248. hl2mp_players[victim][nextbow_hitgroup] = hitgroup;
  6249. return;
  6250. }
  6251. }
  6252. hl2mp_players[victim][next_hitgroup] = hitgroup;
  6253. }
  6254. }
  6255.  
  6256.  
  6257. public OnHL2MPTakeDamage(victim, attacker, inflictor, Float:damage, damagetype)
  6258. {
  6259. if ((attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6260. decl String: weapon_str[32];
  6261. GetClientWeapon(attacker, weapon_str, 32);
  6262. new weapon_index = -1;
  6263.  
  6264. if (IsValidEntity(inflictor)) {
  6265. decl String: inflictorclsname[64];
  6266. if (GetEntityNetClass(inflictor, inflictorclsname, sizeof(inflictorclsname)) && strcmp(inflictorclsname, "CCrossbowBolt") == 0) {
  6267. weapon_index = HL2MP_CROSSBOW;
  6268. }
  6269. }
  6270. if (weapon_index == -1) {
  6271. weapon_index = get_weapon_index(hl2mp_weapon_list, MAX_HL2MP_WEAPON_COUNT, weapon_str[7]);
  6272. }
  6273.  
  6274. new hitgroup = ((weapon_index == HL2MP_CROSSBOW) ? hl2mp_players[victim][nextbow_hitgroup] : hl2mp_players[victim][next_hitgroup]);
  6275. if (hitgroup < 8) {
  6276. hitgroup += LOG_HIT_OFFSET;
  6277. }
  6278.  
  6279. new bool: headshot = ((GetClientHealth(victim) <= 0) && (hitgroup == HITGROUP_HEAD));
  6280. if (weapon_index > -1) {
  6281. player_weapons[attacker][weapon_index][whits]++;
  6282. player_weapons[attacker][weapon_index][wdamage] += RoundToNearest(damage);
  6283. player_weapons[attacker][weapon_index][hitgroup]++;
  6284. if (headshot) {
  6285. player_weapons[attacker][weapon_index][wheadshots]++;
  6286. }
  6287. }
  6288.  
  6289. if (weapon_index == HL2MP_CROSSBOW) {
  6290. hl2mp_players[victim][nextbow_hitgroup] = 0;
  6291. } else {
  6292. hl2mp_players[victim][next_hitgroup] = 0;
  6293. }
  6294.  
  6295. }
  6296. }
  6297.  
  6298.  
  6299. public OnZPSFireBullets(attacker, shots, String: weapon[])
  6300. {
  6301. if ((attacker > 0) && (attacker <= MaxClients)) {
  6302. decl String: weapon_name[32];
  6303. GetClientWeapon(attacker, weapon_name, 32);
  6304. new weapon_index = get_weapon_index(zps_weapon_list, MAX_ZPS_WEAPON_COUNT, weapon_name);
  6305. if (weapon_index > -1) {
  6306. player_weapons[attacker][weapon_index][wshots]++;
  6307. }
  6308. }
  6309. }
  6310.  
  6311.  
  6312. public OnZPSTraceAttack(victim, attacker, inflictor, Float:damage, damagetype, ammotype, hitbox, hitgroup)
  6313. {
  6314. if ((hitgroup > 0) && (attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6315. zps_players[victim][next_hitgroup] = hitgroup;
  6316. }
  6317. }
  6318.  
  6319.  
  6320. public OnZPSTakeDamage(victim, attacker, inflictor, Float:damage, damagetype)
  6321. {
  6322. if ((attacker > 0) && (attacker <= MaxClients) && (victim > 0) && (victim <= MaxClients)) {
  6323. new hitgroup = zps_players[victim][next_hitgroup];
  6324. if (hitgroup < 8) {
  6325. hitgroup += LOG_HIT_OFFSET;
  6326. }
  6327. new bool: headshot = ((GetClientHealth(victim) <= 0) && (hitgroup == HITGROUP_HEAD));
  6328.  
  6329. decl String: weapon_str[32];
  6330. GetClientWeapon(attacker, weapon_str, 32);
  6331. new weapon_index = get_weapon_index(zps_weapon_list, MAX_ZPS_WEAPON_COUNT, weapon_str);
  6332.  
  6333. if (weapon_index > -1) {
  6334. player_weapons[attacker][weapon_index][whits]++;
  6335. player_weapons[attacker][weapon_index][wdamage] += RoundToNearest(damage);
  6336. if (headshot) {
  6337. player_weapons[attacker][weapon_index][wheadshots]++;
  6338. }
  6339. }
  6340. zps_players[victim][next_hitgroup] = 0;
  6341. }
  6342. }
  6343.  
  6344.  
  6345. stock AddPluginServerTag(const String:tag[])
  6346. {
  6347. if ((gameme_plugin[sv_tags] == INVALID_HANDLE) ||
  6348. ((gameme_plugin[engine_version] != Engine_CSS) && (gameme_plugin[engine_version] != Engine_HL2DM) &&
  6349. (gameme_plugin[engine_version] != Engine_DODS) && (gameme_plugin[engine_version] != Engine_TF2) &&
  6350. (gameme_plugin[engine_version] != Engine_NuclearDawn) && (gameme_plugin[engine_version] != Engine_Left4Dead) &&
  6351. (gameme_plugin[engine_version] != Engine_Left4Dead2) && (gameme_plugin[engine_version] != Engine_CSGO) &&
  6352. (gameme_plugin[engine_version] != Engine_Insurgency))) {
  6353. return;
  6354. }
  6355.  
  6356. if (FindStringInArray(gameme_plugin[custom_tags], tag) == -1) {
  6357. PushArrayString(gameme_plugin[custom_tags], tag);
  6358. }
  6359.  
  6360. decl String: current_tags[128];
  6361. GetConVarString(gameme_plugin[sv_tags], current_tags, 128);
  6362. if (StrContains(current_tags, tag) > -1) {
  6363. LogToGame("gameME gameserver tag already exists [%s]", current_tags);
  6364. return;
  6365. }
  6366.  
  6367. decl String: new_tags[128];
  6368. Format(new_tags, sizeof(new_tags), "%s%s%s", current_tags, (current_tags[0] != 0) ? "," : "", tag);
  6369.  
  6370. new flags = GetConVarFlags(gameme_plugin[sv_tags]);
  6371. SetConVarFlags(gameme_plugin[sv_tags], flags & ~FCVAR_NOTIFY);
  6372. gameme_plugin[ignore_next_tag_change] = true;
  6373. SetConVarString(gameme_plugin[sv_tags], new_tags);
  6374. gameme_plugin[ignore_next_tag_change] = false;
  6375. SetConVarFlags(gameme_plugin[sv_tags], flags);
  6376.  
  6377. LogToGame("Added gameME gameserver tag [%s]", new_tags);
  6378. }
  6379.  
  6380.  
  6381. public Event_INSMODPlayerDeath(Handle: event, const String: name[], bool:dontBroadcast)
  6382. {
  6383. // "deathflags" "short"
  6384. // "attacker" "short"
  6385. // "customkill" "short"
  6386. // "lives" "short"
  6387. // "attackerteam" "short"
  6388. // "damagebits" "short"
  6389. // "weapon" "string"
  6390. // "weaponid" "short"
  6391. // "userid" "short"
  6392. // "priority" "short"
  6393. // "team" "short"
  6394. // "y" "float"
  6395. // "x" "float"
  6396. // "z" "float"
  6397. // "assister" "short"
  6398.  
  6399. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  6400. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  6401.  
  6402. if ((victim > 0) && (attacker > 0)) {
  6403. if (attacker != victim) {
  6404. decl String: weapon_str[32];
  6405. GetEventString(event, "weapon", weapon_str, 32);
  6406. ReplaceString(weapon_str, 32, "weapon_", "", false);
  6407.  
  6408. new weapon_index = get_weapon_index(insmod_weapon_list, MAX_INSMOD_WEAPON_COUNT, weapon_str);
  6409. if (weapon_index > -1) {
  6410. player_weapons[attacker][weapon_index][wkills]++;
  6411. player_weapons[victim][weapon_index][wdeaths]++;
  6412. if (GetClientTeam(attacker) == GetClientTeam(victim)) {
  6413. player_weapons[attacker][weapon_index][wteamkills]++;
  6414. }
  6415. }
  6416.  
  6417. new assister = GetClientOfUserId(GetEventInt(event, "assister"));
  6418. if ((assister > 0) && (assister != victim)) {
  6419. log_player_player_event(assister, victim, "triggered", "kill_assist");
  6420. }
  6421. }
  6422. dump_player_data(victim);
  6423. }
  6424. }
  6425.  
  6426.  
  6427. public Event_INSMODPlayerHurt(Handle: event, const String: name[], bool:dontBroadcast)
  6428. {
  6429. // "userid" "short"
  6430. // "weapon" "string"
  6431. // "hitgroup" "short"
  6432. // "priority" "short"
  6433. // "attacker" "short"
  6434. // "dmg_health" "short"
  6435. // "health" "byte"
  6436.  
  6437. new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  6438. new victim = GetClientOfUserId(GetEventInt(event, "userid"));
  6439.  
  6440. if ((attacker > 0) && (attacker != victim)) {
  6441. decl String: weapon_str[32];
  6442. GetEventString(event, "weapon", weapon_str, 32);
  6443. ReplaceString(weapon_str, 32, "weapon_", "", false);
  6444.  
  6445. new weapon_index = get_weapon_index(insmod_weapon_list, MAX_INSMOD_WEAPON_COUNT, weapon_str);
  6446. if (weapon_index > -1) {
  6447. player_weapons[attacker][weapon_index][wshots]++;
  6448. player_weapons[attacker][weapon_index][whits]++;
  6449. player_weapons[attacker][weapon_index][wdamage] += GetEventInt(event, "dmg_health");
  6450. new hitgroup = GetEventInt(event, "hitgroup");
  6451. if (hitgroup < 8) {
  6452. player_weapons[attacker][weapon_index][hitgroup + LOG_HIT_OFFSET]++;
  6453. } else {
  6454. player_weapons[attacker][weapon_index][hitgroup]++;
  6455. }
  6456.  
  6457. if (hitgroup == HITGROUP_HEAD) {
  6458. player_weapons[attacker][weapon_index][wheadshots]++;
  6459. if (IsClientInGame(attacker)) {
  6460. log_player_event(attacker, "triggered", "headshot");
  6461. }
  6462. }
  6463. }
  6464. }
  6465. }
  6466.  
  6467.  
  6468. public Event_INSMODEventFired(Handle:event, const String:name[], bool:dontBroadcast)
  6469. {
  6470. // "weaponid" "short"
  6471. // "userid" "short"
  6472. // "shots" "byte"
  6473.  
  6474. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6475. new String: weapon_str[32];
  6476. GetClientWeapon(client, weapon_str, 32);
  6477. ReplaceString(weapon_str, 32, "weapon_", "", false);
  6478.  
  6479. new weapon_index = get_weapon_index(insmod_weapon_list, MAX_INSMOD_WEAPON_COUNT, weapon_str);
  6480. if (weapon_index > -1) {
  6481. player_weapons[client][weapon_index][wshots]++;
  6482. }
  6483.  
  6484. }
  6485.  
  6486.  
  6487. public Event_INSMODPlayerSpawn(Handle: event, const String: name[], bool:dontBroadcast)
  6488. {
  6489. new userid = GetClientOfUserId(GetEventInt(event, "userid"));
  6490. if (userid > 0) {
  6491. reset_player_data(userid);
  6492. }
  6493. }
  6494.  
  6495.  
  6496. public Event_INSMODRoundEnd(Handle: event, const String: name[], bool:dontBroadcast)
  6497. {
  6498. for (new i = 1; (i <= MaxClients); i++) {
  6499. dump_player_data(i);
  6500. }
  6501.  
  6502. new team_index = GetEventInt(event, "winner");
  6503. if (team_index > 0) {
  6504. log_team_event(team_list[team_index], "Round_Win");
  6505. }
  6506. }
  6507.  
  6508.  
  6509. /**
  6510. * Insurgency2 Logger/LogFixer
  6511. * Based on SuperLogs by psychonic (https://forums.alliedmods.net/showthread.php?t=99231?t=99231)
  6512. * Author: FZFalzar of Brutus.SG Modded Servers (http://brutus.sg)
  6513. * Updated and maintained by Jared Ballou (http://jballou.com)
  6514. * Version: 1.2.0
  6515. */
  6516.  
  6517.  
  6518.  
  6519. public Event_INSMODPlayerPickSquad(Handle:event, const String:name[], bool:dontBroadcast)
  6520. {
  6521. // "squad_slot" "byte"
  6522. // "squad" "byte"
  6523. // "userid" "short"
  6524. // "class_template" "string"
  6525.  
  6526.  
  6527. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  6528.  
  6529. if( client == 0) {
  6530. return;
  6531. }
  6532.  
  6533. decl String: class_template[64];
  6534. GetEventString(event, "class_template", class_template, sizeof(class_template));
  6535. ReplaceString(class_template, sizeof(class_template), "template_", "", false);
  6536. ReplaceString(class_template, sizeof(class_template), "_training", "", false);
  6537. ReplaceString(class_template, sizeof(class_template), "_coop", "", false);
  6538. ReplaceString(class_template, sizeof(class_template), "coop_", "", false);
  6539. ReplaceString(class_template, sizeof(class_template), "_security", "", false);
  6540. ReplaceString(class_template, sizeof(class_template), "_insurgent", "", false);
  6541. ReplaceString(class_template, sizeof(class_template), "_survival", "", false);
  6542.  
  6543. if(!StrEqual(insmod_players[client][last_role], class_template)) {
  6544. LogToGame("\"%L\" changed role to \"%s\"", client, class_template);
  6545. strcopy(insmod_players[client][last_role], 64, class_template);
  6546. }
  6547. }
  6548.  
  6549.  
  6550. public Action: Event_INSMODObjectiveDestroyed(Handle: event, const String: name[], bool: dontBroadcast)
  6551. {
  6552. //"team" "byte"
  6553. //"attacker" "byte"
  6554. //"cp" "short"
  6555. //"index" "short"
  6556. //"type" "byte"
  6557. //"weapon" "string"
  6558. //"weaponid" "short"
  6559. //"assister" "byte"
  6560. //"attackerteam" "byte"
  6561.  
  6562. new client = GetClientOfUserId(GetEventInt(event, "attacker"));
  6563. if ((client > 0) && (client <= MaxClients) && (IsClientInGame(client))) {
  6564. log_player_event(client, "triggered", "obj_destroyed");
  6565. }
  6566. }
  6567.  
  6568.  
  6569. public Action: Event_INSMODControlpointCapped(Handle: event, const String: name[], bool: dontBroadcast)
  6570. {
  6571. // "priority" "short"
  6572. // "cp" "byte"
  6573. // "cappers" "string"
  6574. // "cpname" "string"
  6575. // "team" "byte"
  6576.  
  6577. decl String: cappers[256];
  6578. GetEventString(event, "cappers", cappers, sizeof(cappers));
  6579.  
  6580. for (new i = 0; i < strlen(cappers); i++) {
  6581. new client = cappers[i];
  6582. if ((client > 0) && (client <= MaxClients) && (IsClientInGame(client))) {
  6583. log_player_event(client, "triggered", "obj_captured");
  6584. }
  6585. }
  6586. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement