Guest User

Untitled

a guest
Dec 8th, 2019
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <sourcemod>
  2. #include <multicolors>
  3. #include <cstrike>
  4.  
  5. #define PLUGIN_URL "https://github.com/ESK0"
  6. #define PLUGIN_VERSION "1.0"
  7. #define PLUGIN_AUTHOR "ESK0"
  8.  
  9. static String: ConfigPath[PLATFORM_MAX_PATH];
  10.  
  11. new String: TsName[32];
  12. new String: TsDead[16];
  13.  
  14. new String: CTsName[32];
  15. new String: CTsDead[16];
  16.  
  17. new String: Access[32];
  18.  
  19. new g_iEnable;
  20.  
  21. public Plugin:myinfo =
  22. {
  23. name = "Admin See Chat",
  24. author = PLUGIN_AUTHOR,
  25. description = "Admin can see enemy team chat",
  26. version = PLUGIN_VERSION,
  27. url = PLUGIN_URL
  28. }
  29.  
  30. public OnPluginStart()
  31. {
  32. LoadConfig();
  33. AddCommandListener(OnPlayerChatTeam, "say_team");
  34. }
  35. public Action:OnPlayerChatTeam(client, const String:command[], args)
  36. {
  37. if(g_iEnable)
  38. {
  39. new String:message[256]
  40. new sender = GetClientTeam(client)
  41. GetCmdArg(1, message, sizeof(message))
  42. new receiver;
  43. if ((client > 0) && IsClientInGame(client))
  44. {
  45. if(message[0] == '/' || message[0] == '@' || message[0] == 0)
  46. {
  47. return Plugin_Handled;
  48. }
  49. for(new i = 1; i < MaxClients; i++)
  50. {
  51. if(IsValidClient(i))
  52. {
  53. if (CheckCommandAccess(i, Access, ADMFLAG_GENERIC))
  54. {
  55. receiver = GetClientTeam(i)
  56. if (sender != receiver)
  57. {
  58. CPrintToChat(i, "%s%s%s %N : %s",
  59. (sender == CS_TEAM_CT) ? "{blue}" : (sender == CS_TEAM_T) ? "{orange}" : "{gray}",
  60. IsPlayerAlive(client) ? "" : (sender == CS_TEAM_T) ? TsDead : (sender == CS_TEAM_CT) ? CTsDead : "",
  61. (sender == CS_TEAM_CT) ? CTsName : (sender == CS_TEAM_T) ? TsName : "", client, message)
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. return Plugin_Continue;
  69. }
  70. LoadConfig()
  71. {
  72. BuildPath(Path_SM, ConfigPath, sizeof(ConfigPath), "configs/ASCHconfig.cfg");
  73. new Handle: hConfig = CreateKeyValues("AdminSeeChat");
  74. if(!FileExists(ConfigPath))
  75. {
  76. SetFailState("[AdminSeeChat] 'addons/sourcemod/configs/ASCHconfig.cfg' not found!");
  77. return;
  78. }
  79. FileToKeyValues(hConfig, ConfigPath);
  80. if(KvJumpToKey(hConfig, "Settings"))
  81. {
  82. g_iEnable = KvGetNum(hConfig, "Enable", 1);
  83. KvGetString(hConfig, "Ts Name", TsName, sizeof(TsName));
  84. KvGetString(hConfig, "Ts DeadTag", TsDead, sizeof(TsDead), "*DEAD*");
  85. KvGetString(hConfig, "CTs Name", CTsName, sizeof(CTsName));
  86. KvGetString(hConfig, "CTs DeadTag", CTsDead, sizeof(CTsDead), "*DEAD*");
  87. KvGetString(hConfig, "Command access", Access, sizeof(Access));
  88. }
  89. else
  90. {
  91. SetFailState("Config for 'AdminSeeChat' not found!");
  92. return;
  93. }
  94. }
  95.  
  96.  
  97. // STOCK
  98. stock bool:IsValidClient(client, bool:alive = false)
  99. {
  100. if(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))
  101. {
  102. return true;
  103. }
  104.  
  105. return false;
  106. }
RAW Paste Data