improved airstuck? added achievement safety switch.
This commit is contained in:
parent
55542a6d51
commit
69e2d7ae8a
@ -33,11 +33,15 @@ CatCommand::CatCommand(std::string name, std::string help, FnCommandCallbackVoid
|
||||
}
|
||||
|
||||
void CatCommand::Register() {
|
||||
char name_c[256] = { 0 };
|
||||
char help_c[256] = { 0 };
|
||||
strcpy(name_c, name.c_str());
|
||||
strcpy(help_c, help.c_str());
|
||||
cmd = new ConCommand(name_c, callback ? callback : callback_void, help_c);
|
||||
char* name_c = new char[256];
|
||||
char* help_c = new char[256];
|
||||
strncpy(name_c, (CON_PREFIX + name).c_str(), 255);
|
||||
strncpy(help_c, help.c_str(), 255);
|
||||
if (callback) cmd = new ConCommand(name_c, callback, help_c);
|
||||
else if (callback_void) cmd = new ConCommand(name_c, callback_void, help_c);
|
||||
else throw std::logic_error("no callback in CatCommand");
|
||||
interfaces::cvar->RegisterConCommand(cmd);
|
||||
// name_c and help_c are not freed because ConCommandBase doesn't copy them
|
||||
}
|
||||
|
||||
void RegisterCatCommands() {
|
||||
|
@ -67,9 +67,9 @@ void RegisterCatCommands();
|
||||
class CatVar {
|
||||
public:
|
||||
[[deprecated]]
|
||||
CatVar(CatVar_t type, std::string name, std::string value, std::string help, CatEnum* enum_type = 0, std::string long_description = "no description", bool hasminmax = false, float max = 1.0f, float min = 0.0f);
|
||||
CatVar(CatVar_t type, std::string name, std::string value, std::string help, CatEnum* enum_type, std::string long_description = "no description", bool hasminmax = false, float max = 1.0f, float min = 0.0f);
|
||||
|
||||
CatVar(CatVar_t type, std::string name, std::string defaults, std::string desc_short, std::string desc_long);
|
||||
CatVar(CatVar_t type, std::string name, std::string defaults, std::string desc_short, std::string desc_long = "no description");
|
||||
CatVar(CatVar_t type, std::string name, std::string defaults, std::string desc_short, std::string desc_long, float max_val);
|
||||
CatVar(CatVar_t type, std::string name, std::string defaults, std::string desc_short, std::string desc_long, float min_val, float max_val);
|
||||
CatVar(CatEnum& cat_enum, std::string name, std::string defaults, std::string desc_short, std::string desc_long);
|
||||
|
@ -41,6 +41,7 @@ void GlobalSettings::Init() {
|
||||
bInvalid = true;
|
||||
}
|
||||
|
||||
CUserCmd* g_pUserCmd = nullptr;
|
||||
const char* g_pszTFPath = 0;
|
||||
|
||||
GlobalSettings g_Settings;
|
||||
|
@ -38,6 +38,8 @@ public:
|
||||
bool bInvalid;
|
||||
};
|
||||
|
||||
class CUserCmd;
|
||||
extern CUserCmd* g_pUserCmd;
|
||||
extern const char* g_pszTFPath;
|
||||
|
||||
extern GlobalSettings g_Settings;
|
||||
|
@ -66,13 +66,11 @@ void hack::InitHacks() {
|
||||
ADD_HACK(ESP);
|
||||
ADD_HACK(Triggerbot);
|
||||
if (TF) ADD_HACK(AutoSticky);
|
||||
ADD_HACK(Airstuck);
|
||||
if (TF) ADD_HACK(AutoHeal);
|
||||
if (TF) ADD_HACK(SpyAlert);
|
||||
if (TF2) ADD_HACK(Glow);
|
||||
ADD_HACK(KillSay);
|
||||
ADD_HACK(Spam);
|
||||
if (TF) ADD_HACK(AchievementHack);
|
||||
if (TF2) ADD_HACK(Noisemaker);
|
||||
}
|
||||
|
||||
@ -205,12 +203,10 @@ void hack::Shutdown() {
|
||||
DELETE_HACK(ESP);
|
||||
DELETE_HACK(Triggerbot);
|
||||
if (TF) DELETE_HACK(AutoSticky);
|
||||
DELETE_HACK(Airstuck);
|
||||
if (TF) DELETE_HACK(AutoHeal);
|
||||
DELETE_HACK(SpyAlert);
|
||||
if (TF) DELETE_HACK(Glow);
|
||||
DELETE_HACK(KillSay);
|
||||
if (TF) DELETE_HACK(AchievementHack);
|
||||
if (TF2) DELETE_HACK(Noisemaker);
|
||||
DELETE_HACK(Spam);
|
||||
}
|
||||
|
@ -9,26 +9,16 @@
|
||||
#include "../common.h"
|
||||
#include "../sdk.h"
|
||||
|
||||
DEFINE_HACK_SINGLETON(AchievementHack);
|
||||
namespace hacks { namespace tf2 { namespace achievement {
|
||||
|
||||
AchievementHack::AchievementHack() {
|
||||
c_Unlock = CreateConCommand(CON_PREFIX "achievement_unlock", &CC_Achievement_Unlock, "Unlocks all achievements.");
|
||||
c_Lock = CreateConCommand(CON_PREFIX "achievement_lock", &CC_Achievement_Lock, "Locks all achievements.");
|
||||
}
|
||||
CatVar safety(CV_SWITCH, "achievement_safety", "1", "Achievement commands safety switch");
|
||||
|
||||
void CC_Achievement_Unlock(const CCommand& args) {
|
||||
g_phAchievementHack->UnlockAll();
|
||||
}
|
||||
|
||||
void AchievementHack::UnlockAll() {
|
||||
for (int i = 0; i < interfaces::achievements->GetAchievementCount(); i++) {
|
||||
interfaces::achievements->AwardAchievement(interfaces::achievements->GetAchievementByIndex(i)->GetAchievementID());
|
||||
void Lock() {
|
||||
if (safety) {
|
||||
ConColorMsg({ 255, 0, 0, 255}, "Switch " CON_PREFIX "achievement_safety to 0 before using any achievement commands!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void AchievementHack::LockAll() {
|
||||
interfaces::stats->RequestCurrentStats();
|
||||
//interfaces::stats->ResetAllStats(true);
|
||||
for (int i = 0; i < interfaces::achievements->GetAchievementCount(); i++) {
|
||||
interfaces::stats->ClearAchievement(interfaces::achievements->GetAchievementByIndex(i)->GetName());
|
||||
}
|
||||
@ -36,6 +26,17 @@ void AchievementHack::LockAll() {
|
||||
interfaces::stats->RequestCurrentStats();
|
||||
}
|
||||
|
||||
void CC_Achievement_Lock(const CCommand& args) {
|
||||
g_phAchievementHack->LockAll();
|
||||
void Unlock() {
|
||||
if (safety) {
|
||||
ConColorMsg({ 255, 0, 0, 255}, "Switch " CON_PREFIX "achievement_safety to 0 before using any achievement commands!\n");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < interfaces::achievements->GetAchievementCount(); i++) {
|
||||
interfaces::achievements->AwardAchievement(interfaces::achievements->GetAchievementByIndex(i)->GetAchievementID());
|
||||
}
|
||||
}
|
||||
|
||||
CatCommand lock("achievement_lock", "Lock all achievements", Lock);
|
||||
CatCommand unlock("achievement_unlock", "Unlock all achievements", Unlock);
|
||||
|
||||
}}}
|
||||
|
@ -10,20 +10,11 @@
|
||||
|
||||
#include "IHack.h"
|
||||
|
||||
class AchievementHack : public IHack {
|
||||
public:
|
||||
AchievementHack();
|
||||
namespace hacks { namespace tf2 { namespace achievement {
|
||||
|
||||
void UnlockAll();
|
||||
void LockAll();
|
||||
void Lock();
|
||||
void Unlock();
|
||||
|
||||
ConCommand* c_Unlock;
|
||||
ConCommand* c_Lock;
|
||||
};
|
||||
|
||||
void CC_Achievement_Unlock(const CCommand& args);
|
||||
void CC_Achievement_Lock(const CCommand& args);
|
||||
|
||||
DECLARE_HACK_SINGLETON(AchievementHack);
|
||||
}}}
|
||||
|
||||
#endif /* HACKS_ACHIEVEMENT_H_ */
|
||||
|
@ -12,32 +12,33 @@
|
||||
|
||||
#include "../netmessage.h"
|
||||
|
||||
DEFINE_HACK_SINGLETON(Airstuck);
|
||||
namespace hacks { namespace shared { namespace airstuck {
|
||||
|
||||
Airstuck::Airstuck() {
|
||||
v_bStuck = CreateConVar(CON_PREFIX "airstuck", "0", "Airstuck (BindToggle that to a key!)");
|
||||
CatVar stuck(CV_SWITCH, "airstuck", "0", "Airstuck active");
|
||||
|
||||
void SendNOP() {
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
NET_NOP packet;
|
||||
packet.SetNetChannel(ch);
|
||||
packet.SetReliable(false);
|
||||
ch->SendNetMsg(packet);
|
||||
}
|
||||
|
||||
void Airstuck::ProcessUserCmd(CUserCmd* cmd) {
|
||||
if (v_bStuck->GetBool()) {
|
||||
if (cmd->buttons & (IN_ATTACK | IN_ATTACK2)) {
|
||||
return;
|
||||
}
|
||||
void CreateMove() {
|
||||
if (stuck) {
|
||||
if (interfaces::gvars->tickcount % 60 == 0) {
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
NET_NOP packet;
|
||||
packet.SetNetChannel(ch);
|
||||
packet.SetReliable(false);
|
||||
ch->SendNetMsg(packet);
|
||||
SendNOP();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Airstuck::OnLevelInit() {
|
||||
v_bStuck->SetValue(false);
|
||||
bool IsStuck() {
|
||||
if (g_pUserCmd->buttons & (IN_ATTACK | IN_ATTACK2)) return false;
|
||||
return stuck;
|
||||
}
|
||||
|
||||
void Airstuck::OnLevelShutdown() {
|
||||
v_bStuck->SetValue(false);
|
||||
void Reset() {
|
||||
stuck = false;
|
||||
}
|
||||
|
||||
}}}
|
||||
|
@ -10,17 +10,15 @@
|
||||
|
||||
#include "IHack.h"
|
||||
|
||||
class Airstuck : public IHack {
|
||||
public:
|
||||
Airstuck();
|
||||
namespace hacks { namespace shared { namespace airstuck {
|
||||
|
||||
virtual void ProcessUserCmd(CUserCmd*) override;
|
||||
virtual void OnLevelInit() override;
|
||||
virtual void OnLevelShutdown() override;
|
||||
extern CatVar stuck;
|
||||
|
||||
ConVar* v_bStuck;
|
||||
};
|
||||
void SendNOP();
|
||||
void CreateMove();
|
||||
bool IsStuck();
|
||||
void Reset();
|
||||
|
||||
DECLARE_HACK_SINGLETON(Airstuck);
|
||||
}}}
|
||||
|
||||
#endif /* HACKS_AIRSTUCK_H_ */
|
||||
|
@ -35,6 +35,7 @@ void BeginConVars() {
|
||||
|
||||
void EndConVars() {
|
||||
RegisterCatVars();
|
||||
RegisterCatCommands();
|
||||
if (hConVarsFile) {
|
||||
fprintf(hConVarsFile, "\nexec cat_autoexec\n");
|
||||
fprintf(hConVarsFile, "cat_killsay_reload\ncat_spam_reload\n");
|
||||
@ -89,7 +90,7 @@ ConVar* CreateConVar(std::string name, std::string value, std::string help) {
|
||||
//logging::Info("Creating ConVar: %s %s %s", namec, valuec, helpc);
|
||||
ConVar* ret = new ConVar((const char*)namec, (const char*)valuec, 0, (const char*)helpc);
|
||||
if (hConVarsFile)
|
||||
fprintf(hConVarsFile, "%s %s\n", name.c_str(), value.c_str());
|
||||
fprintf(hConVarsFile, "%s \"%s\"\n", name.c_str(), value.c_str());
|
||||
interfaces::cvar->RegisterConCommand(ret);
|
||||
g_ConVars.push_back(ret);
|
||||
return ret;
|
||||
|
@ -35,6 +35,8 @@ float AngleDiff( float destAngle, float srcAngle )
|
||||
bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SEGV_BEGIN;
|
||||
|
||||
g_pUserCmd = cmd;
|
||||
|
||||
if (TF2C && g_phMisc->v_bMinigunJump->GetBool() && CE_GOOD(LOCAL_W)) {
|
||||
//RemoveCondition(LOCAL_E, TFCond_Slowed);
|
||||
CE_INT(LOCAL_W, netvar.iWeaponState) = 0;
|
||||
@ -100,7 +102,6 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SAFE_CALL(HACK_PROCESS_USERCMD(Bunnyhop, cmd));
|
||||
SAFE_CALL(HACK_PROCESS_USERCMD(AutoStrafe, cmd));
|
||||
SAFE_CALL(HACK_PROCESS_USERCMD(Aimbot, cmd));
|
||||
SAFE_CALL(HACK_PROCESS_USERCMD(Airstuck, cmd));
|
||||
SAFE_CALL(hacks::shared::antiaim::ProcessUserCmd(cmd));
|
||||
if (TF) SAFE_CALL(HACK_PROCESS_USERCMD(AutoSticky, cmd));
|
||||
if (TF) SAFE_CALL(HACK_PROCESS_USERCMD(AutoReflect, cmd));
|
||||
|
@ -31,7 +31,7 @@ bool SendNetMsg_hook(void* thisptr, INetMessage& msg, bool bForceReliable = fals
|
||||
SEGV_BEGIN;
|
||||
|
||||
//logging::Info("Sending NetMsg! %i", msg.GetType());
|
||||
if (g_phAirstuck->v_bStuck->GetBool() && g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) {
|
||||
if (hacks::shared::airstuck::IsStuck() && g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) {
|
||||
switch (msg.GetType()) {
|
||||
case net_NOP:
|
||||
case net_SignonState:
|
||||
@ -133,7 +133,7 @@ void LevelInit_hook(void* thisptr, const char* newmap) {
|
||||
((LevelInit_t*) hooks::hkClientMode->GetMethod(hooks::offLevelInit))(thisptr, newmap);
|
||||
interfaces::engineClient->ExecuteClientCmd("exec cat_matchexec");
|
||||
LEVEL_INIT(Aimbot);
|
||||
LEVEL_INIT(Airstuck);
|
||||
hacks::shared::airstuck::Reset();
|
||||
if (TF) LEVEL_INIT(AntiDisguise);
|
||||
if (TF) LEVEL_INIT(AutoHeal);
|
||||
if (TF) LEVEL_INIT(AutoReflect);
|
||||
@ -155,7 +155,7 @@ void LevelShutdown_hook(void* thisptr) {
|
||||
((LevelShutdown_t*) hooks::hkClientMode->GetMethod(hooks::offLevelShutdown))(thisptr);
|
||||
g_Settings.bInvalid = true;
|
||||
LEVEL_SHUTDOWN(Aimbot);
|
||||
LEVEL_SHUTDOWN(Airstuck);
|
||||
hacks::shared::airstuck::Reset();
|
||||
if (TF) LEVEL_SHUTDOWN(AntiDisguise);
|
||||
if (TF) LEVEL_SHUTDOWN(AutoHeal);
|
||||
if (TF) LEVEL_SHUTDOWN(AutoReflect);
|
||||
|
Reference in New Issue
Block a user