Merge pull request #632 from nullworks/master

Update Experimental
This commit is contained in:
LightCat 2018-11-11 13:10:09 +01:00 committed by GitHub
commit 4eb43f2127
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 1471 additions and 899 deletions

View File

@ -30,7 +30,7 @@ set(DataPath "/opt/cathook/data" CACHE FILEPATH "Data location")
set(VACBypass 0 CACHE BOOL "Textmode VAC bypass")
set(Textmode 0 CACHE BOOL "Various textmode-only features for bots")
set(EnableTextmodeStdin 0 CACHE BOOL "Textmode Stdin -> Console bridge (EXPERIMENTAL)")
set(EnableWarnings 1 CACHE BOOL "Enable compile warnings")
set(EnableWarnings 0 CACHE BOOL "Enable compile warnings")
set(EnableNullGraphics 0 CACHE BOOL "Enable experimental textmode hooks (CRASHES)")
set(EnableOnlineFeatures 0 CACHE BOOL "Enable online features (WIP)")
@ -87,7 +87,7 @@ configure_file(include/version.h.in ${CMAKE_SOURCE_DIR}/include/version.h @ONLY)
#set_target_properties(cathook PROPERTIES COMPILE_FLAGS "-m32 -msse -msse2 -msse3 -fexceptions" LINK_FLAGS "-m32 -fno-gnu-unique -fexceptions -DNDEBUG")
set(CMAKE_CXX_FLAGS "-m32 -msse -msse2 -msse3 -fexceptions -fno-gnu-unique -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -ggdb -rdynamic")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -rdynamic -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

View File

@ -32,7 +32,7 @@ and a lot of useful features, including
* Follow Bots
* Working crit hack (does not work right now (works right now))
[FULL LIST OF FEATURES HERE](https://github.com/nullworks/cathook/wiki/List-of-features) (list might be outdated)
[FULL LIST OF FEATURES HERE](https://github.com/nullworks/cathook/wiki/Feature-List-and-explanations) (list might be outdated)
# INSTALLATION

2
attach
View File

@ -58,3 +58,5 @@ rm $FILENAME
sudo killall -18 steamwebhelper
sudo killall -18 steam
sudo ./scripts/auto-updater &

67
attach-gdb Executable file
View File

@ -0,0 +1,67 @@
#!/usr/bin/env bash
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo TF2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
fi
proc=${arr[$inst]}
echo Running instances: "${arr[@]}"
echo Attaching to "$proc"
#sudo ./detach $inst bin/libcathook.so
#if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then
# echo already loaded
# exit
#fi
# pBypass for crash dumps being sent
# You may also want to consider using -nobreakpad in your launch options.
sudo rm -rf /tmp/dumps # Remove if it exists
sudo mkdir /tmp/dumps # Make it as root
sudo chmod 000 /tmp/dumps # No permissions
FILENAME="/tmp/.gl$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)"
cp "bin/libcathook.so" "$FILENAME"
echo loading "$FILENAME" to "$proc"
sudo killall -19 steam
sudo killall -19 steamwebhelper
gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$FILENAME\", 1)" \
-ex "call dlerror()" \
-ex 'print (char *) $2' \
-ex "catch syscall exit exit_group" \
-ex "detach" \
-ex "quit"
sudo killall -18 steamwebhelper
sudo killall -18 steam
sudo ./scripts/auto-updater &
gdb -n -q -batch \
-ex "attach $proc" \
-ex "continue" \
-ex "backtrace"
rm $FILENAME

View File

@ -61,3 +61,5 @@ sudo gdb -n -q -batch \
-ex "quit"
sudo rm "/lib/i386-linux-gnu/${FILENAME}"
sudo ./scripts/auto-updater &

11
data/dominatesay.txt Normal file
View File

@ -0,0 +1,11 @@
replace this file with actual dominatesay.
usable macros:
%team% %class% %killer% %name% %myteam% %myclass% %dominum% \n
examples:
%name% is getting dominated. no big surprise.
%team% actually sucks i already have %dominum% dominations wtf?
%name%, quit playing %class% dude. i'm already dominating you.
lmao adding %name% to my list of idiots
%dominum% dominations lol

View File

@ -64,13 +64,11 @@
<List width="170">
<AutoVariable width="fill" target="misc.pathing" label="Enable Pathing"/>
<AutoVariable width="fill" target="misc.pathing.draw" label="Draw Path"/>
<AutoVariable width="fill" target="navbot.enable" label="Master Switch"/>
<AutoVariable width="fill" target="navbot.sniper-mode" label="Enable Sniper Mode"/>
<AutoVariable width="fill" target="navbot.enable" label="Enable Navbot"/>
<AutoVariable width="fill" target="navbot.scout-mode" label="Enable Scout Mode"/>
<AutoVariable width="fill" target="navbot.spy-mode" label="Enable Spy Mode"/>
<AutoVariable width="fill" target="navbot.heavy-mode" label="Enable Heavy Mode"/>
<AutoVariable width="fill" target="navbot.engi-mode" label="Enable Engie Mode"/>
<AutoVariable width="fill" target="navbot.best-slot" label="Best Weapon only"/>
<AutoVariable width="fill" target="navbot.primary-only" label="Best Weapon only"/>
<AutoVariable width="fill" target="navbot.jump-distance" label="Jump Distance"/>
<AutoVariable width="fill" target="navbot.target-sentry" label="Try to target sentries"/>
<AutoVariable width="fill" target="navbot.stay-near" label="Zone enemies (stay near)"/>

2
external/libglez vendored

@ -1 +1 @@
Subproject commit 9457ea150e041689c6f38f5720b4d571cf64a943
Subproject commit caca15cd63545b43798fc8872611a2e5f78d4668

View File

@ -11,15 +11,8 @@
class IClientEntity;
// Fix clang gay
#if defined(__clang__)
#define NET_VAR(entity, offset, type) \
(*(reinterpret_cast<type *>(reinterpret_cast<uint64_t>(entity) + (offset))))
#elif defined(__GNUC__) || defined(__GNUG__)
#define NET_VAR(entity, offset, type) \
(*(reinterpret_cast<type *>(reinterpret_cast<uintptr_t>(entity) + \
(offset))))
#endif
#define NET_INT(entity, offset) NET_VAR(entity, offset, int)
@ -73,6 +66,7 @@ public:
offset_t m_flTeleCurrentRechargeDuration;
offset_t m_iTeleTimesUsed;
offset_t m_flTeleYawToExit;
offset_t m_bMatchBuilding;
offset_t iPipeType;
offset_t iBuildingHealth;
offset_t iBuildingMaxHealth;

View File

@ -62,6 +62,7 @@ extern circular_buf sequences;
extern BacktrackData headPositions[32][66];
extern bool isBacktrackEnabled;
extern bool Vischeck_Success;
float getLatency();
int getTicks();
bool ValidTick(BacktrackData &i, CachedEntity *ent);

View File

@ -27,6 +27,7 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/FollowBot.hpp"
"${CMAKE_CURRENT_LIST_DIR}/hacklist.hpp"
"${CMAKE_CURRENT_LIST_DIR}/KillSay.hpp"
"${CMAKE_CURRENT_LIST_DIR}/DominateSay.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Killstreak.hpp"
"${CMAKE_CURRENT_LIST_DIR}/LightESP.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Misc.hpp"

View File

@ -0,0 +1,20 @@
/*
* DominateSay.h
*
* Created on: Oct 30, 2017
*/
#pragma once
#include "common.hpp"
namespace hacks::shared::dominatesay
{
void init();
void shutdown();
void reload();
extern const std::vector<std::string> builtin_default;
extern const std::vector<std::string> jp_anime;
} // namespace hacks::shared::dominatesay

View File

@ -1,26 +1,13 @@
//
// Created by bencat07 on 17.08.18.
//
#pragma once
#include "common.hpp"
namespace hacks::shared::NavBot
#include "config.h"
namespace hacks::tf2::NavBot
{
// Main Functions
void Init(bool from_LevelInit);
// Helper
bool CanPath();
bool HasLowHealth();
bool HasLowAmmo();
CachedEntity *nearestHealth();
CachedEntity *nearestAmmo();
CachedEntity *nearestEnemy();
CachedEntity *nearestTeleporter();
Vector GetClosestValidByDist(CachedEntity *ent, float mindist, float maxdist, bool near);
void UpdateSlot();
void Jump();
// Path
bool NavToSniperSpot(int priority);
bool NavToNearestEnemy();
bool NavToBacktrackTick(int priority);
} // namespace hacks::shared::NavBot
void Init();
void initonce();
extern Vector Best_Spot;
} // namespace hacks::tf2::NavBot

View File

@ -46,6 +46,7 @@
#include "Misc.hpp"
#include "Trigger.hpp"
#include "KillSay.hpp"
#include "DominateSay.hpp"
#include "UberSpam.hpp"
#include "Achievement.hpp"
#endif

View File

@ -71,6 +71,7 @@ weaponmode GetWeaponMode();
void FixMovement(CUserCmd &cmd, Vector &viewangles);
void VectorAngles(Vector &forward, Vector &angles);
void AngleVectors2(const QAngle &angles, Vector *forward);
extern std::mutex trace_lock;
bool IsEntityVisible(CachedEntity *entity, int hb);
bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos);
@ -124,6 +125,14 @@ void WhatIAmLookingAt(int *result_eindex, Vector *result_pos);
void Patch(void *address, void *patch, size_t length);
inline Vector GetAimAtAngles(Vector origin, Vector target)
{
Vector angles, tr;
tr = (target - origin);
VectorAngles(tr, angles);
fClampAngle(angles);
return angles;
}
void AimAt(Vector origin, Vector target, CUserCmd *cmd);
void AimAtHitbox(CachedEntity *ent, int hitbox, CUserCmd *cmd);
bool IsProjectileCrit(CachedEntity *ent);

View File

@ -27,7 +27,9 @@ public:
init = false;
}
inline virtual void SetParameters(KeyValues *params){}
inline virtual void SetParameters(KeyValues *params)
{
}
virtual void Render(int x, int y, int w, int h);

View File

@ -17,7 +17,8 @@ class EffectGlow : public IScreenSpaceEffect
{
public:
virtual void Init();
inline virtual void Shutdown(){
inline virtual void Shutdown()
{
mat_unlit.Shutdown();
mat_unlit_z.Shutdown();
mat_blit.Shutdown();
@ -27,7 +28,9 @@ public:
mat_blur_y.Shutdown();
}
inline virtual void SetParameters(KeyValues *params){}
inline virtual void SetParameters(KeyValues *params)
{
}
virtual void Render(int x, int y, int w, int h);

29
scripts/auto-updater Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
LOCKFILE=/tmp/chupdater.lock
if [ -e ${LOCKFILE} ] && ps -p `cat ${LOCKFILE}` >/dev/null; then
echo -e "\033[1;31m \n \nAuto Updater: Auto Updater already running in the background\n\033[0m"
exit 1
fi
# make sure the lockfile is removed when we exit and then claim it
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}
echo -e "\033[1;34m \n \nAuto Updater: Updating cathook in the background\n\033[0m"
sudo -u $LOGNAME bash -c 'git fetch && git pull origin >/dev/null && git submodule update --init --recursive >/dev/null' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to pull from github!\n\033[0m"; exit 1; }
pushd build >/dev/null || exit 1
if [ $(id -u) -eq 0 ]; then
cmake --build . --target data >/dev/null || { echo -e "\033[1;31m \n \nAuto Updater:Failed to update /opt/cathook/data directory\n\033[0m"; exit 1; }
fi
sudo -u $LOGNAME bash -c 'cmake .. >/dev/null && nice -n 10 cmake --build . --target cathook -- -j 1 >/dev/null' || { echo -e "\033[1;31m \n \nAuto Updater: Failed to compile cathook\n\033[0m"; exit 1; }
rm -f ${LOCKFILE}
popd >/dev/null
echo -e "\n\n\033[1;34mAuto Updater: Cathook updated successfully\033[0m" && exit 0

View File

@ -138,6 +138,9 @@ void NetVars::Init()
gNetvars.get_offset("DT_ObjectTeleporter", "m_iTimesUsed");
this->m_flTeleYawToExit =
gNetvars.get_offset("DT_ObjectTeleporter", "m_flYawToExit");
this->m_bMatchBuilding =
gNetvars.get_offset("DT_ObjectTeleporter", "m_bMatchBuilding");
;
this->iPipeType =
gNetvars.get_offset("DT_TFProjectile_Pipebomb", "m_iType");
this->iBuildingHealth =

View File

@ -5,22 +5,14 @@
* Author: nullifiedcat
*/
// The code below was obtained from:
// http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes/1925461#1925461
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef __USE_GNU
#define __USE_GNU
#endif
#include <execinfo.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ucontext.h>
#include <unistd.h>
#include <dlfcn.h>
#include <boost/stacktrace.hpp>
#include <cxxabi.h>
#include <visual/SDLHooks.hpp>
#include "hack.hpp"
#include "common.hpp"
@ -33,6 +25,7 @@
#include "copypasted/CDumper.hpp"
#include "version.h"
#include <cxxabi.h>
/*
* Credits to josh33901 aka F1ssi0N for butifel F1Public and Darkstorm 2015
@ -105,85 +98,56 @@ void hack::ExecuteCommand(const std::string command)
hack::command_stack().push(command);
}
/* This structure mirrors the one found in /usr/include/asm/ucontext.h */
typedef struct _sig_ucontext
void my_signal_handler(int signum)
{
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask;
} sig_ucontext_t;
namespace st = boost::stacktrace;
::signal(signum, SIG_DFL);
passwd *pwd = getpwuid(getuid());
std::ofstream out(
strfmt("/tmp/cathook-%s-%d-segfault.log", pwd->pw_name, getpid())
.get());
void crit_err_hdlr(int sig_num, siginfo_t *info, void *ucontext)
{
void *array[50];
void *caller_address;
char **messages;
int size, i;
sig_ucontext_t *uc;
Dl_info info;
if (!dladdr(reinterpret_cast<void *>(SetCanshootStatus), &info))
return;
unsigned int baseaddr = (unsigned int) info.dli_fbase;
uc = (sig_ucontext_t *) ucontext;
/* Get the address at the time the signal was raised */
#if defined(__i386__) // gcc specific
caller_address = (void *) uc->uc_mcontext.eip; // EIP: x86 specific
#elif defined(__x86_64__) // gcc specific
caller_address = (void *) uc->uc_mcontext.rip; // RIP: x86_64 specific
#else
#error Unsupported architecture. // TODO: Add support for other arch.
#endif
fprintf(stderr, "\n");
FILE *backtraceFile;
// In this example we write the stacktrace to a file. However, we can also
// just fprintf to stderr (or do both).
passwd *pwd = getpwuid(getuid());
backtraceFile = fopen(
strfmt("/tmp/cathook-%s-%d-segfault.log", pwd->pw_name, getpid()).get(),
"w");
if (sig_num == SIGSEGV)
fprintf(backtraceFile, "signal %d (%s), address is %p from %p\n",
sig_num, strsignal(sig_num), info->si_addr,
(void *) caller_address);
else
fprintf(backtraceFile, "signal %d (%s)\n", sig_num, strsignal(sig_num));
size = backtrace(array, 50);
/* overwrite sigaction with caller's address */
array[1] = caller_address;
messages = backtrace_symbols(array, size);
/* skip first stack frame (points here) */
for (i = 1; i < size && messages != NULL; ++i)
for (auto i : st::stacktrace())
{
fprintf(backtraceFile, "[bt]: (%d) %s\n", i, messages[i]);
unsigned int offset = (unsigned int) (i.address()) - baseaddr;
Dl_info info2;
out << (void *)offset;
if (!dladdr(i.address(), &info2))
{
out << std::endl;
continue;
}
out << " " << info2.dli_fname << ": ";
if (info2.dli_sname)
{
int status = -4;
char *realname =
abi::__cxa_demangle(info2.dli_sname, 0, 0, &status);
if (status == 0)
{
out << realname << std::endl;
free(realname);
}
else
out << info2.dli_sname << std::endl;
}
else
out << "Not found!" << std ::endl;
}
fclose(backtraceFile);
free(messages);
std::abort();
exit(EXIT_FAILURE);
out.close();
::raise(SIGABRT);
}
void installSignal(int __sig)
{
struct sigaction sigact;
sigact.sa_sigaction = crit_err_hdlr;
sigact.sa_flags = SA_RESTART | SA_SIGINFO;
if (sigaction(__sig, &sigact, (struct sigaction *) NULL) != 0)
{
fprintf(stderr, "error setting signal handler for %d (%s)\n", __sig,
strsignal(__sig));
exit(EXIT_FAILURE);
}
}
void hack::Initialize()
{
signal(SIGPIPE, SIG_IGN);
installSignal(SIGSEGV);
::signal(SIGSEGV, &my_signal_handler);
//::signal(SIGABRT, &my_signal_handler);
time_injected = time(nullptr);
/*passwd *pwd = getpwuid(getuid());
char *logname = strfmt("/tmp/cathook-game-stdout-%s-%u.log", pwd->pw_name,
@ -339,6 +303,7 @@ free(logname);*/
#if not LAGBOT_MODE
// FIXME [MP]
hacks::shared::killsay::init();
hacks::shared::dominatesay::init();
hacks::shared::announcer::init();
hacks::tf2::killstreak::init();
#endif
@ -431,6 +396,7 @@ void hack::Shutdown()
#if not LAGBOT_MODE
logging::Info("Shutting down killsay...");
hacks::shared::killsay::shutdown();
hacks::shared::dominatesay::shutdown();
hacks::shared::announcer::shutdown();
#endif
logging::Info("Success..");

View File

@ -1,4 +1,4 @@
/*
/*
* HAimbot.cpp
*
* Created on: Oct 9, 2016
@ -83,7 +83,7 @@ bool shouldBacktrack()
bool IsBacktracking()
{
return !(!aimkey || !aimkey.isKeyDown()) && shouldBacktrack();
return (aimkey ? aimkey.isKeyDown() : true) && shouldBacktrack();
}
// Current Entity
@ -118,7 +118,9 @@ void CreateMove()
current_user_cmd->buttons |= IN_ATTACK2;
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFMinigun))
if (auto_spin_up && CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) != 0 && !zoomTime.check(1000))
if (auto_spin_up &&
CE_INT(g_pLocalPlayer->weapon(), netvar.m_iAmmo + 4) != 0 &&
!zoomTime.check(1000))
current_user_cmd->buttons |= IN_ATTACK2;
// We do this as we need to pass whether the aimkey allows aiming to both
@ -406,7 +408,7 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
break;
case 4: // Distance Priority (Furthest Away)
scr = calculated_data_array[i].aim_position.DistTo(
g_pLocalPlayer->v_Eye);
g_pLocalPlayer->v_Eye);
break;
case 6: // Health Priority (Highest)
scr = ent->m_iHealth() * 4;
@ -428,7 +430,9 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
else if (hacks::shared::backtrack::iBestTarget != -1)
{
target_highest_ent = ENTITY(hacks::shared::backtrack::iBestTarget);
foundTarget = true;
if (!IsTargetStateGood(target_highest_ent))
target_highest_ent = nullptr;
foundTarget = true;
}
// Save the ent for future use with target lock
@ -813,7 +817,7 @@ void DoAutoshoot()
begancharge)
{
current_user_cmd->buttons &= ~IN_ATTACK;
hacks::shared::antiaim::SetSafeSpace(3);
hacks::shared::antiaim::SetSafeSpace(5);
begancharge = false;
// Pull string if charge isnt enough
}
@ -836,7 +840,7 @@ void DoAutoshoot()
if ((chargetime >= 3.85f * *sticky_autoshoot) && begansticky > 3)
{
current_user_cmd->buttons &= ~IN_ATTACK;
hacks::shared::antiaim::SetSafeSpace(3);
hacks::shared::antiaim::SetSafeSpace(5);
begansticky = 0;
}
// Else just keep charging
@ -1149,20 +1153,17 @@ bool VischeckPredictedEntity(CachedEntity *entity)
// Retrieve predicted data
AimbotCalculatedData_s &cd = calculated_data_array[entity->m_IDX];
if (cd.vcheck_tick == tickcount)
return cd.visible;
{
if (!shouldBacktrack() || projectile_mode)
return cd.visible;
}
// Update info
cd.vcheck_tick = tickcount;
if (!shouldBacktrack() || projectile_mode)
cd.visible = IsEntityVectorVisible(entity, PredictEntity(entity));
else
cd.visible = IsVectorVisible(
g_pLocalPlayer->v_Eye,
hacks::shared::backtrack::headPositions
[entity->m_IDX][hacks::shared::backtrack::BestTick]
.hitboxes[cd.hitbox]
.center,
true);
cd.visible = hacks::shared::backtrack::Vischeck_Success;
return cd.visible;
}
@ -1277,7 +1278,7 @@ float EffectiveTargetingRange()
if (GetWeaponMode() == weapon_melee)
return (float) re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFFlameThrower))
return 185.0f; // Pyros only have so much untill their flames hit
return 310.0f; // Pyros only have so much until their flames hit
return (float) max_range;
}

View File

@ -66,19 +66,36 @@ CachedEntity *ClosestSpy()
continue;
if (CE_BYTE(ent, netvar.iLifeState))
continue;
bool ispyro = false;
bool isheavy = false;
if (CE_INT(ent, netvar.iClass) != tf_class::tf_spy)
continue;
{
if (CE_INT(ent, netvar.iClass) != tf_class::tf_pyro && CE_INT(ent, netvar.iClass) != tf_class::tf_heavy)
continue;
int idx = CE_INT(ent, netvar.hActiveWeapon) & 0xFFF;
if (IDX_BAD(idx))
continue;
CachedEntity *pyro_weapon = ENTITY(idx);
int widx = CE_INT(pyro_weapon, netvar.iItemDefinitionIndex);
if (widx != 40 && widx != 1146 && widx != 656)
continue;
if (widx == 656)
isheavy = true;
ispyro = true;
}
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team)
continue;
if (IsPlayerInvisible(ent))
continue;
dist = ent->m_flDistance();
if (fabs(GetAngle(ent)) > (float) angle)
if (fabs(GetAngle(ent)) > (float) angle || (ispyro && !isheavy && fabs(GetAngle(ent)) > 90.0f) || (isheavy && fabs(GetAngle(ent)) > 132.0f))
{
break;
// logging::Info("Backstab???");
}
if (dist < (float) distance && (dist < closest_dist || !closest_dist))
if ((((!ispyro && dist < (float) distance)) ||
(ispyro && !isheavy && dist < 314.0f) || (isheavy && dist < 120.0f)) &&
(dist < closest_dist || !closest_dist))
{
closest_dist = dist;
closest = ent;
@ -97,8 +114,14 @@ void CreateMove()
spy = ClosestSpy();
if (spy)
{
noaa = true;
current_user_cmd->viewangles.x = 160.0f;
noaa = true;
if (current_user_cmd->buttons & IN_ATTACK)
return;
const Vector &A = LOCAL_E->m_vecOrigin();
const Vector &B = spy->m_vecOrigin();
diff = (A - B);
if (diff.y < 0 || CE_INT(spy, netvar.iClass) == tf_class::tf_heavy)
current_user_cmd->viewangles.x = 180.0f;
if (silent)
g_pLocalPlayer->bUseSilentAngles = true;
if (sayno)

View File

@ -19,17 +19,6 @@ namespace backtrack = hacks::shared::backtrack;
static settings::Bool enable{ "autobackstab.enable", "0" };
static settings::Bool silent{ "autobackstab.silent", "1" };
void testingFunc();
void AngleVectors2(const QAngle &angles, Vector *forward)
{
float sp, sy, cp, cy;
SinCos(DEG2RAD(angles[YAW]), &sy, &cy);
SinCos(DEG2RAD(angles[PITCH]), &sp, &cp);
forward->x = cp * cy;
forward->y = cp * sy;
forward->z = -sp;
}
// Not required anymore, keeping for future reference
Vector rotateVector(Vector center, float radianAngle, Vector p)
@ -233,7 +222,6 @@ void CreateMove()
current_user_cmd->buttons |= IN_ATTACK;
if (silent)
g_pLocalPlayer->bUseSilentAngles = true;
logging::Info("Success on tick %i", j);
return;
}
}

View File

@ -28,7 +28,7 @@ bool IsProjectile(CachedEntity *ent)
int NearbyEntities()
{
int ret = 0;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return ret;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{
@ -48,7 +48,7 @@ void CreateMove()
{
if (!enable)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (g_pLocalPlayer->clazz != tf_spy)
return;

View File

@ -232,7 +232,7 @@ bool IsProjectile(CachedEntity *ent)
int NearbyEntities()
{
int ret = 0;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return ret;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{

View File

@ -32,6 +32,7 @@ BacktrackData headPositions[32][66]{};
int highesttick[32]{};
int lastincomingsequencenumber = 0;
bool isBacktrackEnabled = false;
bool Vischeck_Success = false;
circular_buf sequences{ 2048 };
void UpdateIncomingSequences()
@ -88,7 +89,7 @@ void Run()
}
isBacktrackEnabled = true;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (g_Settings.bInvalid)
return;
@ -307,8 +308,10 @@ void EmptyBacktrackData(BacktrackData &i)
// This func is internal only
std::pair<int, int> getBestEntBestTick()
{
int bestEnt = -1;
int bestTick = -1;
int bestEnt = -1;
int bestTick = -1;
bool vischeck_priority = false;
Vischeck_Success = false;
if (GetWeaponMode() == weapon_melee)
{
float bestDist = 9999.0f;
@ -328,11 +331,25 @@ std::pair<int, int> getBestEntBestTick()
headPositions[i][j]
.hitboxes.at(spine_3)
.center.DistTo(g_pLocalPlayer->v_Eye);
if (dist < bestDist && dist > *mindistance)
if (dist > bestDist && vischeck_priority)
continue;
bool Vischeck_suceeded = IsVectorVisible(
g_pLocalPlayer->v_Eye,
headPositions[i][j].hitboxes.at(0).center,
true);
if (((dist < bestDist) ||
(Vischeck_suceeded && !vischeck_priority)) &&
dist > *mindistance &&
(vischeck_priority ? Vischeck_suceeded : true))
{
bestEnt = i;
bestTick = j;
bestDist = dist;
if (Vischeck_suceeded)
{
Vischeck_Success = true;
vischeck_priority = true;
}
}
}
}
@ -358,6 +375,7 @@ std::pair<int, int> getBestEntBestTick()
g_pLocalPlayer->v_OrigViewangles,
g_pLocalPlayer->v_Eye,
headPositions[i][j].hitboxes.at(head).center);
Vischeck_Success = true;
if (bestFov > FOVDistance)
{
bestFov = FOVDistance;

View File

@ -26,6 +26,7 @@ if(NOT LagbotMode)
"${CMAKE_CURRENT_LIST_DIR}/Backtrack.cpp"
"${CMAKE_CURRENT_LIST_DIR}/FollowBot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/KillSay.cpp"
"${CMAKE_CURRENT_LIST_DIR}/DominateSay.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Killstreak.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LightESP.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Misc.cpp"

View File

@ -301,7 +301,7 @@ static HookedFunction cm(HF_CreateMove, "catbot", 5, []() {
if (g_Settings.bInvalid)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (*auto_crouch)

141
src/hacks/DominateSay.cpp Normal file
View File

@ -0,0 +1,141 @@
/*
* DominateSay.cpp
*
* Created on: October 30, 2018
*/
#include <hacks/DominateSay.hpp>
#include <settings/Int.hpp>
#include "common.hpp"
static settings::Int dominatesay_mode{ "dominatesay.mode", "0" };
static settings::String filename{ "dominatesay.file", "dominatesay.txt" };
static CatCommand reload_command("dominatesay_reload", "Reload dominatesays",
[]() {
hacks::shared::dominatesay::reload();
});
namespace hacks::shared::dominatesay
{
const std::string tf_classes_dominatesay[] = { "class", "scout", "sniper",
"soldier", "demoman", "medic",
"heavy", "pyro", "spy",
"engineer" };
const std::string tf_teams_dominatesay[] = { "RED", "BLU" };
static std::string lastmsg{};
TextFile file{};
std::string ComposeDominateSay(IGameEvent *event)
{
const std::vector<std::string> *source = nullptr;
switch (*dominatesay_mode)
{
case 1:
source = &file.lines;
break;
case 2:
source = &builtin_default;
break;
case 3:
source = &jp_anime;
break;
default:
break;
}
if (!source || source->empty())
return "";
if (!event)
return "";
int vid = event->GetInt("dominated");
int kid = event->GetInt("dominator");
int dnum = event->GetInt("dominations");
// this is actually impossible but just in case.
if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer())
return "";
std::string msg = source->at(rand() % source->size());
while (msg == lastmsg && source->size() > 1)
msg = source->at(rand() % source->size());
lastmsg = msg;
player_info_s info{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info);
ReplaceString(msg, "%name%", std::string(info.name));
CachedEntity *ent = ENTITY(g_IEngine->GetPlayerForUserID(vid));
int clz = g_pPlayerResource->GetClass(ent);
ReplaceString(msg, "%class%", tf_classes_dominatesay[clz]);
player_info_s infok{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(kid), &infok);
ReplaceString(msg, "%dominum%", std::to_string(dnum));
ReplaceString(msg, "%killer%", std::string(infok.name));
ReplaceString(msg, "%team%", tf_teams_dominatesay[ent->m_iTeam() - 2]);
ReplaceString(msg, "%myteam%",
tf_teams_dominatesay[LOCAL_E->m_iTeam() - 2]);
ReplaceString(msg, "%myclass%",
tf_classes_dominatesay[g_pPlayerResource->GetClass(LOCAL_E)]);
ReplaceString(msg, "\\n", "\n");
return msg;
}
class DominateSayEventListener : public IGameEventListener2
{
void FireGameEvent(IGameEvent *event) override
{
if (!dominatesay_mode)
return;
std::string message =
hacks::shared::dominatesay::ComposeDominateSay(event);
if (!message.empty())
chat_stack::Say(message, false);
}
};
static DominateSayEventListener listener{};
void reload()
{
file.Load(*filename);
}
void init()
{
g_IEventManager2->AddListener(&listener, (const char *) "player_domination",
false);
}
void shutdown()
{
g_IEventManager2->RemoveListener(&listener);
}
// a much better default dominatesay would be appreciated.
const std::vector<std::string> builtin_default = {
"dominating %name%! (%dominum% dominations)",
"%name%, getting tapped?",
"%killer% is dominating the server with %dominum% dominations!",
};
// same goes to this one
const std::vector<std::string> jp_anime = {
"Get d-dominated %name%-senpai >:3",
"g- gomenasai! %name%-san!",
"Wow! hey hey hey H~ ey !!! I found you again~~!",
"%name%-san please don't get mad at me.. ><",
// https://youtu.be/sW3RT0tF020?t=207
"kore kara mo douzo yoroshiku ne.",
"konna watashi dakedo waratte yurushite ne.",
"zutto taisetsu ni shite ne.",
"eikyuu hoshou no watashi dakara.",
};
} // namespace hacks::shared::dominatesay

View File

@ -252,7 +252,7 @@ static HookedFunction
// Check usersettings if enabled
if (!*enable)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
// Something
std::lock_guard<std::mutex> esp_lock(threadsafe_mutex);

View File

@ -208,7 +208,7 @@ static HookedFunction
init();
// We need a local player to control
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
{
follow_target = 0;
return;
@ -231,7 +231,8 @@ static HookedFunction
}
if (CE_GOOD(ENTITY(follow_target)) && navtime.test_and_set(2000))
{
if (nav::navTo(ENTITY(follow_target)->m_vecOrigin(), 5, true, false))
if (nav::navTo(ENTITY(follow_target)->m_vecOrigin(), 5, true,
false))
{
navtimeout.update();
}
@ -264,180 +265,184 @@ static HookedFunction
// Target Selection
{
if (steamid &&
((follow_target &&
ENTITY(follow_target)->player_info.friendsID != steamid) ||
!follow_target))
{
// Find a target with the steam id, as it is prioritized
auto ent_count = g_IEngine->GetMaxClients();
for (int i = 0; i < ent_count; i++)
if (steamid &&
((follow_target &&
ENTITY(follow_target)->player_info.friendsID != steamid) ||
!follow_target))
{
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (i == follow_target)
continue;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (steamid != entity->player_info.friendsID) // steamid check
continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
bool found = false;
if (corneractivate)
// Find a target with the steam id, as it is prioritized
auto ent_count = g_IEngine->GetMaxClients();
for (int i = 0; i < ent_count; i++)
{
Vector indirectOrigin = VischeckCorner(
LOCAL_E, entity, *follow_activation / 2,
true); // get the corner location that the
// future target is visible from
std::pair<Vector, Vector> corners;
if (!indirectOrigin.z &&
entity->m_IDX == lastent) // if we couldn't find it, run
// wallcheck instead
{
corners =
VischeckWall(LOCAL_E, entity,
float(follow_activation) / 2, true);
if (!corners.first.z || !corners.second.z)
continue;
// addCrumbs(LOCAL_E, corners.first);
// addCrumbs(entity, corners.second);
addCrumbPair(LOCAL_E, entity, corners);
found = true;
}
if (indirectOrigin.z)
{
addCrumbs(entity, indirectOrigin);
found = true;
}
}
else
{
if (VisCheckEntFromEnt(LOCAL_E, entity))
found = true;
}
if (isNavBotCM && !found)
{
if (!nav::navTo(entity->m_vecOrigin()))
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
navtimeout.update();
found = true;
if (i == follow_target)
continue;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (steamid !=
entity->player_info.friendsID) // steamid check
continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
bool found = false;
if (corneractivate)
{
Vector indirectOrigin = VischeckCorner(
LOCAL_E, entity, *follow_activation / 2,
true); // get the corner location that the
// future target is visible from
std::pair<Vector, Vector> corners;
if (!indirectOrigin.z &&
entity->m_IDX ==
lastent) // if we couldn't find it, run
// wallcheck instead
{
corners = VischeckWall(LOCAL_E, entity,
float(follow_activation) / 2,
true);
if (!corners.first.z || !corners.second.z)
continue;
// addCrumbs(LOCAL_E, corners.first);
// addCrumbs(entity, corners.second);
addCrumbPair(LOCAL_E, entity, corners);
found = true;
}
if (indirectOrigin.z)
{
addCrumbs(entity, indirectOrigin);
found = true;
}
}
else
{
if (VisCheckEntFromEnt(LOCAL_E, entity))
found = true;
}
if (isNavBotCM && !found)
{
if (!nav::navTo(entity->m_vecOrigin()))
continue;
navtimeout.update();
found = true;
}
if (!found)
continue;
follow_target = entity->m_IDX;
break;
}
if (!found)
continue;
follow_target = entity->m_IDX;
break;
}
}
}
// If we dont have a follow target from that, we look again for someone
// else who is suitable
{
if ((!follow_target || change ||
(ClassPriority(ENTITY(follow_target)) < 6 &&
ENTITY(follow_target)->player_info.friendsID != steamid)) &&
roambot)
{
// Try to get a new target
auto ent_count =
followcart ? HIGHEST_ENTITY : g_IEngine->GetMaxClients();
for (int i = 0; i < ent_count; i++)
if ((!follow_target || change ||
(ClassPriority(ENTITY(follow_target)) < 6 &&
ENTITY(follow_target)->player_info.friendsID != steamid)) &&
roambot)
{
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (!followcart)
// Try to get a new target
auto ent_count =
followcart ? HIGHEST_ENTITY : g_IEngine->GetMaxClients();
for (int i = 0; i < ent_count; i++)
{
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (!followcart)
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (entity == LOCAL_E) // Follow self lol
continue;
if (entity->m_bEnemy())
continue;
if (afk && afkTicks[i].check(
int(afktime))) // don't follow target that
// was determined afk
continue;
if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity))
continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (follow_activation &&
entity->m_flDistance() > (float) follow_activation)
continue;
const model_t *model =
ENTITY(follow_target)->InternalEntity()->GetModel();
// FIXME follow cart/point
/*if (followcart && model &&
(lagexploit::pointarr[0] || lagexploit::pointarr[1] ||
lagexploit::pointarr[2] || lagexploit::pointarr[3] ||
lagexploit::pointarr[4]) &&
(model == lagexploit::pointarr[0] ||
model == lagexploit::pointarr[1] ||
model == lagexploit::pointarr[2] ||
model == lagexploit::pointarr[3] ||
model == lagexploit::pointarr[4]))
follow_target = entity->m_IDX;*/
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (entity == LOCAL_E) // Follow self lol
continue;
if (entity->m_bEnemy())
continue;
if (afk &&
afkTicks[i].check(int(afktime))) // don't follow target that
// was determined afk
continue;
if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity))
continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (follow_activation &&
entity->m_flDistance() > (float) follow_activation)
continue;
const model_t *model =
ENTITY(follow_target)->InternalEntity()->GetModel();
// FIXME follow cart/point
/*if (followcart && model &&
(lagexploit::pointarr[0] || lagexploit::pointarr[1] ||
lagexploit::pointarr[2] || lagexploit::pointarr[3] ||
lagexploit::pointarr[4]) &&
(model == lagexploit::pointarr[0] ||
model == lagexploit::pointarr[1] ||
model == lagexploit::pointarr[2] ||
model == lagexploit::pointarr[3] ||
model == lagexploit::pointarr[4]))
follow_target = entity->m_IDX;*/
if (entity->m_Type() != ENTITY_PLAYER)
continue;
// favor closer entitys
if (follow_target &&
ENTITY(follow_target)->m_flDistance() <
entity->m_flDistance()) // favor closer entitys
continue;
// check if new target has a higher priority than current target
if (ClassPriority(ENTITY(follow_target)) >=
ClassPriority(ENTITY(i)))
continue;
bool found = false;
if (corneractivate)
{
Vector indirectOrigin = VischeckCorner(
LOCAL_E, entity, *follow_activation / 2,
true); // get the corner location that the
// future target is visible from
std::pair<Vector, Vector> corners;
if (!indirectOrigin.z &&
entity->m_IDX == lastent) // if we couldn't find it, run
// wallcheck instead
{
corners =
VischeckWall(LOCAL_E, entity,
float(follow_activation) / 2, true);
if (!corners.first.z || !corners.second.z)
continue;
// addCrumbs(LOCAL_E, corners.first);
// addCrumbs(entity, corners.second);
addCrumbPair(LOCAL_E, entity, corners);
found = true;
}
if (indirectOrigin.z)
{
addCrumbs(entity, indirectOrigin);
found = true;
}
}
else
{
if (VisCheckEntFromEnt(LOCAL_E, entity))
found = true;
}
if (isNavBotCM && !found)
{
if (!nav::navTo(entity->m_vecOrigin()))
// favor closer entitys
if (follow_target &&
ENTITY(follow_target)->m_flDistance() <
entity->m_flDistance()) // favor closer entitys
continue;
navtimeout.update();
found = true;
// check if new target has a higher priority than current
// target
if (ClassPriority(ENTITY(follow_target)) >=
ClassPriority(ENTITY(i)))
continue;
bool found = false;
if (corneractivate)
{
Vector indirectOrigin = VischeckCorner(
LOCAL_E, entity, *follow_activation / 2,
true); // get the corner location that the
// future target is visible from
std::pair<Vector, Vector> corners;
if (!indirectOrigin.z &&
entity->m_IDX ==
lastent) // if we couldn't find it, run
// wallcheck instead
{
corners = VischeckWall(LOCAL_E, entity,
float(follow_activation) / 2,
true);
if (!corners.first.z || !corners.second.z)
continue;
// addCrumbs(LOCAL_E, corners.first);
// addCrumbs(entity, corners.second);
addCrumbPair(LOCAL_E, entity, corners);
found = true;
}
if (indirectOrigin.z)
{
addCrumbs(entity, indirectOrigin);
found = true;
}
}
else
{
if (VisCheckEntFromEnt(LOCAL_E, entity))
found = true;
}
if (isNavBotCM && !found)
{
if (!nav::navTo(entity->m_vecOrigin()))
continue;
navtimeout.update();
found = true;
}
if (!found)
continue;
// ooooo, a target
follow_target = i;
afkTicks[i].update(); // set afk time to 0
}
if (!found)
continue;
// ooooo, a target
follow_target = i;
afkTicks[i].update(); // set afk time to 0
}
}
}
lastent++;
if (lastent > g_IEngine->GetMaxClients())
lastent = 0;

View File

@ -22,7 +22,7 @@
#include "hack.hpp"
static settings::Bool render_zoomed{ "visuals.render-local-zoomed", "false" };
static settings::Bool render_zoomed{ "visual.render-local-zoomed", "false" };
static settings::Bool anti_afk{ "misc.anti-afk", "false" };
static settings::Bool auto_strafe{ "misc.autostrafe", "false" };
static settings::Bool tauntslide{ "misc.tauntslide-tf2c", "false" };

View File

@ -3,12 +3,15 @@
//
#include "common.hpp"
#include <settings/Bool.hpp>
#include <settings/Int.hpp>
#include <settings/Key.hpp>
static settings::Bool enable{ "sandwichaim.enable", "false" };
static settings::Button aimkey{ "sandwichaim.aimkey", "<null>" };
static settings::Int aimkey_mode{ "sandwichaim.aimkey-mode", "0" };
#include "settings/Bool.hpp"
#include "settings/Int.hpp"
#include "settings/Key.hpp"
#include "PlayerTools.hpp"
#include "hacks/Trigger.hpp"
static settings::Bool sandwichaim_enabled{ "sandwichaim.enable", "false" };
static settings::Button sandwichaim_aimkey{ "sandwichaim.aimkey", "<null>" };
static settings::Int sandwichaim_aimkey_mode{ "sandwichaim.aimkey-mode", "0" };
float sandwich_speed = 350.0f;
float grav = 0.25f;
@ -32,6 +35,9 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict,
continue;
if (!ent->hitboxes.GetHitbox(1))
continue;
if (!teammate && player_tools::shouldTarget(ent) !=
player_tools::IgnoreReason::DO_NOT_IGNORE)
continue;
Vector target{};
if (Predict)
target = ProjectilePrediction(ent, 1, sandwich_speed, grav,
@ -151,21 +157,21 @@ void DoSlowAim(Vector &input_angle)
}
static HookedFunction
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
if (!*enable)
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 5, []() {
if (!*sandwichaim_enabled)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (aimkey)
if (sandwichaim_aimkey)
{
switch (*aimkey_mode)
switch (*sandwichaim_aimkey_mode)
{
case 1:
if (!aimkey.isKeyDown())
if (!sandwichaim_aimkey.isKeyDown())
return;
break;
case 2:
if (aimkey.isKeyDown())
if (sandwichaim_aimkey.isKeyDown())
return;
break;
default:
@ -202,7 +208,7 @@ static HookedFunction
return;
if (charge_key && !charge_key.isKeyDown())
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
@ -221,18 +227,64 @@ static HookedFunction
charge_aimbotted = true;
}
});
static settings::Bool charge_control{ "chargecontrol.enable", "false" };
static settings::Int charge_int{ "chargecontrol.strength", "1" };
static settings::Float charge_float{ "chargecontrol.strength", "3.0f" };
static HookedFunction ChargeControl(
HookedFunctions_types::HF_CreateMove, "ChargeControl", 1, []() {
HookedFunctions_types::HF_CreateMove, "chargecontrol", 5, []() {
if (!*charge_control || charge_aimbotted)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
float offset = 0.0f;
if (current_user_cmd->mousedx > 1 || current_user_cmd->mousedx < -1)
offset = -(current_user_cmd->mousedx / 100 * *charge_int);
if (current_user_cmd->buttons & IN_MOVELEFT)
offset = *charge_float;
if (current_user_cmd->buttons & IN_MOVERIGHT)
offset = -*charge_float;
current_user_cmd->viewangles.y += offset;
});
static settings::Bool autosapper_enabled("autosapper.enabled", "false");
static settings::Bool autosapper_silent("autosapper.silent", "true");
static HookedFunction SapperAimbot(HF_CreateMove, "sapperaimbot", 5, []() {
if (!autosapper_enabled)
return;
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W) || !g_pLocalPlayer->holding_sapper)
return;
CachedEntity *target = nullptr;
float fov = FLT_MAX;
float range = re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
for (int i = 0; i < entity_cache::max; i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent))
continue;
if (ent->m_Type() != ENTITY_BUILDING)
continue;
if (!ent->m_bEnemy())
continue;
if (CE_BYTE(ent, netvar.m_bHasSapper))
continue;
if (GetBuildingPosition(ent).DistTo(g_pLocalPlayer->v_Eye) > range)
continue;
float new_fov = GetFov(g_pLocalPlayer->v_OrigViewangles,
g_pLocalPlayer->v_Eye, GetBuildingPosition(ent));
if (fov <= new_fov)
continue;
fov = new_fov;
target = ent;
}
if (target)
{
AimAt(g_pLocalPlayer->v_Eye, GetBuildingPosition(target),
current_user_cmd);
if (autosapper_silent)
g_pLocalPlayer->bUseSilentAngles = true;
current_user_cmd->buttons |= IN_ATTACK;
}
});

File diff suppressed because it is too large Load Diff

View File

@ -279,7 +279,7 @@ void createMove()
static float last_voice_spam = 0.0f;
if (g_GlobalVars->curtime - 4.0F > last_voice_spam)
{
switch ((int) voicecommand_spam)
switch (*voicecommand_spam)
{
case 1: // RANDOM
g_IEngine->ServerCmd(
@ -312,10 +312,10 @@ void createMove()
static int safety_ticks = 0;
static int last_source = 0;
static float last_message = 0;
if ((int) spam_source != last_source)
if (*spam_source != last_source)
{
safety_ticks = 300;
last_source = (int) spam_source;
last_source = *spam_source;
}
if (safety_ticks > 0)
{
@ -328,7 +328,7 @@ void createMove()
}
const std::vector<std::string> *source = nullptr;
switch ((int) spam_source)
switch (*spam_source)
{
case 1:
source = &file.lines;
@ -364,10 +364,11 @@ void createMove()
{
if (current_index >= source->size())
current_index = 0;
if (random_order)
if (random_order && source->size())
{
current_index = rand() % source->size();
while (current_index == last_index)
int tries = 0;
while (current_index == last_index && tries++ < 1000)
{
current_index = rand() % source->size();
}

View File

@ -589,7 +589,7 @@ float EffectiveTargetingRange()
// Pyros only have so much untill their flames hit
else if (g_pLocalPlayer->weapon()->m_iClassID() ==
CL_CLASS(CTFFlameThrower))
return 200.0f;
return 300.0f;
// If user has set a max range, then use their setting,
if (max_range)
return *max_range;

View File

@ -1218,7 +1218,7 @@ Timer map_check{};
int erasedelay = 0;
static HookedFunction
Move(HookedFunctions_types::HF_CreateMove, "Walkbot", 16, []() {
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (state::state == WB_DISABLED)
return;

View File

@ -600,6 +600,19 @@ void VectorAngles(Vector &forward, Vector &angles)
angles[2] = 0;
}
// Get forward vector
void AngleVectors2(const QAngle &angles, Vector *forward)
{
float sp, sy, cp, cy;
SinCos(DEG2RAD(angles[YAW]), &sy, &cy);
SinCos(DEG2RAD(angles[PITCH]), &sp, &cp);
forward->x = cp * cy;
forward->y = cp * sy;
forward->z = -sp;
}
char GetUpperChar(ButtonCode_t button)
{
switch (button)
@ -878,62 +891,7 @@ bool IsProjectileCrit(CachedEntity *ent)
weaponmode GetWeaponMode()
{
int weapon_handle, slot;
CachedEntity *weapon;
if (CE_BAD(LOCAL_E))
return weapon_invalid;
weapon_handle = CE_INT(LOCAL_E, netvar.hActiveWeapon);
if (IDX_BAD((weapon_handle & 0xFFF)))
{
// logging::Info("IDX_BAD: %i", weapon_handle & 0xFFF);
return weaponmode::weapon_invalid;
}
weapon = (ENTITY(weapon_handle & 0xFFF));
if (CE_BAD(weapon))
return weaponmode::weapon_invalid;
int classid = weapon->m_iClassID();
slot = re::C_BaseCombatWeapon::GetSlot(RAW_ENT(weapon));
if (slot == 2)
return weaponmode::weapon_melee;
if (slot > 2)
{
return weaponmode::weapon_pda;
}
else if (classid == CL_CLASS(CTFLunchBox) ||
classid == CL_CLASS(CTFLunchBox_Drink) ||
classid == CL_CLASS(CTFBuffItem))
{
return weaponmode::weapon_consumable;
}
else if (classid == CL_CLASS(CTFRocketLauncher_DirectHit) ||
classid == CL_CLASS(CTFRocketLauncher) ||
classid == CL_CLASS(CTFGrenadeLauncher) ||
classid == CL_CLASS(CTFPipebombLauncher) ||
classid == CL_CLASS(CTFCompoundBow) ||
classid == CL_CLASS(CTFBat_Wood) ||
classid == CL_CLASS(CTFBat_Giftwrap) ||
classid == CL_CLASS(CTFFlareGun) ||
classid == CL_CLASS(CTFFlareGun_Revenge) ||
classid == CL_CLASS(CTFSyringeGun) ||
classid == CL_CLASS(CTFCrossbow) ||
classid == CL_CLASS(CTFShotgunBuildingRescue) ||
classid == CL_CLASS(CTFDRGPomson) ||
classid == CL_CLASS(CTFWeaponFlameBall) ||
classid == CL_CLASS(CTFRaygun) ||
classid == CL_CLASS(CTFGrapplingHook))
{
return weaponmode::weapon_projectile;
}
else if (classid == CL_CLASS(CTFJar) || classid == CL_CLASS(CTFJarMilk))
{
return weaponmode::weapon_throwable;
}
else if (classid == CL_CLASS(CWeaponMedigun))
{
return weaponmode::weapon_medigun;
}
return weaponmode::weapon_hitscan;
return g_pLocalPlayer->weapon_mode;
}
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax)
@ -1282,11 +1240,7 @@ Vector QAngleToVector(QAngle in)
void AimAt(Vector origin, Vector target, CUserCmd *cmd)
{
Vector angles, tr;
tr = (target - origin);
VectorAngles(tr, angles);
fClampAngle(angles);
cmd->viewangles = angles;
cmd->viewangles = GetAimAtAngles(origin, target);
}
void AimAtHitbox(CachedEntity *ent, int hitbox, CUserCmd *cmd)

View File

@ -163,6 +163,14 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
return ret;
}
// Disabled because this causes EXTREME aimbot inaccuracy
// Actually dont disable it. It causes even more inaccuracy
if (!cmd->command_number)
{
g_Settings.is_create_move = false;
return ret;
}
if (!isHackActive())
{
g_Settings.is_create_move = false;
@ -245,8 +253,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
{
entity_cache::Invalidate();
}
// Disabled because this causes EXTREME aimbot inaccuracy
// if (!cmd->command_number) return ret;
// PROF_BEGIN();
{
PROF_SECTION(EntityCache);
@ -279,7 +286,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
// hacks::tf2::NavBot::initonce();
nav::status = nav::off;
IRC::auth();
hacks::shared::NavBot::Init(true);
hacks::tf2::NavBot::initonce();
firstcm = false;
}
g_Settings.bInvalid = false;
@ -447,7 +454,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
{
speedapplied = false;
if (roll_speedhack && cmd->buttons & IN_DUCK &&
!(cmd->buttons & IN_ATTACK))
!(cmd->buttons & IN_ATTACK) && !HasCondition<TFCond_Charging>(LOCAL_E))
{
speed = Vector{ cmd->forwardmove, cmd->sidemove, 0.0f }.Length();
static float prevspeedang = 0.0f;

View File

@ -40,7 +40,17 @@ CatCommand spectate("spectate", "Spectate", [](const CCommand &args) {
spectator_target = 0;
return;
}
int id = atoi(args.Arg(1));
int id;
try
{
id = std::stoi(args.Arg(1));
}
catch (const std::exception &e)
{
logging::Info("Error while setting spectate target. Error: %s",
e.what());
id = 0;
}
if (!id)
spectator_target = 0;
else

View File

@ -12,6 +12,65 @@ CatCommand printfov("fov_print", "Dump achievements to file (development)",
if (CE_GOOD(LOCAL_E))
logging::Info("%d", CE_INT(LOCAL_E, netvar.iFOV));
});
weaponmode GetWeaponModeloc()
{
int weapon_handle, slot;
CachedEntity *weapon;
if (CE_BAD(LOCAL_E) | CE_BAD(LOCAL_W))
return weapon_invalid;
weapon_handle = CE_INT(LOCAL_E, netvar.hActiveWeapon);
if (IDX_BAD((weapon_handle & 0xFFF)))
{
// logging::Info("IDX_BAD: %i", weapon_handle & 0xFFF);
return weaponmode::weapon_invalid;
}
weapon = (ENTITY(weapon_handle & 0xFFF));
if (CE_BAD(weapon))
return weaponmode::weapon_invalid;
int classid = weapon->m_iClassID();
slot = re::C_BaseCombatWeapon::GetSlot(RAW_ENT(weapon));
if (slot == 2)
return weaponmode::weapon_melee;
if (slot > 2)
{
return weaponmode::weapon_pda;
}
else if (classid == CL_CLASS(CTFLunchBox) ||
classid == CL_CLASS(CTFLunchBox_Drink) ||
classid == CL_CLASS(CTFBuffItem))
{
return weaponmode::weapon_consumable;
}
else if (classid == CL_CLASS(CTFRocketLauncher_DirectHit) ||
classid == CL_CLASS(CTFRocketLauncher) ||
classid == CL_CLASS(CTFGrenadeLauncher) ||
classid == CL_CLASS(CTFPipebombLauncher) ||
classid == CL_CLASS(CTFCompoundBow) ||
classid == CL_CLASS(CTFBat_Wood) ||
classid == CL_CLASS(CTFBat_Giftwrap) ||
classid == CL_CLASS(CTFFlareGun) ||
classid == CL_CLASS(CTFFlareGun_Revenge) ||
classid == CL_CLASS(CTFSyringeGun) ||
classid == CL_CLASS(CTFCrossbow) ||
classid == CL_CLASS(CTFShotgunBuildingRescue) ||
classid == CL_CLASS(CTFDRGPomson) ||
classid == CL_CLASS(CTFWeaponFlameBall) ||
classid == CL_CLASS(CTFRaygun) ||
classid == CL_CLASS(CTFGrapplingHook))
{
return weaponmode::weapon_projectile;
}
else if (classid == CL_CLASS(CTFJar) || classid == CL_CLASS(CTFJarMilk))
{
return weaponmode::weapon_throwable;
}
else if (classid == CL_CLASS(CWeaponMedigun))
{
return weaponmode::weapon_medigun;
}
return weaponmode::weapon_hitscan;
}
void LocalPlayer::Update()
{
CachedEntity *wep;
@ -28,7 +87,7 @@ void LocalPlayer::Update()
wep = weapon();
if (CE_GOOD(wep))
{
weapon_mode = GetWeaponMode();
weapon_mode = GetWeaponModeloc();
if (wep->m_iClassID() == CL_CLASS(CTFSniperRifle) ||
wep->m_iClassID() == CL_CLASS(CTFSniperRifleDecap))
holding_sniper_rifle = true;

View File

@ -279,7 +279,7 @@ public:
{
i.second.status = unknown;
i.second.stucktime = 0;
reset_pather = true;
reset_pather = true;
}
break;
case unknown:
@ -288,7 +288,7 @@ public:
if (i.second.ignoreTimeout.check(20000))
{
i.second.status = unknown;
reset_pather = true;
reset_pather = true;
}
break;
case vischeck_failed:
@ -298,7 +298,7 @@ public:
{
i.second.status = unknown;
i.second.stucktime = 0;
reset_pather = true;
reset_pather = true;
}
break;
}
@ -542,6 +542,10 @@ bool navTo(Vector destination, int priority, bool should_repath,
std::vector<Vector> path = findPath(g_pLocalPlayer->v_Origin, destination);
if (path.empty())
return false;
if (!crumbs.empty())
{
ignoremanager::addTime(last_area, crumbs.at(0), inactivity);
}
last_area = path.at(0);
if (!nav_to_local)
{
@ -554,10 +558,6 @@ bool navTo(Vector destination, int priority, bool should_repath,
{
findClosestNavSquare_localAreas.clear();
}
if (!crumbs.empty())
{
ignoremanager::addTime(last_area, crumbs.at(0), inactivity);
}
ensureArrival = should_repath;
ReadyForCommands = false;
curr_priority = priority;
@ -583,7 +583,7 @@ static HookedFunction
CreateMove(HookedFunctions_types::HF_CreateMove, "NavParser", 17, []() {
if (!enabled || status != on)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (!LOCAL_E->m_bAlivePlayer())
{
@ -636,7 +636,7 @@ static HookedFunction drawcrumbs(HF_Draw, "navparser", 10, []() {
return;
if (!enabled)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (!LOCAL_E->m_bAlivePlayer())
return;
@ -695,6 +695,9 @@ static CatCommand nav_init("nav_init", "Debug nav init", []() {
static CatCommand nav_path("nav_path", "Debug nav path", []() { navTo(loc); });
static CatCommand nav_path_no_local("nav_path_no_local", "Debug nav path",
[]() { navTo(loc, 5, false, false); });
static CatCommand nav_reset_ignores("nav_reset_ignores", "Reset all ignores.",
[]() { ignoremanager::reset(); });

6
src/trace.cpp Executable file → Normal file
View File

@ -141,9 +141,9 @@ bool trace::FilterNoEntity::ShouldHitEntity(IHandleEntity *handle, int mask)
// Hit doors, carts, etc
switch (clazz->m_ClassID)
{
case 6:
case 7:
return true;
case 6:
case 7:
return true;
}
return false;
}

View File

@ -32,7 +32,7 @@ static settings::Bool disco_chams{ "chams.disco", "false" };
namespace effect_chams
{
CatCommand fix_black_chams("fix_black_chams", "Fix Black Chams", [](){
CatCommand fix_black_chams("fix_black_chams", "Fix Black Chams", []() {
effect_chams::g_EffectChams.Shutdown();
effect_chams::g_EffectChams.Init();
});
@ -82,7 +82,7 @@ void EffectChams::EndRenderChams()
CMatRenderContextPtr ptr(GET_RENDER_CONTEXT);
g_IVModelRender->ForcedMaterialOverride(nullptr);
}
static rgba_t data[32] = {colors::empty};
static rgba_t data[32] = { colors::empty };
void EffectChams::SetEntityColor(CachedEntity *ent, rgba_t color)
{
if (ent->m_IDX > 31 || ent->m_IDX < 0)
@ -156,7 +156,7 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity)
}
if (data[entity->entindex()] != colors::empty)
{
auto toret = data[entity->entindex()];
auto toret = data[entity->entindex()];
data[entity->entindex()] = colors::empty;
return toret;
}

View File

@ -138,7 +138,7 @@ static ShaderStencilState_t SS_SolidInvisible{};
static ShaderStencilState_t SS_Null{};
static ShaderStencilState_t SS_Drawing{};
CatCommand fix_black_glow("fix_black_glow", "Fix Black Glow", [](){
CatCommand fix_black_glow("fix_black_glow", "Fix Black Glow", []() {
effect_glow::g_EffectGlow.Shutdown();
effect_glow::g_EffectGlow.Init();
});

View File

@ -15,23 +15,20 @@
#ifndef FEATURE_FIDGET_SPINNER_ENABLED
static settings::Bool enable_spinner{ "visuals.fidget-spinner.enable",
"false" };
static settings::Bool v9mode{ "visuals.fidget-spinner.v952-mode", "false" };
static settings::Float spinner_speed_cap{ "visuals.fidget-spinner.speed-cap",
static settings::Bool enable_spinner{ "visual.fidget-spinner.enable", "false" };
static settings::Bool v9mode{ "visual.fidget-spinner.v952-mode", "false" };
static settings::Float spinner_speed_cap{ "visual.fidget-spinner.speed-cap",
"30" };
static settings::Float spinner_speed_scale{
"visuals.fidget-spinner.speed-scale", "0.03"
};
static settings::Float spinner_decay_speed{
"visuals.fidget-spinner.decay-speed", "0.1"
};
static settings::Float spinner_scale{ "visuals.fidget-spinner.scale", "32" };
static settings::Float spinner_min_speed{ "visuals.fidget-spinner.min-speed",
static settings::Float spinner_speed_scale{ "visual.fidget-spinner.speed-scale",
"0.03" };
static settings::Float spinner_decay_speed{ "visual.fidget-spinner.decay-speed",
"0.1" };
static settings::Float spinner_scale{ "visual.fidget-spinner.scale", "32" };
static settings::Float spinner_min_speed{ "visual.fidget-spinner.min-speed",
"2" };
float spinning_speed = 0.0f;
float angle = 0;
static float spinning_speed = 0.0f;
static float angle = 0;
// DEBUG
/*CatCommand add_spinner_speed("fidgetspinner_debug_speedup", "Add speed", []()
@ -41,7 +38,7 @@ float angle = 0;
class SpinnerListener : public IGameEventListener
{
public:
virtual void FireGameEvent(KeyValues *event)
void FireGameEvent(KeyValues *event) override
{
std::string name(event->GetName());
if (name == "player_death")
@ -64,7 +61,7 @@ void InitSpinner()
g_IGameEventManager->AddListener(&listener, false);
}
Timer retrytimer{};
static Timer retrytimer{};
void DrawSpinner()
{
@ -95,10 +92,10 @@ void DrawSpinner()
angle += speed_scale * real_speed;
int state = min(3, int(spinning_speed / 250));
glez::draw::rect_textured(draw::width / 2, draw::height / 2, size, size,
colors::white, textures::atlas().texture,
64 * state, (3 + (v9mode ? 0 : 1)) * 64, 64, 64,
angle);
glez::draw::rect_textured(
draw::width / 2 - size * 0.5f, draw::height / 2 - size * 0.5f, size,
size, colors::white, textures::atlas().texture, 64 * state,
(3 + (v9mode ? 0 : 1)) * 64, 64, 64, angle);
if (angle > PI * 4)
angle -= PI * 4;
}

View File

@ -1,2 +0,0 @@
#!/usr/bin/env bash
printf "\n\n";printf '\e[1;34m%-6s\e' "Your cathook version is out of date! Please reinstall by using \"wget https://raw.githubusercontent.com/nullworks/One-in-all-cathook-install/master/install-all && bash install-all\"";printf "\n\n"