Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Some errors fixed by CyBeR-PrO
- #include "ScriptPCH.h"
- #include "Language.h"
- #include "Player.h"
- #include "Chat.h"
- #include "World.h"
- #include "Channel.h"
- static const char* checks[] = {
- "sytes",
- "instant",
- "dyndns",
- "no-ip",
- "http:",
- ".com",
- ".net",
- ".org",
- ".eu",
- ".fr",
- ".bg",
- ".info",
- ".br",
- "https:",
- "wow",
- "www.",
- "no-ip",
- ".zapto",
- ".biz",
- ".servegame",
- "trevonwow",
- "megawow",
- "fatalwow",
- "uniforgiven-wow",
- "wow-autolouco",
- "heaven-wow",
- "fireballwow",
- "wowbrasilpa",
- "fatalitywow",
- "demonic-wow",
- "revenge-wow",
- "heavenwow",
- "undead-wow",
- "linebr",
- "azralon",
- "black-wow",
- };
- static const size_t checksize = sizeof(checks) / sizeof(*checks);
- static void CheckMessage(Player* player, std::string& msg, uint32 lang)
- {
- //if (player->isGameMaster() || lang == LANG_ADDON)
- // return;
- // remove all space characters and transform to lowercase for simpler checking
- std::string checkmsg = msg;
- checkmsg.erase(remove_if(checkmsg.begin(), checkmsg.end(), isspace), checkmsg.end());
- std::transform(checkmsg.begin(), checkmsg.end(), checkmsg.begin(), ::tolower);
- for (size_t i = 0; i < checksize; ++i)
- {
- if (checkmsg.find(checks[i]) != std::string::npos)
- {
- msg = "";
- ChatHandler(player->GetSession()).PSendSysMessage("Links/Advertisements are not allowed!");
- return;
- }
- }
- };
- static void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg)
- {
- CheckMessage(player, msg, lang);
- }
- static void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* /*receiver*/)
- {
- CheckMessage(player, msg, lang);
- }
- static void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Group* /*group*/)
- {
- CheckMessage(player, msg, lang);
- }
- static void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Guild* /*guild*/)
- {
- CheckMessage(player, msg, lang);
- }
- static void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Channel* /*channel*/)
- {
- CheckMessage(player, msg, lang);
- }
- void AddSC_System_Censure()
- {
- Script *newscript;
- newscript = new Script;
- newscript->Name = "scripted_on_events";
- newscript->pOnChat = &OnChat;
- newscript->RegisterSelf();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement