Remove "cat_spam_newlines"

This commit is contained in:
nullifiedcat 2017-05-02 15:34:21 +03:00
parent 408a3f508a
commit 41eee3591c
5 changed files with 17 additions and 6 deletions

View File

@ -526,7 +526,7 @@ static const std::string list_tf2 = R"(
"Chat Options Menu"
"killsay"
"spam"
"spam_newlines"
"chat_newlines"
"clean_chat"
]

View File

@ -13,8 +13,8 @@
namespace hacks { namespace shared { namespace spam {
CatVar enabled(CV_SWITCH, "spam", "0", "Chat spam", "Enable Spam");
//static CatEnum spam_enum({""});
CatVar filename(CV_STRING, "spam_file", "spam.txt", "Spam file (~/.cathook/...)", "Spam file name. Each line should be no longer than 100 characters, file must be located in ~/.cathook folder");
CatVar newlines(CV_SWITCH, "spam_newlines", "1", "Spam newlines", "If enabled, several newlines will be added before each message");
CatCommand reload("spam_reload", "Reload spam file", Reload);
int current_index { 0 };
@ -28,7 +28,7 @@ void CreateMove() {
if (g_GlobalVars->curtime - last_spam > 0.8f) {
if (chat_stack::stack.empty()) {
if (current_index >= file.LineCount()) current_index = 0;
std::string spamString = (newlines ? format("\n\n\n\n\n\n\n\n\n\n\n\n", file.Line(current_index)) : file.Line(current_index));
std::string spamString = file.Line(current_index);
ReplaceString(spamString, "\\n", "\n");
chat_stack::stack.push(spamString);
current_index++;

View File

@ -18,7 +18,6 @@ namespace hacks { namespace shared { namespace spam {
extern CatVar enabled;
extern CatVar filename;
extern CatVar newlines;
extern CatCommand reload;
void CreateMove();

View File

@ -94,7 +94,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
hooks::hkNetChannel = new hooks::VMTHook();
hooks::hkNetChannel->Init(ch, 0);
hooks::hkNetChannel->HookMethod((void*)CanPacket_hook, hooks::offCanPacket);
//hooks::hkNetChannel->HookMethod((void*)SendNetMsg_hook, hooks::offSendNetMsg);
hooks::hkNetChannel->HookMethod((void*)SendNetMsg_hook, hooks::offSendNetMsg);
hooks::hkNetChannel->HookMethod((void*)Shutdown_hook, hooks::offShutdown);
hooks::hkNetChannel->Apply();
}

View File

@ -107,9 +107,21 @@ static CatCommand minus_use_action_slot_item_server("-cat_use_action_slot_item_s
g_IEngine->ServerCmdKeyValues(kv);
});
// Not used anymore..
static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", "Add # newlines before each your message");
bool SendNetMsg_hook(void* thisptr, INetMessage& msg, bool bForceReliable = false, bool bVoice = false) {
SEGV_BEGIN;
// net_StringCmd
if (msg.GetType() == 4 && newlines_msg) {
std::string str(msg.ToString());
if (str.find("net_StringCmd: \"say \"") == 0) {
std::string newlines = std::string((int)newlines_msg, '\n');
str.insert(21, newlines);
str = str.substr(16, str.length() - 17);
NET_StringCmd stringcmd(str.c_str());
return ((SendNetMsg_t*)hooks::hkNetChannel->GetMethod(hooks::offSendNetMsg))(thisptr, stringcmd, bForceReliable, bVoice);
}
}
if (log_sent && msg.GetType() != 3 && msg.GetType() != 9) {
logging::Info("=> %s [%i] %s", msg.GetName(), msg.GetType(), msg.ToString());
unsigned char buf[4096];