Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdkhooks>
  3. #include <sourcebanspp> // SourceBans V1.6.3 (Added by Dr.Mohammad)
  4. //#include <sourcebans> // SourceBans V1.4.x
  5.  
  6. #pragma semicolon 1
  7. #pragma newdecls required
  8. #pragma tabsize 0
  9.  
  10. #define KvPath "configs/chatbans.cfg"
  11.  
  12. char g_BannedWords[256][PLATFORM_MAX_PATH];
  13. char configFile[PLATFORM_MAX_PATH];
  14. int wordstotal;
  15.  
  16. ConVar g_BanTime;
  17.  
  18.  
  19. public void OnPluginStart()
  20. {
  21. g_BanTime = CreateConVar("playerbans_ban_time", "1", "Time in minutes for bans.", _, true, 0.0);
  22.  
  23. BuildPath(Path_SM, configFile, sizeof(configFile), KvPath);
  24.  
  25. AddCommandListener(Command_Say, "say");
  26. AddCommandListener(Command_Say, "say_team");
  27.  
  28. AutoExecConfig(true, "chatbans_cvars", "sourcemod");
  29. }
  30.  
  31.  
  32. public void OnMapStart()
  33. {
  34. LoadWords();
  35. }
  36.  
  37. public Action Command_Say(int client, const char[] command, int argc)
  38. {
  39. char sText[192];
  40. GetCmdArgString(sText, sizeof(sText));
  41. StripQuotes(sText);
  42.  
  43. for(int i=0; i < wordstotal; i++)
  44. {
  45. if(!StrEqual("", g_BannedWords[i], false) && (StrContains(sText, g_BannedWords[i], false) != -1 || StrEqual(sText, g_BannedWords[i], false))){
  46. SBPP_BanPlayer(0, client, g_BanTime.IntValue, "Banned for using a banned word"); // SourceBans V1.6.3 (Added by Dr.Mohammad)
  47. // SBBanPlayer(0, client, g_BanTime.IntValue, "Banned for using a banned word"); // SourceBans V1.4.x
  48. return Plugin_Handled;
  49. }
  50. }
  51. return Plugin_Continue;
  52. }
  53.  
  54.  
  55. public void LoadWords()
  56. {
  57. wordstotal = 0;
  58.  
  59. KeyValues kv = new KeyValues("Words");
  60. if (!FileExists(configFile)) {
  61. LogError("The playerbans config file (%s) does not exist", configFile);
  62. }
  63.  
  64. if (!kv.ImportFromFile(configFile) || !kv.GotoFirstSubKey()) {
  65. LogError("The executes spawns file was empty");
  66. delete kv;
  67. return;
  68. }
  69.  
  70. do{
  71. kv.GetSectionName(g_BannedWords[wordstotal], sizeof(g_BannedWords[]));
  72. wordstotal++;
  73. }while(kv.GotoNextKey());
  74.  
  75. kv.Rewind();
  76. delete kv;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement