Emektar Üye
C++:
#include <Windows.h>
DWORD gameModule;
DWORD localPlayer;
DWORD localPlayerAddy = 0xD3ED14;
DWORD vectorOrigin = 0x138;
DWORD entityList = 0x4D533AC;
DWORD viewMatrix = 0x4D44CC4;
DWORD boneMatrix = 0x26A8;
DWORD dormat = 0xED;
DWORD team = 0xF4;
DWORD healthOffset = 0x100;
HWND hwndCSGO;
HBRUSH Brush;
HDC hdcCSGO;
float Matrix[16];
struct Vec3
{
float x, y, z;
};
struct Vec4
{
float x, y, z, w;
};
struct Vec2
{
float x, y;
};
void DrawFilledRect(int x, int y, int w, int h)
{
RECT rect = { x, y, x + w, y + h };
FillRect(hdcCSGO, &rect, Brush);
}
void DrawBorderBox(int x, int y, int w, int h, int thickness)
{
DrawFilledRect(x, y, w, thickness);
DrawFilledRect(x, y, thickness, h);
DrawFilledRect((x + w), y, thickness, h);
DrawFilledRect(x, y + h, w + thickness, thickness);
}
bool WorldToScreen(Vec3 pos, Vec2 &screen, float matrix[16], int windowWidth, int windowHeight)
{
Vec4 clipCoords;
clipCoords.x = pos.x*matrix[0] + pos.y*matrix[1] + pos.z*matrix[2] + matrix[3];
clipCoords.y = pos.x*matrix[4] + pos.y*matrix[5] + pos.z*matrix[6] + matrix[7];
clipCoords.z = pos.x*matrix[8] + pos.y*matrix[9] + pos.z*matrix[10] + matrix[11];
clipCoords.w = pos.x*matrix[12] + pos.y*matrix[13] + pos.z*matrix[14] + matrix[15];
if (clipCoords.w < 0.1f)
return false;
Vec3 NDC;
NDC.x = clipCoords.x / clipCoords.w;
NDC.y = clipCoords.y / clipCoords.w;
NDC.z = clipCoords.z / clipCoords.w;
screen.x = (windowWidth / 2 * NDC.x) + (NDC.x + windowWidth / 2);
screen.y = -(windowHeight / 2 * NDC.y) + (NDC.y + windowHeight / 2);
return true;
}
int mainThread()
{
gameModule = (DWORD)GetModuleHandle("client.dll");
hwndCSGO = FindWindow(0, ("Counter-Strike: Global Offensive"));
while (true)
{
Vec2 vScreen;
Vec2 vHead;
memcpy(&Matrix, (PBYTE*)(gameModule + viewMatrix), sizeof(Matrix));
localPlayer = *(DWORD*)(gameModule + localPlayerAddy);
if (localPlayer == NULL)
{
while (localPlayer == NULL)
{
localPlayer = *(DWORD*)(gameModule + localPlayerAddy);
}
}
hdcCSGO = GetDC(hwndCSGO);
int myTeam = *(int*)(localPlayer + team);
for (short int i = 0; i < 64; i++)
{
DWORD entity = *(DWORD*)(gameModule + entityList + i * 0x10);
if (entity != NULL)
{
if (entity != localPlayer)
{
int entityTeam = *(int*)(entity + team);
Vec3 entityLocation = *(Vec3*)(entity + vectorOrigin);
DWORD dwBoneMatrix = *(DWORD*)(entity + boneMatrix);
DWORD health = *(DWORD*)(entity + healthOffset);
int isDormat = *(int*)(entity + dormat);
if (isDormat == 0)
{
if (health > 0)
{
if (WorldToScreen(entityLocation, vScreen, Matrix, 1920, 1080))
{
float enemyHeadX = *(float*)(dwBoneMatrix + 0x30 * 9 + 0x0C);
float enemyHeadY = *(float*)(dwBoneMatrix + 0x30 * 9 + 0x1C);
float enemyHeadZ = *(float*)(dwBoneMatrix + 0x30 * 9 + 0x2C);
Vec3 enemyHeadPos = { enemyHeadX, enemyHeadY, enemyHeadZ };
if (WorldToScreen(enemyHeadPos, vHead, Matrix, 1920, 1080))
{
float head = vHead.y - vScreen.y;
float width = head / 2;
float center = width / -2;
if (myTeam == entityTeam)
{
Brush = CreateSolidBrush(RGB(000, 000, 255));
DrawBorderBox(vScreen.x + center, vScreen.y, width, head - 5, 2);
DeleteObject(Brush);
}
else
{
Brush = CreateSolidBrush(RGB(255, 000, 000));
DrawBorderBox(vScreen.x + center, vScreen.y, width, head - 5, 2);
DeleteObject(Brush);
}
}
}
}
}
}
}
}
Sleep(1);
DeleteObject(hdcCSGO);
}
}
BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)mainThread, NULL, NULL, NULL);
}
return TRUE;
}