Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2013
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "Channel.h"
  3.  
  4. class System_Censure : public PlayerScript
  5. {
  6. public:
  7. System_Censure() : PlayerScript("System_Censure") {}
  8.  
  9. void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg)
  10. {
  11. CheckMessage(player, msg, lang, NULL, NULL, NULL, NULL);
  12. }
  13.  
  14. void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver)
  15. {
  16. CheckMessage(player, msg, lang, receiver, NULL, NULL, NULL);
  17. }
  18.  
  19. void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Group* group)
  20. {
  21. CheckMessage(player, msg, lang, NULL, group, NULL, NULL);
  22. }
  23.  
  24. void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Guild* guild)
  25. {
  26. CheckMessage(player, msg, lang, NULL, NULL, guild, NULL);
  27. }
  28.  
  29. void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Channel* channel)
  30. {
  31. CheckMessage(player, msg, lang, NULL, NULL, NULL, channel);
  32. }
  33.  
  34. void CheckMessage(Player* player, std::string& msg, uint32 lang, Player* /*receiver*/, Group* /*group*/, Guild* /*guild*/, Channel* channel)
  35. {
  36. //if (player->isGameMaster() || lang == LANG_ADDON)
  37. //return;
  38.  
  39. // transform to lowercase (for simpler checking)
  40. std::string lower = msg;
  41. std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
  42.  
  43. uint8 cheksSize = 27;
  44. std::string checks[27];
  45. checks[0] ="http://";
  46. checks[1] =".com";
  47. checks[2] =".www";
  48. checks[3] =".net";
  49. checks[4] =".org";
  50. checks[5] =".ru";
  51. checks[6] ="www.";
  52. checks[7] ="wow-";
  53. checks[8] ="-wow";
  54. checks[9] ="rondor";
  55. checks[10] ="no-ip";
  56. checks[11] =".zapto";
  57. checks[12] ="wow-cool";
  58. checks[13] ="elgracia";
  59. checks[14] ="spzone";
  60. checks[15] ="fakewow";
  61. checks[16] ="deathside";
  62. checks[17] ="warsong";
  63. checks[18] ="RiverRise";
  64. checks[19] ="air-world";
  65. checks[20] =".lt";
  66. checks[21] ="sirus";
  67. checks[22] ="backkor";
  68. checks[23] ="isengard";
  69. checks[24] ="wowcircle";
  70. checks[25] ="izbooshka";
  71. checks[26] ="magic";
  72. for (int i = 0; i < cheksSize; ++i)
  73. if (lower.find(checks[i]) != std::string::npos)
  74. {
  75. msg = "";
  76. ChatHandler(player).PSendSysMessage("Реклама запрещена!");
  77. return;
  78. }
  79. }
  80. };
  81.  
  82. void AddSC_System_Censure()
  83. {
  84. new System_Censure();
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement