Skip to content

Commit

Permalink
added spectate esp
Browse files Browse the repository at this point in the history
  • Loading branch information
Fr0go1 committed Oct 10, 2023
1 parent c058645 commit 26f9944
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 91 deletions.
3 changes: 1 addition & 2 deletions CS2_External/CS2_External.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<ClInclude Include="Render.hpp" />
<ClInclude Include="resource.h" />
<ClInclude Include="Utils\style.hpp" />
<ClInclude Include="TriggerBot.h" />
<ClInclude Include="TriggerBot.hpp" />
<ClInclude Include="Utils\ConfigMenu.hpp" />
<ClInclude Include="Utils\ConfigSaver.hpp" />
<ClInclude Include="Utils\ProcessManager.hpp" />
Expand All @@ -191,7 +191,6 @@
<ClCompile Include="OS-ImGui\OS-ImGui_Base.cpp" />
<ClCompile Include="OS-ImGui\OS-ImGui_External.cpp" />
<ClCompile Include="Radar\Radar.cpp" />
<ClCompile Include="TriggerBot.cpp" />
<ClCompile Include="Cheats.cpp" />
<ClCompile Include="Utils\ConfigMenu.cpp" />
<ClCompile Include="Utils\ConfigSaver.cpp" />
Expand Down
5 changes: 1 addition & 4 deletions CS2_External/CS2_External.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<ClInclude Include="Radar\Radar.h">
<Filter>Cheats\Radar</Filter>
</ClInclude>
<ClInclude Include="TriggerBot.h">
<ClInclude Include="TriggerBot.hpp">
<Filter>Cheats</Filter>
</ClInclude>
<ClInclude Include="Utils\ConfigMenu.hpp">
Expand Down Expand Up @@ -176,9 +176,6 @@
<ClCompile Include="Radar\Radar.cpp">
<Filter>Cheats\Radar</Filter>
</ClCompile>
<ClCompile Include="TriggerBot.cpp">
<Filter>Cheats</Filter>
</ClCompile>
<ClCompile Include="Utils\ConfigMenu.cpp">
<Filter>Utils\ConfigSaver</Filter>
</ClCompile>
Expand Down
26 changes: 19 additions & 7 deletions CS2_External/Cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Utils/ConfigSaver.hpp"
#include "Utils/style.hpp"
#include "font/IconsFontAwesome5.h"
#include "TriggerBot.hpp"
#include "AimBot.hpp"
#include <Windows.h>

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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<DWORD64, Render::HealthBar> HealthBarMap;
Expand Down Expand Up @@ -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);
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion CS2_External/Cheats.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CS2_External/MenuConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
42 changes: 0 additions & 42 deletions CS2_External/TriggerBot.cpp

This file was deleted.

20 changes: 0 additions & 20 deletions CS2_External/TriggerBot.h

This file was deleted.

59 changes: 59 additions & 0 deletions CS2_External/TriggerBot.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#pragma once
#include "Game.h"
#include "Entity.h"
#include "MenuConfig.hpp"
#include <chrono>

namespace TriggerBot
{
inline DWORD TriggerDelay = 90; // ms
inline int HotKey = VK_LMENU;
inline std::vector<int> 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<DWORD>(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<DWORD64>(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;
}
}
}

}
21 changes: 17 additions & 4 deletions CS2_External/Utils/ConfigMenu.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "ConfigMenu.hpp"
#include "../MenuConfig.hpp"
#include "ConfigSaver.hpp"
#include "../TriggerBot.h"
#include "../TriggerBot.hpp"
#include "../AimBot.hpp"
#include <filesystem>
#include <Shlobj.h>
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -139,6 +151,7 @@ namespace ConfigMenu {

void ResetToDefault() {
MenuConfig::ShowBoneESP = true;
MenuConfig::SpectateEsp = false;
MenuConfig::ShowBoxESP = true;
MenuConfig::ShowHealthBar = true;
MenuConfig::ShowWeaponESP = true;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion CS2_External/Utils/ConfigSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <sstream>
#include "ConfigSaver.hpp"
#include "../MenuConfig.hpp"
#include "../TriggerBot.h"
#include "../TriggerBot.hpp"
#include "../AimBot.hpp"
#include <Shlobj.h>
#include <filesystem>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
26 changes: 16 additions & 10 deletions CS2_External/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
#include <iomanip>
#include <Shlobj.h>
#include <filesystem>
#include <Windows.h>

#define RESET "\033[0m"
#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define BLUE "\033[34m"

int main()
{
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 26f9944

Please sign in to comment.