killsays and spam
This commit is contained in:
parent
1c7b6a68fb
commit
46b8edb24a
@ -524,12 +524,11 @@ static const std::string list_tf2 = R"(
|
||||
|
||||
"Chat" [
|
||||
"Chat Options Menu"
|
||||
"killsay"
|
||||
"spam"
|
||||
"spam_source"
|
||||
"spam_random"
|
||||
"chat_newlines"
|
||||
"clean_chat"
|
||||
"killsay"
|
||||
"spam"
|
||||
"spam_random"
|
||||
]
|
||||
|
||||
"Follow Bot" [
|
||||
|
@ -10,16 +10,13 @@
|
||||
#include "../sdk.h"
|
||||
#include <pwd.h>
|
||||
|
||||
void KillSayEventListener::FireGameEvent(IGameEvent* event) {
|
||||
if (!hacks::shared::killsay::enabled) return;
|
||||
std::string message = hacks::shared::killsay::ComposeKillSay(event);
|
||||
if (message.size()) {
|
||||
chat_stack::stack.push(message);
|
||||
}
|
||||
}
|
||||
|
||||
namespace hacks { namespace shared { namespace killsay {
|
||||
|
||||
static CatEnum killsay_enum({"NONE", "CUSTOM", "DEFAULT", "NCC - OFFENSIVE", "NCC - MLG"});
|
||||
static CatVar killsay_mode(killsay_enum, "killsay", "0", "Killsay", "Defines source of killsay lines. CUSTOM killsay file must be set in cat_killsay_file and loaded with cat_killsay_reload (Use console!)");
|
||||
static CatVar filename(CV_STRING, "killsay_file", "killsays.txt", "Killsay file (~/.cathook/)", "Killsay file name. Should be located in ~/.cathook folder.");
|
||||
static CatCommand reload("killsay_reload", "Reload killsays", Reload);
|
||||
|
||||
const std::string tf_classes_killsay[] = {
|
||||
"class",
|
||||
"scout",
|
||||
@ -41,13 +38,24 @@ const std::string tf_teams_killsay[] = {
|
||||
TextFile file {};
|
||||
|
||||
std::string ComposeKillSay(IGameEvent* event) {
|
||||
if (file.LineCount() == 0) return "";
|
||||
const std::vector<std::string>* source = nullptr;
|
||||
switch ((int)killsay_mode) {
|
||||
case 1:
|
||||
source = &file.lines; break;
|
||||
case 2:
|
||||
source = &builtin_default; break;
|
||||
case 3:
|
||||
source = &builtin_nonecore_offensive; break;
|
||||
case 4 :
|
||||
source = &builtin_nonecore_mlg; break;
|
||||
}
|
||||
if (!source || source->size() == 0) return "";
|
||||
if (!event) return "";
|
||||
int vid = event->GetInt("userid");
|
||||
int kid = event->GetInt("attacker");
|
||||
if (kid == vid) return "";
|
||||
if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer()) return "";
|
||||
std::string msg = file.Line(rand() % file.LineCount());
|
||||
std::string msg = source->at(rand() % source->size());
|
||||
player_info_s info;
|
||||
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info);
|
||||
ReplaceString(msg, "%name%", std::string(info.name));
|
||||
@ -64,10 +72,6 @@ std::string ComposeKillSay(IGameEvent* event) {
|
||||
return msg;
|
||||
}
|
||||
|
||||
CatVar enabled(CV_SWITCH, "killsay", "0", "KillSay", "Enable KillSay");
|
||||
CatVar filename(CV_STRING, "killsay_file", "killsays.txt", "Killsay file (~/.cathook/)", "Killsay file name. Should be located in ~/.cathook folder.");
|
||||
CatCommand reload("killsay_reload", "Reload killsays", Reload);
|
||||
|
||||
KillSayEventListener& getListener() {
|
||||
static KillSayEventListener listener;
|
||||
return listener;
|
||||
@ -85,4 +89,47 @@ void Shutdown() {
|
||||
g_IEventManager2->RemoveListener(&getListener());
|
||||
}
|
||||
|
||||
// Thanks HellJustFroze for linking me http://daviseford.com/shittalk/
|
||||
const std::vector<std::string> builtin_default = {
|
||||
"Don't worry guys, I'm a garbage collector. I'm used to carrying trash.",
|
||||
"%name% is the human equivalent of a participation award.",
|
||||
"I would insult %name%, but nature did a better job.",
|
||||
"%name%, perhaps your strategy should include trying.",
|
||||
"Some people get paid to suck, you do it for free, %name%.",
|
||||
"%name%, I'd tell you to commit suicide, but then you'd have a kill.",
|
||||
"You must really like that respawn timer, %name%.",
|
||||
|
||||
"If your main is %class%, you should give up.",
|
||||
"Hey %name%, i see you can't play %class%. Try quitting the game."
|
||||
"%team% is filled with spergs",
|
||||
"%name%@gmail.com to vacreview@valvesoftware.com\nFOUND CHEATER",
|
||||
"\n☐ Not rekt\n ☑ Rekt\n ☑ Really Rekt\n ☑ Tyrannosaurus Rekt"
|
||||
};
|
||||
|
||||
const std::vector<std::string> builtin_nonecore_offensive = {
|
||||
"%name%, you are noob.", "%name%, do you even lift?", "%name%, you're a faggot.", "%name%, stop cheating.",
|
||||
"%name%: Mom, call the police - I've got headshoted again!", "Right into your face, %name%.",
|
||||
"Into your face, pal.", "Keep crying, baby.", "Faggot. Noob.", "You are dead, not big surprise.",
|
||||
"Sit down nerd.", "Fuck you with a rake.", "Eat a man spear, you Jamaican manure salesman.",
|
||||
"Wallow in a river of cocks, you pathetic bitch.", "I will go to heaven and you will be in prison.",
|
||||
"Piss off, you poor, ignorant, mullet-wearing porch monkey.",
|
||||
"Your Mom says your turn-ons consist of butthole licking and scat porn.",
|
||||
"Shut up, you'll never be the man your mother is.",
|
||||
"It looks like your face caught on fire and someone tried to put it out with a fork.",
|
||||
"You're so ugly Hello Kitty said goodbye to you.",
|
||||
"Don't you love nature, despite what it did to you?"
|
||||
|
||||
};
|
||||
const std::vector<std::string> builtin_nonecore_mlg = {
|
||||
"GET REKT U SCRUB", "GET REKT M8", "U GOT NOSCOPED M8", "U GOT QUICKSCOPED M8", "2 FAST 4 U, SCRUB", "U GOT REKT, M8"
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
void KillSayEventListener::FireGameEvent(IGameEvent* event) {
|
||||
if (!hacks::shared::killsay::killsay_mode) return;
|
||||
std::string message = hacks::shared::killsay::ComposeKillSay(event);
|
||||
if (message.size()) {
|
||||
chat_stack::stack.push(message);
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,7 @@
|
||||
#ifndef HACKS_KILLSAY_H_
|
||||
#define HACKS_KILLSAY_H_
|
||||
|
||||
#include "IHack.h"
|
||||
|
||||
#include "../fixsdk.h"
|
||||
#include <igameevents.h>
|
||||
#include "../common.h"
|
||||
|
||||
|
||||
class CatCommand;
|
||||
@ -22,15 +19,15 @@ class KillSayEventListener : public IGameEventListener2 {
|
||||
|
||||
namespace hacks { namespace shared { namespace killsay {
|
||||
|
||||
extern CatVar enabled;
|
||||
extern CatVar filename;
|
||||
extern CatCommand reload;
|
||||
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void Reload();
|
||||
std::string ComposeKillSay(IGameEvent* event);
|
||||
|
||||
extern const std::vector<std::string> builtin_default;
|
||||
extern const std::vector<std::string> builtin_nonecore_offensive;
|
||||
extern const std::vector<std::string> builtin_nonecore_mlg;
|
||||
|
||||
}}}
|
||||
|
||||
#endif /* HACKS_KILLSAY_H_ */
|
||||
|
@ -11,10 +11,8 @@
|
||||
#include <pwd.h>
|
||||
|
||||
namespace hacks { namespace shared { namespace spam {
|
||||
|
||||
CatVar enabled(CV_SWITCH, "spam", "0", "Chat spam", "Enable Spam");
|
||||
static CatEnum spam_enum({"DEFAULT", "LENNYFACES", "BLANKS", "FROM FILE"});
|
||||
CatVar spam_source(spam_enum, "spam_source", "0", "Spam Source", "Defines source of spam lines. CUSTOM spam file must be set in cat_spam_file and loaded with cat_spam_reload (Use console!)");
|
||||
static CatEnum spam_enum({"DISABLED", "DEFAULT", "LENNYFACES", "BLANKS", "FROM FILE"});
|
||||
CatVar spam_source(spam_enum, "spam", "0", "Chat Spam", "Defines source of spam lines. CUSTOM spam file must be set in cat_spam_file and loaded with cat_spam_reload (Use console!)");
|
||||
CatVar random_order(CV_SWITCH, "spam_random", "0", "Random Order");
|
||||
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");
|
||||
CatCommand reload("spam_reload", "Reload spam file", Reload);
|
||||
@ -24,17 +22,17 @@ float last_spam { 0.0f };
|
||||
TextFile file {};
|
||||
|
||||
void CreateMove() {
|
||||
if (!enabled) return;
|
||||
if (!spam_source) return;
|
||||
if (last_spam > g_GlobalVars->curtime) last_spam = 0.0f;
|
||||
const std::vector<std::string>* source = nullptr;
|
||||
switch ((int)spam_source) {
|
||||
case 0:
|
||||
source = &builtin_default; break;
|
||||
case 1:
|
||||
source = &builtin_lennyfaces; break;
|
||||
source = &builtin_default; break;
|
||||
case 2:
|
||||
source = &builtin_blanks; break;
|
||||
source = &builtin_lennyfaces; break;
|
||||
case 3:
|
||||
source = &builtin_blanks; break;
|
||||
case 4:
|
||||
source = &file.lines; break;
|
||||
default:
|
||||
return;
|
||||
|
@ -108,18 +108,26 @@ static CatCommand minus_use_action_slot_item_server("-cat_use_action_slot_item_s
|
||||
});
|
||||
|
||||
static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", "Add # newlines before each your message");
|
||||
//static CatVar queue_messages(CV_SWITCH, "chat_queue", "0", "Queue messages", "Use this if you want to use spam/killsay and still be able to chat normally (without having your msgs eaten by valve cooldown)");
|
||||
|
||||
bool SendNetMsg_hook(void* thisptr, INetMessage& msg, bool bForceReliable = false, bool bVoice = false) {
|
||||
SEGV_BEGIN;
|
||||
// net_StringCmd
|
||||
if (msg.GetType() == 4 && newlines_msg) {
|
||||
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);
|
||||
auto say_idx = str.find("net_StringCmd: \"say \"");
|
||||
auto say_team_idx = str.find("net_StringCmd: \"say_team \"");
|
||||
if (!say_idx || !say_team_idx) {
|
||||
int offset = say_idx ? 26 : 21;
|
||||
if (newlines_msg) {
|
||||
std::string newlines = std::string((int)newlines_msg, '\n');
|
||||
str.insert(offset, 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 (queue_messages && !chat_stack::CanSend()) {
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user