Update others.cpp

This commit is contained in:
BenCat07 2018-02-25 13:20:07 +01:00 committed by GitHub
parent 2e66e877e9
commit aa404ba108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -692,13 +692,18 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
message.push_back(c); message.push_back(c);
} }
} }
static const char *lastfilter;
static bool retrun = false;
if (retrun)
PrintChat("%s: %s", name.c_str(), lastfilter);
retrun = false;
if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX) if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX)
{ {
if (!strcmp(chat_filter.GetString(), "")) if (!strcmp(chat_filter.GetString(), ""))
{ {
std::string tmp = {}; std::string tmp = {};
std::string tmp2 = {}; std::string tmp2 = {};
int iii = 0; int iii = 0;
player_info_s info; player_info_s info;
g_IEngine->GetPlayerInfo(LOCAL_E->m_IDX, &info); g_IEngine->GetPlayerInfo(LOCAL_E->m_IDX, &info);
std::string name1 = info.name; std::string name1 = info.name;
@ -798,6 +803,8 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
boost::replace_all(message2, "7", "t"); boost::replace_all(message2, "7", "t");
for (auto filter : res) for (auto filter : res)
{ {
if (retrun)
break;
if (boost::contains(message2, filter)) if (boost::contains(message2, filter))
{ {
@ -807,6 +814,10 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
clear += "\n"; clear += "\n";
} }
chat_stack::Say(". " + clear, true); chat_stack::Say(". " + clear, true);
PrintChat("%s: %s", 0xe05938, name.c_str(),
filter.c_str());
retrun = true;
lastfilter = filter.c_str();
} }
} }
} }
@ -825,6 +836,8 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
boost::replace_all(message2, "7", "t"); boost::replace_all(message2, "7", "t");
for (auto filter : result) for (auto filter : result)
{ {
if (retrun)
break;
if (boost::contains(message2, filter)) if (boost::contains(message2, filter))
{ {
if (clear == "") if (clear == "")
@ -834,6 +847,7 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
clear += "\n"; clear += "\n";
} }
chat_stack::Say(". " + clear, true); chat_stack::Say(". " + clear, true);
retrun = true;
} }
} }
} }
@ -844,7 +858,7 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
{ {
if (ucccccp::validate(message)) if (ucccccp::validate(message))
{ {
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), PrintChat("\x07%06X%s\x01: %s", name.c_str(),
ucccccp::decrypt(message).c_str()); ucccccp::decrypt(message).c_str());
} }
} }