Update others.cpp

This commit is contained in:
BenCat07 2018-03-03 21:28:59 +01:00 committed by GitHub
parent 2347911f45
commit d83f65f0df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -661,6 +661,8 @@ static CatVar dispatch_log(CV_SWITCH, "debug_log_usermessages", "0",
"Log dispatched user messages"); "Log dispatched user messages");
std::string clear = ""; std::string clear = "";
static bool firstcall = true; static bool firstcall = true;
Timer sendmsg{};
bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf) bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
{ {
int loop_index, s, i, j; int loop_index, s, i, j;
@ -865,24 +867,30 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
} }
if (crypt_chat) if (crypt_chat)
{ {
if (firstcall) if (sendmsg.test_and_set(300000))
chat_stack::Say("!!meow", false); chat_stack::Say("!!meow", false);
firstcall = false; firstcall = false;
if (message.find("!!") == 0) if (message.find("!!") == 0)
{ {
static player_info_s info;
static unsigned steamid;
if (ucccccp::validate(message)) if (ucccccp::validate(message))
{ {
CachedEntity *entity = ENTITY(data[0]); if (g_IEngine->GetPlayerInfo(data[0], &info) &&
if (CE_GOOD(entity)) playerlist::AccessData(steamid).state !=
playerlist::k_EState::CAT)
{ {
if (boost::algorithm::contains( steamid = info.friendsID;
ucccccp::decrypt(message), "meow")) CachedEntity *entity = ENTITY(data[0]);
if (CE_GOOD(entity))
{ {
player_info_s info; if (boost::algorithm::contains(
g_IEngine->GetPlayerInfo(data[0], &info); ucccccp::decrypt(message), "meow"))
unsigned steamid = info.friendsID; {
playerlist::AccessData(steamid).state = playerlist::AccessData(steamid).state =
playerlist::k_EState::CAT; playerlist::k_EState::CAT;
chat_stack::Say("!!meow", false);
}
} }
} }
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(),