From 26f99448da82b406c49709bf50929c580220734c Mon Sep 17 00:00:00 2001 From: Fr0go1 <112802612+Fr0go1@users.noreply.github.com> Date: Tue, 10 Oct 2023 21:53:38 +1000 Subject: [PATCH] added spectate esp --- CS2_External/CS2_External.vcxproj | 3 +- CS2_External/CS2_External.vcxproj.filters | 5 +- CS2_External/Cheats.cpp | 26 +++++++--- CS2_External/Cheats.h | 2 +- CS2_External/MenuConfig.hpp | 1 + CS2_External/TriggerBot.cpp | 42 ---------------- CS2_External/TriggerBot.h | 20 -------- CS2_External/TriggerBot.hpp | 59 +++++++++++++++++++++++ CS2_External/Utils/ConfigMenu.cpp | 21 ++++++-- CS2_External/Utils/ConfigSaver.cpp | 4 +- CS2_External/main.cpp | 26 ++++++---- 11 files changed, 118 insertions(+), 91 deletions(-) delete mode 100644 CS2_External/TriggerBot.cpp delete mode 100644 CS2_External/TriggerBot.h create mode 100644 CS2_External/TriggerBot.hpp diff --git a/CS2_External/CS2_External.vcxproj b/CS2_External/CS2_External.vcxproj index 769e1a9..ec64434 100644 --- a/CS2_External/CS2_External.vcxproj +++ b/CS2_External/CS2_External.vcxproj @@ -168,7 +168,7 @@ - + @@ -191,7 +191,6 @@ - diff --git a/CS2_External/CS2_External.vcxproj.filters b/CS2_External/CS2_External.vcxproj.filters index 0b44f5b..7c1cf14 100644 --- a/CS2_External/CS2_External.vcxproj.filters +++ b/CS2_External/CS2_External.vcxproj.filters @@ -108,7 +108,7 @@ Cheats\Radar - + Cheats @@ -176,9 +176,6 @@ Cheats\Radar - - Cheats - Utils\ConfigSaver diff --git a/CS2_External/Cheats.cpp b/CS2_External/Cheats.cpp index b5802c3..31b6cc0 100644 --- a/CS2_External/Cheats.cpp +++ b/CS2_External/Cheats.cpp @@ -5,6 +5,7 @@ #include "Utils/ConfigSaver.hpp" #include "Utils/style.hpp" #include "font/IconsFontAwesome5.h" +#include "TriggerBot.hpp" #include "AimBot.hpp" #include @@ -175,7 +176,7 @@ void Cheats::Menu() ImGui::Checkbox("TriggerBot", &MenuConfig::TriggerBot); - if (ImGui::Combo("TriggerKey", &MenuConfig::TriggerHotKey, "MENU\0RBUTTON\0XBUTTON1\0XBUTTON2\0CAPITAL\0SHIFT\0CONTROL")) + if (ImGui::Combo("Triggerbot", &MenuConfig::TriggerHotKey, "MENU\0RBUTTON\0XBUTTON1\0XBUTTON2\0CAPITAL\0SHIFT\0CONTROL")) { TriggerBot::SetHotKey(MenuConfig::TriggerHotKey); } @@ -204,6 +205,8 @@ void Cheats::Menu() ImGui::Checkbox("TeamCheck", &MenuConfig::TeamCheck); ImGui::SameLine(); ImGui::Checkbox("BypassOBS", &MenuConfig::OBSBypass); + ImGui::SameLine(); + ImGui::Checkbox("Spectate Esp", &MenuConfig::SpectateEsp); ImGui::Text("[INSERT] HideMenu"); @@ -273,8 +276,15 @@ void Cheats::Run() CEntity LocalEntity; if (!LocalEntity.UpdateController(LocalControllerAddress)) return; - if (!LocalEntity.UpdatePawn(LocalPawnAddress)) - return; + + if (MenuConfig::SpectateEsp) { + if (!LocalEntity.UpdatePawn(LocalPawnAddress)); + } + else + { + if (!LocalEntity.UpdatePawn(LocalPawnAddress)) + return; + } // HealthBar Map static std::map HealthBarMap; @@ -427,10 +437,6 @@ void Cheats::Run() ImGui::End(); } - // TriggerBot - if (MenuConfig::TriggerBot && GetAsyncKeyState(TriggerBot::HotKey)) - TriggerBot::Run(LocalEntity); - // HeadShoot Line if (MenuConfig::ShowHeadShootLine) Render::HeadShootLine(LocalEntity, MenuConfig::HeadShootLineColor); @@ -449,6 +455,12 @@ void Cheats::Run() if (MenuConfig::BunnyHop) Bunnyhop::Run(LocalEntity); + // TriggerBot + if (MenuConfig::TriggerBot && GetAsyncKeyState(TriggerBot::HotKey)) + { + TriggerBot::Run(LocalEntity); + } + if (MenuConfig::AimBot && GetAsyncKeyState(AimControl::HotKey)) { if (AimPos != Vec3(0, 0, 0)) diff --git a/CS2_External/Cheats.h b/CS2_External/Cheats.h index 87a2ed1..eddd2e6 100644 --- a/CS2_External/Cheats.h +++ b/CS2_External/Cheats.h @@ -3,7 +3,7 @@ #include "Entity.h" #include "AimBot.hpp" #include "Radar/Radar.h" -#include "TriggerBot.h" +#include "TriggerBot.hpp" #include "Bunnyhop.hpp" namespace Cheats diff --git a/CS2_External/MenuConfig.hpp b/CS2_External/MenuConfig.hpp index b4bf2ab..d350759 100644 --- a/CS2_External/MenuConfig.hpp +++ b/CS2_External/MenuConfig.hpp @@ -10,6 +10,7 @@ namespace MenuConfig inline bool ShowWeaponESP = true; inline bool ShowEyeRay = true; inline bool ShowPlayerName = true; + inline bool SpectateEsp = false; inline bool ShowAimFovRange = true; inline ImColor AimFovRangeColor = ImColor(230, 230, 230, 255); diff --git a/CS2_External/TriggerBot.cpp b/CS2_External/TriggerBot.cpp deleted file mode 100644 index 4f2fa8a..0000000 --- a/CS2_External/TriggerBot.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "TriggerBot.h" - -void TriggerBot::Run(const CEntity& LocalEntity) -{ - DWORD uHandle = 0; - if (!ProcessMgr.ReadMemory(LocalEntity.Pawn.Address + Offset::Pawn.iIDEntIndex, uHandle)) - return; - if (uHandle == -1) - return; - - DWORD64 ListEntry = 0; - ListEntry = ProcessMgr.TraceAddress(gGame.GetEntityListAddress(), { 0x8 * (uHandle >> 9) + 0x10,0x0 }); - if (ListEntry == 0) - return; - - DWORD64 PawnAddress = 0; - if (!ProcessMgr.ReadMemory(ListEntry + 0x78 * (uHandle & 0x1FF), PawnAddress)) - return; - - CEntity Entity; - if (!Entity.UpdatePawn(PawnAddress)) - return; - - bool AllowShoot = false; - - if (MenuConfig::TeamCheck) - AllowShoot = LocalEntity.Pawn.TeamID != Entity.Pawn.TeamID && Entity.Pawn.Health > 0; - else - AllowShoot = Entity.Pawn.Health > 0; - - if (AllowShoot) - { - static std::chrono::time_point LastTimePoint = std::chrono::steady_clock::now(); - auto CurTimePoint = std::chrono::steady_clock::now(); - if (CurTimePoint - LastTimePoint >= std::chrono::milliseconds(TriggerDelay)) - { - mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); - mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); - LastTimePoint = CurTimePoint; - } - } -} \ No newline at end of file diff --git a/CS2_External/TriggerBot.h b/CS2_External/TriggerBot.h deleted file mode 100644 index 61bae7e..0000000 --- a/CS2_External/TriggerBot.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "Game.h" -#include "Entity.h" -#include "MenuConfig.hpp" -#include - -namespace TriggerBot -{ - inline DWORD TriggerDelay = 90; // ms - inline int HotKey = VK_LMENU; - inline std::vector HotKeyList{VK_LMENU, VK_RBUTTON, VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_LSHIFT, VK_LCONTROL}; - - inline void SetHotKey(int Index) - { - HotKey = HotKeyList.at(Index); - } - - // Triggerbot - void Run(const CEntity& LocalEntity); -} \ No newline at end of file diff --git a/CS2_External/TriggerBot.hpp b/CS2_External/TriggerBot.hpp new file mode 100644 index 0000000..5772771 --- /dev/null +++ b/CS2_External/TriggerBot.hpp @@ -0,0 +1,59 @@ +#pragma once +#include "Game.h" +#include "Entity.h" +#include "MenuConfig.hpp" +#include + +namespace TriggerBot +{ + inline DWORD TriggerDelay = 90; // ms + inline int HotKey = VK_LMENU; + inline std::vector HotKeyList{ VK_LMENU, VK_RBUTTON, VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_LSHIFT, VK_LCONTROL }; + + inline void SetHotKey(int Index) + { + HotKey = HotKeyList.at(Index); + } + + inline void Run(const CEntity& LocalEntity) + { + DWORD uHandle = 0; + if (!ProcessMgr.ReadMemory(LocalEntity.Pawn.Address + Offset::Pawn.iIDEntIndex, uHandle)) + return; + if (uHandle == -1) + return; + + DWORD64 ListEntry = 0; + ListEntry = ProcessMgr.TraceAddress(gGame.GetEntityListAddress(), { 0x8 * (uHandle >> 9) + 0x10,0x0 }); + if (ListEntry == 0) + return; + + DWORD64 PawnAddress = 0; + if (!ProcessMgr.ReadMemory(ListEntry + 0x78 * (uHandle & 0x1FF), PawnAddress)) + return; + + CEntity Entity; + if (!Entity.UpdatePawn(PawnAddress)) + return; + + bool AllowShoot = false; + + if (MenuConfig::TeamCheck) + AllowShoot = LocalEntity.Pawn.TeamID != Entity.Pawn.TeamID && Entity.Pawn.Health > 0; + else + AllowShoot = Entity.Pawn.Health > 0; + + if (AllowShoot) + { + static std::chrono::time_point LastTimePoint = std::chrono::steady_clock::now(); + auto CurTimePoint = std::chrono::steady_clock::now(); + if (CurTimePoint - LastTimePoint >= std::chrono::milliseconds(TriggerDelay)) + { + mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); + mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); + LastTimePoint = CurTimePoint; + } + } + } + +} \ No newline at end of file diff --git a/CS2_External/Utils/ConfigMenu.cpp b/CS2_External/Utils/ConfigMenu.cpp index 099baae..2955e10 100644 --- a/CS2_External/Utils/ConfigMenu.cpp +++ b/CS2_External/Utils/ConfigMenu.cpp @@ -1,7 +1,7 @@ #include "ConfigMenu.hpp" #include "../MenuConfig.hpp" #include "ConfigSaver.hpp" -#include "../TriggerBot.h" +#include "../TriggerBot.hpp" #include "../AimBot.hpp" #include #include @@ -71,9 +71,21 @@ namespace ConfigMenu { ImGui::SameLine(); if (ImGui::Button("Save Selected") && selectedConfig >= 0 && selectedConfig < configFiles.size()) + ImGui::OpenPopup("##reallySave"); + + if (ImGui::BeginPopup("##reallySave")) { - std::string selectedConfigFile = configFiles[selectedConfig]; - MyConfigSaver::SaveConfig(selectedConfigFile); + ImGui::TextUnformatted("Are you sure?"); + if (ImGui::Button("No", { 45.0f, 0.0f })) + ImGui::CloseCurrentPopup(); + ImGui::SameLine(); + if (ImGui::Button("Yes", { 45.0f, 0.0f })) + { + std::string selectedConfigFile = configFiles[selectedConfig]; + MyConfigSaver::SaveConfig(selectedConfigFile); + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); } ImGui::Separator(); @@ -139,6 +151,7 @@ namespace ConfigMenu { void ResetToDefault() { MenuConfig::ShowBoneESP = true; + MenuConfig::SpectateEsp = false; MenuConfig::ShowBoxESP = true; MenuConfig::ShowHealthBar = true; MenuConfig::ShowWeaponESP = true; @@ -170,7 +183,7 @@ namespace ConfigMenu { MenuConfig::FovLineSize = 60.0f; TriggerBot::TriggerDelay = 90; AimControl::RCSBullet = 1; - TriggerBot::HotKey = VK_LMENU; + MenuConfig::TriggerHotKey = 0; AimControl::RCSScale = ImVec2(1.2f, 1.4f); MenuConfig::FovLineColor = ImVec4(55, 55, 55, 220); MenuConfig::LineToEnemyColor = ImVec4(255, 255, 255, 220); diff --git a/CS2_External/Utils/ConfigSaver.cpp b/CS2_External/Utils/ConfigSaver.cpp index 32ebca5..e58a108 100644 --- a/CS2_External/Utils/ConfigSaver.cpp +++ b/CS2_External/Utils/ConfigSaver.cpp @@ -4,7 +4,7 @@ #include #include "ConfigSaver.hpp" #include "../MenuConfig.hpp" -#include "../TriggerBot.h" +#include "../TriggerBot.hpp" #include "../AimBot.hpp" #include #include @@ -36,6 +36,7 @@ namespace MyConfigSaver { // Example: Save global settings to the file configFile << "ShowBoneESP " << MenuConfig::ShowBoneESP << std::endl; configFile << "VisibleEsp " << MenuConfig::VisibleEsp << std::endl; + configFile << "SpectateEsp " << MenuConfig::SpectateEsp << std::endl; configFile << "TriggerDelay " << TriggerBot::TriggerDelay << std::endl; configFile << "ShowBoxESP " << MenuConfig::ShowBoxESP << std::endl; configFile << "TriggerHotKey " << MenuConfig::TriggerHotKey << std::endl; @@ -117,6 +118,7 @@ namespace MyConfigSaver { if (iss >> key) { if (key == "ShowBoneESP") iss >> MenuConfig::ShowBoneESP; else if (key == "VisibleEsp") iss >> MenuConfig::VisibleEsp; + else if (key == "SpectateEsp") iss >> MenuConfig::SpectateEsp; else if (key == "TriggerDelay") iss >> TriggerBot::TriggerDelay; else if (key == "ShowBoxESP") iss >> MenuConfig::ShowBoxESP; else if (key == "TriggerHotKey") iss >> MenuConfig::TriggerHotKey; diff --git a/CS2_External/main.cpp b/CS2_External/main.cpp index 48269fa..0b6b529 100644 --- a/CS2_External/main.cpp +++ b/CS2_External/main.cpp @@ -4,6 +4,13 @@ #include #include #include +#include + +#define RESET "\033[0m" +#define RED "\033[31m" +#define GREEN "\033[32m" +#define YELLOW "\033[33m" +#define BLUE "\033[34m" int main() { @@ -53,18 +60,17 @@ int main() goto END; } - std::cout << "[Game] Pid:" << ProcessMgr.ProcessID << std::endl; - std::cout << "[Game] Client:" << gGame.GetClientDLLAddress() << std::endl; + std::cout << "[Pid]:" << ProcessMgr.ProcessID << std::endl; + std::cout << "[Client]:" << gGame.GetClientDLLAddress() << std::endl; - std::cout << "Offset:" << std::endl; - std::cout << "--EntityList:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::EntityList << std::endl; - std::cout << "--Matrix:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::Matrix << std::endl; - std::cout << "--LocalPlayerController:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::LocalPlayerController << std::endl; - std::cout << "--ViewAngles:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::ViewAngle << std::endl; - std::cout << "--LocalPlayerPawn:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::LocalPlayerPawn << std::endl; - std::cout << "--ForceJump:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::ForceJump << std::endl; + std::cout << "[EntityList]:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::EntityList << std::endl; + std::cout << "[Matrix]:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::Matrix << std::endl; + std::cout << "[LocalPlayerController]:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::LocalPlayerController << std::endl; + std::cout << "[ViewAngles]:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::ViewAngle << std::endl; + std::cout << "[LocalPlayerPawn]:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::LocalPlayerPawn << std::endl; + std::cout << "[ForceJump]:" << std::setiosflags(std::ios::uppercase) << std::hex << Offset::ForceJump << std::endl; - std::cout << "Runing..." << std::endl; + std::cout << "Running..." << std::endl; try {