cat_name convar & cat_name_set command
This commit is contained in:
parent
46b8edb24a
commit
7988469198
@ -20,6 +20,8 @@ void ThirdpersonCallback(IConVar* var, const char* pOldValue, float flOldValue)
|
||||
}
|
||||
}
|
||||
|
||||
bool need_name_change = true;
|
||||
CatVar force_name(CV_STRING, "name", "", "Force name");
|
||||
CatVar cathook(CV_SWITCH, "enabled", "1", "CatHook enabled", "Disabling this completely disables cathook (can be re-enabled)");
|
||||
CatVar ignore_taunting(CV_SWITCH, "ignore_taunting", "1", "Ignore taunting", "Aimbot/Triggerbot won't attack taunting enemies");
|
||||
CatVar send_packets(CV_SWITCH, "sendpackets", "1", "Send packets", "Internal use");
|
||||
|
@ -25,6 +25,8 @@ extern CatVar force_thirdperson;
|
||||
extern CatVar console_logging;
|
||||
extern CatVar fast_outline;
|
||||
extern CatVar roll_speedhack;
|
||||
extern CatVar force_name;
|
||||
extern bool need_name_change;
|
||||
|
||||
class GlobalSettings {
|
||||
public:
|
||||
|
@ -325,7 +325,7 @@ CatVar crit_suppress(CV_SWITCH, "crit_suppress", "0", "Disable random crits", "C
|
||||
CatVar anti_afk(CV_SWITCH, "anti_afk", "0", "Anti-AFK", "Sends random commands to prevent being kicked from server");
|
||||
CatVar tauntslide(CV_SWITCH, "tauntslide", "0", "TF2C tauntslide", "Allows moving and shooting while taunting");
|
||||
|
||||
CatCommand name("name", "Change name", [](const CCommand& args) {
|
||||
CatCommand name("name_set", "Immediate name change", [](const CCommand& args) {
|
||||
if (args.ArgC() < 2) {
|
||||
logging::Info("Set a name, silly");
|
||||
return;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "../segvcatch/segvcatch.h"
|
||||
#include "../copypasted/CSignature.h"
|
||||
#include "../profiler.h"
|
||||
#include "../netmessage.h"
|
||||
|
||||
CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1", "Clean screenshots", "Don't draw visuals while taking a screenshot");
|
||||
CatVar disable_visuals(CV_SWITCH, "no_visuals", "0", "Disable ALL drawing", "Completely hides cathook");
|
||||
@ -57,6 +58,18 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
g_ISurface->SetCursorAlwaysVisible(vis);
|
||||
}
|
||||
|
||||
if (force_name.convar->m_StringLength > 2 && need_name_change) {
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
if (ch) {
|
||||
logging::Info("Sending new name");
|
||||
NET_SetConVar setname("name", force_name.GetString());
|
||||
setname.SetNetChannel(ch);
|
||||
setname.SetReliable(false);
|
||||
ch->SendNetMsg(setname, false);
|
||||
need_name_change = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (call_default) SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
|
||||
// To avoid threading problems.
|
||||
|
||||
@ -111,6 +124,10 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
#endif
|
||||
AddSideString("Press 'INSERT' key to open/close cheat menu.", GUIColor());
|
||||
AddSideString("Use mouse to navigate in menu.", GUIColor());
|
||||
const char* name = (force_name.convar->m_StringLength > 2 ? force_name.GetString() : "*Not Set*");
|
||||
AddSideString(""); // foolish
|
||||
AddSideString(format("Custom Name: ", name), GUIColor());
|
||||
AddSideString(format("Custom Disconnect Reason: ", (disconnect_reason.convar->m_StringLength > 3 ? disconnect_reason.GetString() : "*Not Set*")), GUIColor());
|
||||
}
|
||||
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid) {
|
||||
|
@ -289,16 +289,42 @@ void LevelInit_hook(void* thisptr, const char* newmap) {
|
||||
//if (TF) LEVEL_INIT(SpyAlert);
|
||||
chat_stack::Reset();
|
||||
hacks::shared::spam::Reset();
|
||||
need_name_change = true;
|
||||
if (force_name.convar->m_StringLength > 2) {
|
||||
//static ConVar* name_cv = g_ICvar->FindVar("name");
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
if (ch) {
|
||||
logging::Info("Sending new name");
|
||||
NET_SetConVar setname("name", force_name.GetString());
|
||||
setname.SetNetChannel(ch);
|
||||
setname.SetReliable(false);
|
||||
ch->SendNetMsg(setname, false);
|
||||
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CanInspect_hook(IClientEntity*) { return true; }
|
||||
|
||||
void LevelShutdown_hook(void* thisptr) {
|
||||
need_name_change = true;
|
||||
playerlist::Save();
|
||||
((LevelShutdown_t*) hooks::hkClientMode->GetMethod(hooks::offLevelShutdown))(thisptr);
|
||||
g_Settings.bInvalid = true;
|
||||
hacks::shared::aimbot::Reset();
|
||||
chat_stack::Reset();
|
||||
hacks::shared::spam::Reset();
|
||||
if (force_name.convar->m_StringLength > 2) {
|
||||
//static ConVar* name_cv = g_ICvar->FindVar("name");
|
||||
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
||||
if (ch) {
|
||||
logging::Info("Sending new name");
|
||||
NET_SetConVar setname("name", force_name.GetString());
|
||||
setname.SetNetChannel(ch);
|
||||
setname.SetReliable(false);
|
||||
ch->SendNetMsg(setname, false);
|
||||
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,9 @@ class INetMessage;
|
||||
class CViewSetup;
|
||||
class bf_read;
|
||||
class SDL_Window;
|
||||
class CatVar;
|
||||
|
||||
extern CatVar disconnect_reason;
|
||||
|
||||
bool CanPacket_hook(void*);
|
||||
int IN_KeyEvent_hook(void*, int, int, const char*);
|
||||
|
Reference in New Issue
Block a user