Fix potential crash
This commit is contained in:
parent
04fed82e76
commit
8ced275749
@ -100,8 +100,7 @@ static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automa
|
|||||||
// Current Entity
|
// Current Entity
|
||||||
int target_eid { 0 };
|
int target_eid { 0 };
|
||||||
CachedEntity* target = 0;
|
CachedEntity* target = 0;
|
||||||
CachedEntity* target_locked = 0;
|
CachedEntity* target_last = 0;
|
||||||
int last_target { -1 };
|
|
||||||
bool foundTarget = false;
|
bool foundTarget = false;
|
||||||
// Projectile info
|
// Projectile info
|
||||||
bool projectile_mode { false };
|
bool projectile_mode { false };
|
||||||
@ -144,7 +143,6 @@ void CreateMove() {
|
|||||||
if (CE_GOOD(target) && foundTarget) {
|
if (CE_GOOD(target) && foundTarget) {
|
||||||
// Set target esp color to pink
|
// Set target esp color to pink
|
||||||
hacks::shared::esp::SetEntityColor(target, colors::pink);
|
hacks::shared::esp::SetEntityColor(target, colors::pink);
|
||||||
last_target = target->m_IDX;
|
|
||||||
|
|
||||||
// Check if player can aim
|
// Check if player can aim
|
||||||
// We also preform a CanShoot check here per the old canshoot method
|
// We also preform a CanShoot check here per the old canshoot method
|
||||||
@ -271,15 +269,18 @@ CachedEntity* RetrieveBestTarget() {
|
|||||||
|
|
||||||
// If we have a previously chosen target, target lock is on, and the aimkey is allowed, then attemt to keep the previous target
|
// If we have a previously chosen target, target lock is on, and the aimkey is allowed, then attemt to keep the previous target
|
||||||
if (target_lock && foundTarget && UpdateAimkey()) {
|
if (target_lock && foundTarget && UpdateAimkey()) {
|
||||||
// Check if previous target is still good
|
if (CE_GOOD(target_last)) {
|
||||||
if (IsTargetStateGood(target_locked)) {
|
// Check if previous target is still good
|
||||||
// If it is then return it again
|
if (IsTargetStateGood(target_last)) {
|
||||||
return target_locked;
|
// If it is then return it again
|
||||||
|
return target_locked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We dont have a target currently so we must find one
|
// We dont have a target currently so we must find one, reset statuses
|
||||||
foundTarget = false;
|
foundTarget = false;
|
||||||
|
target_last = -1;
|
||||||
|
|
||||||
// Book keeping vars
|
// Book keeping vars
|
||||||
float target_highest_score, scr;
|
float target_highest_score, scr;
|
||||||
@ -321,7 +322,7 @@ CachedEntity* RetrieveBestTarget() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Save the ent for future use with target lock
|
// Save the ent for future use with target lock
|
||||||
target_locked = target_highest_ent;
|
target_last = target_highest_ent;
|
||||||
// When our for loop finishes, return our ent
|
// When our for loop finishes, return our ent
|
||||||
return target_highest_ent;
|
return target_highest_ent;
|
||||||
}
|
}
|
||||||
@ -883,7 +884,7 @@ CachedEntity* CurrentTarget() {
|
|||||||
|
|
||||||
// Used for when you join and leave maps to reset aimbot vars
|
// Used for when you join and leave maps to reset aimbot vars
|
||||||
void Reset() {
|
void Reset() {
|
||||||
last_target = -1;
|
target_last = -1;
|
||||||
projectile_mode = false;
|
projectile_mode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user