Начинающий
- Статус
- Оффлайн
- Регистрация
- 26 Дек 2020
- Сообщения
- 31
- Реакции
- 1
C++:
#include "visual.h"
#include <cstdint>
uintptr_t V::client = (uintptr_t)GetModuleHandle("client.dll");
void V::PlayerESP()
{
float(*ViewMatrix)[4][4] = (float(*)[4][4])(client + O::dwViewMatrix);
auto localPawn = *(uintptr_t*)(client + O::dwLocalPlayerPawn);
if (!localPawn)
return;
auto localTeam = *(int*)(client + O::m_iTeamNum);
auto entityList = *(uintptr_t*)(client + O::dwEntityList);
if (!entityList)
return;
for (int i = 0; i < 64; i++) {
uintptr_t list_entry1 = *(uintptr_t*)(entityList + (8 * (i & 0x7FFF) >> 9) + 16);
if (!list_entry1)
continue;
uintptr_t playerController = *(uintptr_t*)(list_entry1 + 120 * (i & 0x1FF));
if (!playerController)
continue;
uintptr_t playerPawn = *(uint32_t*)(playerController + O::m_hPlayerPawn);
if (!playerPawn)
continue;
uintptr_t list_entry2 = *(uintptr_t*)(entityList + 0x8 * ((playerPawn & 0x7FFF) >> 9) + 16);
if (!list_entry2)
continue;
uintptr_t pCSPlayerPawnPtr = *(uintptr_t*)(list_entry2 + 120 * (playerPawn & 0x1FF));
if (!pCSPlayerPawnPtr)
continue;
int health = *(int*)(pCSPlayerPawnPtr + O::m_iHealth);
if (!health || health > 100)
continue;
int team = *(int*)(pCSPlayerPawnPtr + O::m_iTeamNum);
if (team == localTeam)
continue;
Vec3 feetpos = *(Vec3*)(pCSPlayerPawnPtr + O::m_vOldOrigin);
Vec3 headpos = { feetpos.x + 0.0f, feetpos.y + 0.0f, feetpos.z + 65.0f };
Vec2 feet, head;
if (feetpos.WorldToScreen(feet, ViewMatrix) && headpos.WorldToScreen(head, ViewMatrix)) {
float height = (feet.y - head.y) * 1.5f;
float width = height / 1.5f;
float x = feet.x - width / 2;
ImGui::GetBackgroundDrawList()->AddRect({ x, head.y }, { x + width, head.y + height }, ImColor(255, 255, 255));
}
}
}
C++:
#pragma once
#include "math.h"
#include "imgui/imgui.h"
#include <cstddef>
namespace O {
constexpr std::ptrdiff_t dwEntityList = 0x1A157C8;
constexpr std::ptrdiff_t dwLocalPlayerPawn = 0x1869D88;
constexpr std::ptrdiff_t dwViewMatrix = 0x1A80870;
constexpr std::ptrdiff_t m_hPlayerPawn = 0x80C;
constexpr std::ptrdiff_t m_iTeamNum = 0x3E3;
constexpr std::ptrdiff_t m_iHealth = 0x344;
constexpr std::ptrdiff_t m_vOldOrigin = 0x1324;
}
namespace V
{
extern uintptr_t client;
void PlayerESP();
};
C++:
#pragma once
#include <windows.h>
struct Vec2
{
constexpr Vec2(const float x = 0.f, const float y = 0.f) noexcept : x(x), y(y){}
float x, y;
};
struct Vec3
{
constexpr Vec3(const float x = 0.f, const float y = 0.f, const float z = 0.f) noexcept : x(x), y(y), z(z) { }
const bool WorldToScreen(Vec2& out, float(*ViewMatrix)[4][4]);
float x, y, z;
};
C++:
#include "math.h"
const bool Vec3::WorldToScreen(Vec2& out, float(*ViewMatrix)[4][4])
{
const float w = (*ViewMatrix)[3][0] * x + (*ViewMatrix)[3][1] * y + (*ViewMatrix)[3][2] * z + (*ViewMatrix)[3][3];
if (w <= 0.01)
return false;
const float invW = 1.0f / w;
const float screenW = GetSystemMetrics(SM_CXSCREEN);
const float screenH = GetSystemMetrics(SM_CYSCREEN);
out.x = (screenW / 2) * (((*ViewMatrix)[0][0] * x + (*ViewMatrix)[0][1] * y + (*ViewMatrix)[0][2] * z + (*ViewMatrix)[0][3]) * invW * (screenW / 2));
out.y = (screenH / 2) * (((*ViewMatrix)[1][0] * x + (*ViewMatrix)[1][1] * y + (*ViewMatrix)[1][2] * z + (*ViewMatrix)[1][3]) * invW * (screenH / 2));
return true;
}
Последнее редактирование: