Rewrote wait for charge + added tracers

This commit is contained in:
julianacat 2017-07-19 15:06:34 -05:00
parent 79115daf28
commit c962074eb4
3 changed files with 65 additions and 16 deletions

View File

@ -52,6 +52,7 @@ static CatVar priority_mode(priority_mode_enum, "aimbot_prioritymode", "0", "Pri
"SMART: Basically Auto-Threat. Will be tweakable eventually. "
"FOV, DISTANCE, HEALTH are self-explainable. HEALTH picks the weakest enemy");
static CatVar wait_for_charge(CV_SWITCH, "aimbot_charge", "0", "Wait for sniper rifle charge", "Aimbot waits until it has enough charge to kill");
static CatVar ambassador_wait(CV_SWITCH, "aimbot_ambassador", "1", "Wait for headshot", "Aimbot waits until it has enough charge to headshot with the ambassador");
static CatVar ignore_vaccinator(CV_SWITCH, "aimbot_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets");
static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies");
static CatVar ignore_cloak(CV_SWITCH, "aimbot_ignore_cloak", "1", "Ignore cloaked", "Don't aim at invisible enemies");
@ -96,9 +97,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");
*/
// Current Entity
int target_eid { 0 };
@ -362,9 +361,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;
}
}
@ -493,6 +509,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);
@ -508,8 +525,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;
@ -524,10 +543,21 @@ 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())) {
if (ambassador_wait && IsAmbassador(g_pLocalPlayer->weapon())) {
// Check if ambasador can headshot
if (!AmbassadorCanHeadshot()) return false;
}
@ -614,7 +644,12 @@ 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
if (AmbassadorCanHeadshot()) {
headonly = true;
// 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");
@ -650,6 +652,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 == 2) 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");