Merge pull request #200 from julianacat/master

Tracers + Auto-Zoom
This commit is contained in:
julianacat 2017-07-19 15:14:20 -05:00 committed by GitHub
commit a902c5af83
3 changed files with 61 additions and 15 deletions

View File

@ -96,9 +96,7 @@ static CatVar aimbot_debug(CV_SWITCH, "aimbot_debug", "0", "Aimbot Debug", "Disp
static CatVar engine_projpred(CV_SWITCH, "debug_aimbot_engine_pp", "0", "Engine ProjPred");
// Followbot vars
static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots");
/* TODO IMPLEMENT
static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots");
*/
static CatVar rageonly(CV_SWITCH, "aimbot_rage_only", "0", "Ignore non-rage targets", "Use playerlist to set up rage targets");
@ -369,9 +367,26 @@ bool IsTargetStateGood(CachedEntity* entity) {
IF_GAME (IsTF()) {
// If settings allow waiting for charge, and current charge cant kill target, dont aim
if (wait_for_charge && g_pLocalPlayer->holding_sniper_rifle) {
float bdmg = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flChargedDamage);
if (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin <= 1.0f) bdmg = 50.0f;
if ((bdmg * 3) < (HasDarwins(entity) ? (entity->m_iHealth * 1.15) : entity->m_iHealth)) {
// Grab netvar for current charge damage and multiply by 3 for headshot
float cdmg = CE_FLOAT(LOCAL_W, netvar.flChargedDamage) * 3;
// Darwins damage correction, Darwins protects against 15% of damage
if (HasDarwins(entity))
cdmg = (cdmg * .85) - 1;
// Vaccinator damage correction, Vac charge protects against 75% of damage
if (HasCondition<TFCond_UberBulletResist>(entity)) {
cdmg = (cdmg * .25) - 1;
// Passive bullet resist protects against 10% of damage
} else if (HasCondition<TFCond_SmallBulletResist>(entity)) {
cdmg = (cdmg * .90) - 1;
}
// Invis damage correction, Invis spies get protection from 10% of damage
if (IsPlayerInvisible(entity))
cdmg = (cdmg * .80) - 1;
// Check if player will die from headshot or if target has more health than normal overheal allows.
if ( !(entity->m_iHealth <= 150 || entity->m_iHealth <= cdmg || !g_pLocalPlayer->bZoomed || entity->m_iHealth > entity->m_iMaxHealth + (entity->m_iMaxHealth * 0.5)) ) {
return false;
}
}
@ -500,6 +515,7 @@ void Aim(CachedEntity* entity) {
// Grab the targets vector, and vector it for the eye angles
tr = (PredictEntity(entity) - g_pLocalPlayer->v_Eye);
VectorAngles(tr, angles);
// Clamp angles
fClampAngle(angles);
@ -515,8 +531,10 @@ void Aim(CachedEntity* entity) {
// A function to check whether player can autoshoot
bool CanAutoShoot() {
// First check whether user settings allow autoshoot
if (autoshoot) {
// A var for weapons not to use with autoshoot
static int forbiddenWeapons[] = { CL_CLASS(CTFCompoundBow), CL_CLASS(CTFKnife) };
int weapon_class;
@ -531,9 +549,20 @@ bool CanAutoShoot() {
}
}
// Check if zoomed, and zoom if not, then zoom
IF_GAME (IsTF()) {
if (g_pLocalPlayer->clazz == tf_class::tf_sniper) {
if (g_pLocalPlayer->holding_sniper_rifle) {
if (auto_zoom && !HasCondition<TFCond_Zoomed>(LOCAL_E)) {
g_pUserCmd->buttons |= IN_ATTACK2;
attack = false;
}
}
}
}
// Check if ambassador can headshot
IF_GAME (IsTF2()) {
// Check if players current weapon is an ambasador
if (IsAmbassador(g_pLocalPlayer->weapon())) {
// Check if ambasador can headshot
if (!AmbassadorCanHeadshot()) return false;
@ -621,7 +650,10 @@ int BestHitbox(CachedEntity* target) {
headonly = true;
// If player is using an ambassador, set headonly to true
} else if (IsAmbassador(g_pLocalPlayer->weapon())) {
headonly = true;
// We only want to aim for the head if the ambassador can headshot
headonly = AmbassadorCanHeadshot();
// 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher
if (target->m_iHealth <= 18) headonly = false;
// If player is using a rocket based weapon, prefer the hip
} else if (ci == CL_CLASS(CTFRocketLauncher) ||
ci == CL_CLASS(CTFRocketLauncher_AirStrike) ||

View File

@ -13,6 +13,8 @@
namespace hacks { namespace shared { namespace esp {
CatVar show_weapon(CV_SWITCH, "esp_weapon", "1", "Show weapon name", "Show which weapon does the enemy use");
CatEnum tracers_enum({ "OFF", "CENTER", "BOTTOM" });
CatVar tracers(tracers_enum, "esp_tracers", "0", "Tracers", "SDraws a line from the player to a position on your screen");
CatVar local_esp(CV_SWITCH, "esp_local", "1", "ESP Local Player", "Shows local player ESP in thirdperson");
CatVar buildings(CV_SWITCH, "esp_buildings", "1", "Building ESP", "Show buildings");
CatVar enabled(CV_SWITCH, "esp_enabled", "0", "ESP", "Master ESP switch");
@ -651,6 +653,25 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) {
}
}
if (tracers && ent->m_Type == ENTITY_PLAYER) {
// Grab the screen resolution and save to some vars
int width, height;
g_IEngine->GetScreenSize(width, height);
// Center values on screen
width = width / 2;
// Only center height if we are using center mode
if ((int)tracers == 1) height = height / 2;
// Get world to screen
Vector scn;
draw::WorldToScreen(ent->m_vecOrigin, scn);
// Draw a line
drawgl::Line(scn.x, scn.y, width - scn.x, height - scn.y, fg);
}
if (ent->m_Type == ENTITY_PLAYER) {
if (joy_esp) {
auto hb = ent->hitboxes.GetHitbox(0);

View File

@ -14,17 +14,10 @@
namespace hacks { namespace shared { namespace followbot {
/* Big Followbot TODO list
1. Fix crash when setting followbot_idx var and remove the fix var in its place
2. Test with followbots to ensure that vector followbot and crumb followbot work as intended
3. Clean the finished code and push to main from fork
*/
// User settings
CatVar bot(CV_SWITCH, "fb_bot", "0", "Master Followbot Switch", "Set to 1 in followbots' configs");