Merge pull request #30 from ifBars/main
Add toggleable things: rainbow effect, armor display, distance display, and a somewhat working head tracker
This commit is contained in:
@@ -193,6 +193,8 @@ namespace updater {
|
|||||||
if (data["dwViewMatrix"].is_number())
|
if (data["dwViewMatrix"].is_number())
|
||||||
offsets::dwViewMatrix = data["dwViewMatrix"];
|
offsets::dwViewMatrix = data["dwViewMatrix"];
|
||||||
|
|
||||||
|
if (data["m_iPawnArmor"].is_number())
|
||||||
|
offsets::m_iPawnArmor = data["m_iPawnArmor"];
|
||||||
if (data["dwPawnHealth"].is_number())
|
if (data["dwPawnHealth"].is_number())
|
||||||
offsets::dwPawnHealth = data["dwPawnHealth"];
|
offsets::dwPawnHealth = data["dwPawnHealth"];
|
||||||
if (data["dwPlayerPawn"].is_number())
|
if (data["dwPlayerPawn"].is_number())
|
||||||
@@ -214,6 +216,7 @@ namespace updater {
|
|||||||
data["dwEntityList"] = offsets::dwEntityList;
|
data["dwEntityList"] = offsets::dwEntityList;
|
||||||
data["dwViewMatrix"] = offsets::dwViewMatrix;
|
data["dwViewMatrix"] = offsets::dwViewMatrix;
|
||||||
|
|
||||||
|
data["m_iPawnArmor"] = offsets::m_iPawnArmor;
|
||||||
data["dwPawnHealth"] = offsets::dwPawnHealth;
|
data["dwPawnHealth"] = offsets::dwPawnHealth;
|
||||||
data["dwPlayerPawn"] = offsets::dwPlayerPawn;
|
data["dwPlayerPawn"] = offsets::dwPlayerPawn;
|
||||||
data["dwSanitizedName"] = offsets::dwSanitizedName;
|
data["dwSanitizedName"] = offsets::dwSanitizedName;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace updater {
|
|||||||
inline std::ptrdiff_t dwEntityList = 0x178D8E8;
|
inline std::ptrdiff_t dwEntityList = 0x178D8E8;
|
||||||
inline std::ptrdiff_t dwViewMatrix = 0x187B730;
|
inline std::ptrdiff_t dwViewMatrix = 0x187B730;
|
||||||
|
|
||||||
|
inline std::ptrdiff_t m_iPawnArmor = 0x80c;
|
||||||
inline std::ptrdiff_t dwPawnHealth = 0x808;
|
inline std::ptrdiff_t dwPawnHealth = 0x808;
|
||||||
inline std::ptrdiff_t dwPlayerPawn = 0x7FC;
|
inline std::ptrdiff_t dwPlayerPawn = 0x7FC;
|
||||||
inline std::ptrdiff_t dwSanitizedName = 0x720;
|
inline std::ptrdiff_t dwSanitizedName = 0x720;
|
||||||
|
|||||||
@@ -26,6 +26,16 @@ namespace config {
|
|||||||
automatic_update = data["automatic_update"];
|
automatic_update = data["automatic_update"];
|
||||||
if (data["render_distance"].is_number())
|
if (data["render_distance"].is_number())
|
||||||
render_distance = data["render_distance"];
|
render_distance = data["render_distance"];
|
||||||
|
if (data["show_distance"].is_boolean())
|
||||||
|
show_distance = data["show_distance"];
|
||||||
|
if (data["show_armor"].is_boolean())
|
||||||
|
show_armor = data["show_armor"];
|
||||||
|
if (data["rainbow"].is_boolean())
|
||||||
|
rainbow = data["rainbow"];
|
||||||
|
if (data["rainbow_speed"].is_number())
|
||||||
|
rainbow_speed = data["rainbow_speed"];
|
||||||
|
if (data["head_tracker"].is_boolean())
|
||||||
|
head_tracker = data["head_tracker"];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -36,7 +46,11 @@ namespace config {
|
|||||||
data["team_esp"] = team_esp;
|
data["team_esp"] = team_esp;
|
||||||
data["automatic_update"] = automatic_update;
|
data["automatic_update"] = automatic_update;
|
||||||
data["render_distance"] = render_distance;
|
data["render_distance"] = render_distance;
|
||||||
|
data["show_distance"] = show_distance;
|
||||||
|
data["show_armor"] = show_armor;
|
||||||
|
data["rainbow"] = rainbow;
|
||||||
|
data["rainbow_speed"] = rainbow_speed;
|
||||||
|
data["head_tracker"] = head_tracker;
|
||||||
|
|
||||||
std::ofstream output(file_path);
|
std::ofstream output(file_path);
|
||||||
output << std::setw(4) << data << std::endl;
|
output << std::setw(4) << data << std::endl;
|
||||||
|
|||||||
@@ -14,4 +14,9 @@ namespace config {
|
|||||||
inline bool automatic_update = false;
|
inline bool automatic_update = false;
|
||||||
inline bool team_esp = false;
|
inline bool team_esp = false;
|
||||||
inline float render_distance = -1.f;
|
inline float render_distance = -1.f;
|
||||||
|
inline bool show_distance = false;
|
||||||
|
inline bool show_armor = false;
|
||||||
|
inline bool head_tracker = false;
|
||||||
|
inline bool rainbow = false;
|
||||||
|
inline float rainbow_speed = 0.001f;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <cmath>
|
||||||
#include "../memory/memory.hpp"
|
#include "../memory/memory.hpp"
|
||||||
#include "../classes/globals.hpp"
|
#include "../classes/globals.hpp"
|
||||||
#include "../classes/render.hpp"
|
#include "../classes/render.hpp"
|
||||||
@@ -8,6 +9,14 @@ namespace hack {
|
|||||||
std::shared_ptr<pProcess> process;
|
std::shared_ptr<pProcess> process;
|
||||||
ProcessModule base_module;
|
ProcessModule base_module;
|
||||||
|
|
||||||
|
float CalculateDistance(const Vector3& point1, const Vector3& point2) {
|
||||||
|
float dx = point2.x - point1.x;
|
||||||
|
float dy = point2.y - point1.y;
|
||||||
|
float dz = point2.z - point1.z;
|
||||||
|
|
||||||
|
return std::sqrt(dx * dx + dy * dy + dz * dz);
|
||||||
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
const uintptr_t localPlayer = process->read<uintptr_t>(base_module.base + updater::offsets::dwLocalPlayer);
|
const uintptr_t localPlayer = process->read<uintptr_t>(base_module.base + updater::offsets::dwLocalPlayer);
|
||||||
if (!localPlayer)
|
if (!localPlayer)
|
||||||
@@ -38,6 +47,7 @@ namespace hack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int playerHealth = process->read<int>(player + updater::offsets::dwPawnHealth);
|
const int playerHealth = process->read<int>(player + updater::offsets::dwPawnHealth);
|
||||||
|
const int playerArmor = process->read<int>(player + updater::offsets::m_iPawnArmor);
|
||||||
if (playerHealth <= 0 || playerHealth > 100) {
|
if (playerHealth <= 0 || playerHealth > 100) {
|
||||||
playerIndex++;
|
playerIndex++;
|
||||||
continue;
|
continue;
|
||||||
@@ -85,6 +95,8 @@ namespace hack {
|
|||||||
|
|
||||||
const Vector3 origin = process->read<Vector3>(pCSPlayerPawn + updater::offsets::m_vecOrigin);
|
const Vector3 origin = process->read<Vector3>(pCSPlayerPawn + updater::offsets::m_vecOrigin);
|
||||||
const Vector3 head = { origin.x, origin.y, origin.z + 75.f };
|
const Vector3 head = { origin.x, origin.y, origin.z + 75.f };
|
||||||
|
const Vector3 head2 = { origin.x + 10, origin.y + 10, origin.z + 75.f };
|
||||||
|
const Vector3 localOrigin = process->read<Vector3>(localPlayer + updater::offsets::m_vecOrigin);
|
||||||
|
|
||||||
if (config::render_distance != -1 && (localOrigin - origin).length2d() > config::render_distance) {
|
if (config::render_distance != -1 && (localOrigin - origin).length2d() > config::render_distance) {
|
||||||
playerIndex++;
|
playerIndex++;
|
||||||
@@ -97,10 +109,42 @@ namespace hack {
|
|||||||
const float height = screenPos.y - screenHead.y;
|
const float height = screenPos.y - screenHead.y;
|
||||||
const float width = height / 2.4f;
|
const float width = height / 2.4f;
|
||||||
|
|
||||||
|
const float height2 = (screenPos.y - screenHead.y) / 8;
|
||||||
|
const float width2 = (height / 2.4f) / 4;
|
||||||
|
|
||||||
if (screenPos.z >= 0.01f) {
|
if (screenPos.z >= 0.01f) {
|
||||||
const COLORREF boxColor = RGB(175, 75, 75);
|
const COLORREF boxColor = RGB(175, 75, 75);
|
||||||
const COLORREF healthBarColor = RGB(255 - playerHealth, 55 + playerHealth * 2, 75);
|
const COLORREF healthBarColor = RGB(255 - playerHealth, 55 + playerHealth * 2, 75);
|
||||||
|
|
||||||
|
const float pi = 3.14159265358979323846f;
|
||||||
|
|
||||||
|
// Get the current time
|
||||||
|
DWORD currentTime = GetTickCount();
|
||||||
|
|
||||||
|
// Calculate the sinusoidal values for RGB colors
|
||||||
|
float red = (sin(config::rainbow_speed * currentTime + 0) * 127.5f + 127.5f); // 0 phase shift
|
||||||
|
float green = (sin(config::rainbow_speed * currentTime + 2 * pi / 3) * 127.5f + 127.5f); // 2*pi/3 phase shift
|
||||||
|
float blue = (sin(config::rainbow_speed * currentTime + 4 * pi / 3) * 127.5f + 127.5f); // 4*pi/3 phase shift
|
||||||
|
|
||||||
|
// Convert the floating point values to integers for RGB color creation
|
||||||
|
COLORREF rainbowColor = RGB(static_cast<int>(red), static_cast<int>(green), static_cast<int>(blue));
|
||||||
|
|
||||||
|
float distance = CalculateDistance(localOrigin, origin);
|
||||||
|
// Round the distance to the nearest integer
|
||||||
|
int roundedDistance = std::round(distance / 10);
|
||||||
|
|
||||||
|
if (config::rainbow) {
|
||||||
|
render::DrawBorderBox(
|
||||||
|
g::hdcBuffer,
|
||||||
|
screenHead.x - width / 2,
|
||||||
|
screenHead.y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
(localTeam == playerTeam ? rainbowColor : rainbowColor)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
render::DrawBorderBox(
|
render::DrawBorderBox(
|
||||||
g::hdcBuffer,
|
g::hdcBuffer,
|
||||||
screenHead.x - width / 2,
|
screenHead.x - width / 2,
|
||||||
@@ -109,6 +153,7 @@ namespace hack {
|
|||||||
height,
|
height,
|
||||||
(localTeam == playerTeam ? RGB(75, 175, 75) : RGB(175, 75, 75))
|
(localTeam == playerTeam ? RGB(75, 175, 75) : RGB(175, 75, 75))
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render::DrawBorderBox(
|
render::DrawBorderBox(
|
||||||
g::hdcBuffer,
|
g::hdcBuffer,
|
||||||
@@ -123,6 +168,45 @@ namespace hack {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (config::head_tracker)
|
||||||
|
{
|
||||||
|
if (roundedDistance > 35)
|
||||||
|
{
|
||||||
|
render::DrawFilledBox(
|
||||||
|
g::hdcBuffer,
|
||||||
|
screenHead.x - (width2 / 2),
|
||||||
|
(screenHead.y + 10 - (roundedDistance / 80)) - (height2 / 2),
|
||||||
|
width2,
|
||||||
|
height2,
|
||||||
|
rainbowColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (roundedDistance > 5)
|
||||||
|
{
|
||||||
|
render::DrawFilledBox(
|
||||||
|
g::hdcBuffer,
|
||||||
|
screenHead.x - (width2 / 2),
|
||||||
|
screenHead.y + 25 - (height2 / 2),
|
||||||
|
width2,
|
||||||
|
height2,
|
||||||
|
rainbowColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config::rainbow)
|
||||||
|
{
|
||||||
|
render::RenderText(
|
||||||
|
g::hdcBuffer,
|
||||||
|
screenHead.x + (width / 2 + 5),
|
||||||
|
screenHead.y,
|
||||||
|
playerName.c_str(),
|
||||||
|
rainbowColor,
|
||||||
|
10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
render::RenderText(
|
render::RenderText(
|
||||||
g::hdcBuffer,
|
g::hdcBuffer,
|
||||||
screenHead.x + (width / 2 + 5),
|
screenHead.x + (width / 2 + 5),
|
||||||
@@ -131,6 +215,7 @@ namespace hack {
|
|||||||
RGB(75, 75, 175),
|
RGB(75, 75, 175),
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render::RenderText(
|
render::RenderText(
|
||||||
g::hdcBuffer,
|
g::hdcBuffer,
|
||||||
@@ -144,6 +229,48 @@ namespace hack {
|
|||||||
),
|
),
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (config::show_armor)
|
||||||
|
{
|
||||||
|
render::RenderText(
|
||||||
|
g::hdcBuffer,
|
||||||
|
screenHead.x + (width / 2 + 5),
|
||||||
|
screenHead.y + 21,
|
||||||
|
(std::to_string(playerArmor) + "armor").c_str(),
|
||||||
|
RGB(
|
||||||
|
(255 - playerArmor),
|
||||||
|
(55 + playerArmor * 2),
|
||||||
|
75
|
||||||
|
),
|
||||||
|
10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config::show_distance)
|
||||||
|
{
|
||||||
|
if (config::rainbow)
|
||||||
|
{
|
||||||
|
render::RenderText(
|
||||||
|
g::hdcBuffer,
|
||||||
|
screenHead.x + (width / 2 + 5),
|
||||||
|
screenHead.y + 32,
|
||||||
|
(std::to_string(roundedDistance) + "m away").c_str(),
|
||||||
|
rainbowColor,
|
||||||
|
10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
render::RenderText(
|
||||||
|
g::hdcBuffer,
|
||||||
|
screenHead.x + (width / 2 + 5),
|
||||||
|
screenHead.y + 32,
|
||||||
|
(std::to_string(roundedDistance) + "m away").c_str(),
|
||||||
|
RGB(75, 75, 175),
|
||||||
|
10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
playerIndex++;
|
playerIndex++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ int main() {
|
|||||||
//SetActiveWindow(hack::process->hwnd_);
|
//SetActiveWindow(hack::process->hwnd_);
|
||||||
|
|
||||||
#ifndef _UC
|
#ifndef _UC
|
||||||
std::cout << "\n[settings] In Game keybinds:\n\t[F5] enable/disable Team ESP\n\t[F6] enable/disable automatic updates\n\t[fin] Unload esp.\n" << std::endl;
|
std::cout << "\n[settings] In Game keybinds:\n\t[F5] enable/disable Team ESP\n\t[F6] enable/disable automatic updates\n\t[F7] enable/disable rainbow boxes & names\n\t[F8] enable/disable player distances\n\t[F9] enable/disable player armor\n\t[F10] enable/disable player head tracker\n\t[fin] Unload esp.\n" << std::endl;
|
||||||
#else
|
#else
|
||||||
std::cout << "\n[settings] In Game keybinds:\n\t[F5] enable/disable Team ESP\n\t[fin] Unload esp\n" << std::endl;
|
std::cout << "\n[settings] In Game keybinds:\n\t[F5] enable/disable Team ESP\n\t[fin] Unload esp\n" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@@ -152,6 +152,13 @@ int main() {
|
|||||||
#ifndef _UC
|
#ifndef _UC
|
||||||
if (GetAsyncKeyState(VK_F6) & 0x8000) { config::automatic_update = !config::automatic_update; config::save(); Beep(700, 100); }
|
if (GetAsyncKeyState(VK_F6) & 0x8000) { config::automatic_update = !config::automatic_update; config::save(); Beep(700, 100); }
|
||||||
#endif
|
#endif
|
||||||
|
if (GetAsyncKeyState(VK_F7) & 0x8000) { config::rainbow = !config::rainbow; config::save(); Beep(700, 100); };
|
||||||
|
|
||||||
|
if (GetAsyncKeyState(VK_F8) & 0x8000) { config::show_distance = !config::show_distance; config::save(); Beep(700, 100); };
|
||||||
|
|
||||||
|
if (GetAsyncKeyState(VK_F9) & 0x8000) { config::show_armor = !config::show_armor; config::save(); Beep(700, 100); };
|
||||||
|
|
||||||
|
if (GetAsyncKeyState(VK_F10) & 0x8000) { config::head_tracker = !config::head_tracker; config::save(); Beep(700, 100); };
|
||||||
|
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user