Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1.) Search for:
- extern int g_nPortalLimitTime;
- //2.) Add after:
- #include <boost/format.hpp>
- #define AUTO_BLOCK_CHAT_TIME 60
- #define AUTO_BLOCK_CHAT_FILE "locale/country/banword.txt"
- //1.) Search for:
- if (true == SpamBlockCheck(ch, buf, buflen))
- {
- return iExtraLen;
- }
- //2.) Add after:
- // START OF AUTO BLOCK CHAT //
- std::string c_pszContent(buf);
- std::string c_pszCommand = str(boost::format("%s %d") % ch->GetName() % AUTO_BLOCK_CHAT_TIME);
- std::string c_pszDelimiter = ",";
- FILE *fp = fopen(AUTO_BLOCK_CHAT_FILE, "r");
- if (!fp)
- {
- sys_err("Cannot open %s", AUTO_BLOCK_CHAT_FILE);
- return iExtraLen;
- }
- char szLine[1024];
- fscanf(fp, "%[^\n]", szLine);
- std::string c_pszString(szLine);
- size_t pos = 0;
- std::string token;
- while ((pos = c_pszString.find(c_pszDelimiter)) != std::string::npos)
- {
- token = c_pszString.substr(0, pos);
- c_pszString.erase(0, pos + c_pszDelimiter.length());
- std::size_t position = c_pszContent.find(token);
- if (position != std::string::npos)
- {
- if (!ch->FindAffect(AFFECT_BLOCK_CHAT))
- {
- char buf[256];
- snprintf(buf, sizeof(buf), "Player %s has been blocked chat for %d seconds.", ch->GetName(), AUTO_BLOCK_CHAT_TIME);
- SendNotice(buf);
- interpret_command(NULL, "block_chat", 10);
- }
- }
- }
- fclose(fp);
- // END OF AUTO BLOCK CHAT //
Advertisement
Add Comment
Please, Sign In to add comment