diff --git a/Application/Instances/Player.h b/Application/Instances/Player.h index 98227e5..339794d 100644 --- a/Application/Instances/Player.h +++ b/Application/Instances/Player.h @@ -17,7 +17,6 @@ class Player std::vector bones; std::vector screenBones; - Player *currentTarget; Position screenFeet, screenEye; Box screenBox; @@ -102,27 +101,27 @@ class Player return Read(entity + ptr_diff); }; - const bool IsLocalPlayer() + const bool IsLocalPlayer() const { return isLocalPlayer; } - const bool IsEnemy() + const bool IsEnemy() const { return !isLocalPlayer && !isTeammate; } - const bool IsAlive() + const bool IsAlive() const { return isAlive && health > 0; } - const bool IsScreenVisible() + const bool IsScreenVisible() const { return isScreenVisible; } - const bool IsValidTarget() + const bool IsValidTarget() const { return IsScreenVisible() && IsEnemy() && IsAlive(); } diff --git a/Application/Modules/AimBotModule.h b/Application/Modules/AimBotModule.h index ade7a68..82e2425 100644 --- a/Application/Modules/AimBotModule.h +++ b/Application/Modules/AimBotModule.h @@ -10,12 +10,41 @@ struct ModulesConfig class AimBotModule : public Module { AimConfig config; + uintptr_t currentTargetPtr; - bool SetCurrentTarget() + void UpdateConfigs() { - if (MyLocalPlayer.currentTarget && MyLocalPlayer.currentTarget->IsValidTarget()) - return true; + config.isClickActive = 0; + config.aimCircle.p = ClientCenterPosition; + + // uses page up to increment smoothness + if (GetAsyncKeyState(SB_PAGEUP) & 1) + config.smoothness += 0.1F; + + // uses page up to decrement smoothness + if (GetAsyncKeyState(SB_PAGEDOWN) & 1) + config.smoothness -= 0.1F; + // VK_XBUTTON1 (Mouse 4) toggles aim lock + if (GetAsyncKeyState(VK_XBUTTON1) & 1) + config.isAimActive = !config.isAimActive; + + // VK_XBUTTON2 (Mouse 5) hold for auto shoot on target + GetAsyncKeyState(VK_XBUTTON2) & 1; + if (GetAsyncKeyState(VK_XBUTTON2) & 1) + config.isClickActive = 1; + } + + void UpdateTarget() + { + if (!config.isAimActive) + { + currentTargetPtr = NULL; + return; + } + + Player target; + uintptr_t ptrFound = NULL; for (Player &player : ENEMIES) { if (!player.IsValidTarget()) @@ -24,24 +53,23 @@ class AimBotModule : public Module if (!InterSects(player.screenBox, config.aimCircle)) continue; - MyLocalPlayer.currentTarget = &player; - return true; - } - - return false; - } - - void UpdateConfigs() - { - config.aimCircle.p = ClientCenterPosition; + if (currentTargetPtr && currentTargetPtr == player.entity) + { + ptrFound = player.entity; + target = player; + break; + } - // uses page up to increment smoothness - if (GetAsyncKeyState(SB_PAGEUP) & 1) - config.smoothness += 0.1F; + ptrFound = player.entity; + target = player; + break; + } - // uses page up to decrement smoothness - if (GetAsyncKeyState(SB_PAGEDOWN) & 1) - config.smoothness -= 0.1F; + if (ptrFound) + { + currentTargetPtr = ptrFound; + MyLocalPlayer.SetViewAngles(target.aimAngle, config.smoothness); + } } void Execute() override @@ -51,19 +79,11 @@ class AimBotModule : public Module if (!config.isActive) return; - if (!SetCurrentTarget()) - return; - - // VK_XBUTTON1 (Mouse 4) only needs a 'toggle' (on/off) - if (config.isAimActive && GetKeyState(VK_XBUTTON1)) - { - MyLocalPlayer.SetViewAngles(MyLocalPlayer.currentTarget->aimAngle, config.smoothness); - } + UpdateTarget(); - // VK_XBUTTON2 (Mouse 5) need a 'hold' if (config.isClickActive && MyLocalPlayer.crossIndex >= 0) { - if (!GetAsyncKeyState(VK_XBUTTON2) || !GetAsyncKeyState(VK_XBUTTON2)) + if (!config.isClickActive) return; mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); diff --git a/Application/Modules/Configs.h b/Application/Modules/Configs.h index fecea9e..8683023 100644 --- a/Application/Modules/Configs.h +++ b/Application/Modules/Configs.h @@ -33,7 +33,7 @@ struct EspConfig : public ModuleConfig struct AimConfig : public ModuleConfig { - bool isAimActive = true, isClickActive = true, showAimCircle = false; - Circle aimCircle = {.radius = 64, .color = White12, .borderColor = White25}; - float smoothness = 1.33F; + bool isAimActive = false, isClickActive = false, showAimCircle = false; + Circle aimCircle = {.radius = 72, .color = White12, .borderColor = White25}; + float smoothness = 1.5F; }; \ No newline at end of file