auto_zoom auto_unzoom

This commit is contained in:
nullifiedcat 2017-07-24 19:09:14 +03:00
parent 4af2be581f
commit 33665d3a96
2 changed files with 35 additions and 6 deletions

View File

@ -102,6 +102,7 @@ static CatVar fovcircle_opacity(CV_FLOAT, "aimbot_fov_draw_opacity", "0.7", "FOV
static CatVar rageonly(CV_SWITCH, "aimbot_rage_only", "0", "Ignore non-rage targets", "Use playerlist to set up rage targets");
static CatVar miss_chance(CV_FLOAT, "aimbot_miss_chance", "0", "Miss chance", "From 0 to 1. Aimbot will NOT aim in these % cases", 0.0f, 1.0f);
static CatVar auto_unzoom(CV_SWITCH, "aimbot_auto_unzoom", "0", "Auto Un-zoom", "Automatically unzoom");
// Current Entity
int target_eid { 0 };
@ -126,6 +127,15 @@ void CreateMove() {
// Check if aimbot is enabled
if (!enabled) return;
if (auto_unzoom) {
if (g_pLocalPlayer->holding_sniper_rifle) {
if (g_pLocalPlayer->bZoomed) {
if (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin > 5.0f)
g_pUserCmd->buttons |= IN_ATTACK2;
}
}
}
// Refresh projectile info
int huntsman_ticks = 0;
projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(), cur_proj_speed, cur_proj_grav));
@ -152,6 +162,16 @@ void CreateMove() {
// Check target for dormancy and if there even is a target at all
if (CE_GOOD(target) && foundTarget) {
IF_GAME (IsTF()) {
if (auto_zoom) {
if (g_pLocalPlayer->holding_sniper_rifle) {
if (not g_pLocalPlayer->bZoomed) {
g_pUserCmd->buttons |= IN_ATTACK2;
}
}
}
}
// Set target esp color to pink
hacks::shared::esp::SetEntityColor(target, colors::pink);
@ -564,7 +584,7 @@ bool CanAutoShoot() {
}
// Check if zoomed, and zoom if not, then zoom
IF_GAME (IsTF()) {
/*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)) {
@ -573,7 +593,7 @@ bool CanAutoShoot() {
}
}
}
}
}*/
// Check if ambassador can headshot
IF_GAME (IsTF2()) {

View File

@ -570,13 +570,15 @@ void UpdateClosestNode() {
// Finds nearest node by position, not FOV
// Not to be confused with FindClosestNode
index_t FindNearestNode() {
index_t FindNearestNode(bool traceray) {
index_t r_node { BAD_NODE };
float r_dist { 65536.0f };
for (index_t i = 0; i < state::nodes.size(); i++) {
if (state::node_good(i)) {
auto& n = state::nodes[i];
if (traceray and not IsVectorVisible(g_pLocalPlayer->v_Eye, n.xyz()))
continue;
float dist = distance_2d(n.xyz());
if (dist < r_dist) {
r_dist = dist;
@ -590,7 +592,7 @@ index_t FindNearestNode() {
index_t SelectNextNode() {
if (not state::node_good(state::active_node)) {
return FindNearestNode();
return FindNearestNode(true);
}
auto& n = state::nodes[state::active_node];
// TODO medkit connections and shit
@ -608,9 +610,13 @@ index_t SelectNextNode() {
return BAD_NODE;
}
bool free_move_used = false;
void UpdateWalker() {
free_move_used = false;
if (free_move) {
if (g_pUserCmd->forwardmove != 0.0f or g_pUserCmd->sidemove != 0.0f) {
free_move_used = true;
return;
}
}
@ -622,7 +628,7 @@ void UpdateWalker() {
}
bool timeout = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now() - state::time).count() > 1;
if (not state::node_good(state::active_node) or timeout) {
state::active_node = FindNearestNode();
state::active_node = FindNearestNode(true);
state::recovery = true;
}
auto& n = state::nodes[state::active_node];
@ -634,7 +640,7 @@ void UpdateWalker() {
}
float dist = distance_2d(n.xyz());
if (dist > float(max_distance)) {
state::active_node = FindNearestNode();
state::active_node = FindNearestNode(true);
state::recovery = true;
}
if (dist < float(reach_distance)) {
@ -781,6 +787,9 @@ void Draw() {
} break;
case WB_REPLAYING: {
AddSideString("Walkbot: Replaying");
if (free_move and free_move_used) {
AddSideString("Walkbot: FREE MOVEMENT (User override)", colors::green);
}
} break;
}
if (draw_info) {