1) Внедряем hDirectX header class и ProcMem, нам нужен ProcMem для того, чтобы прочесть память; Вызываем процесс
2) Внедряем дефины, объясню чуть пожже.
Код
#define LocalPlayer 0x00000 //LocalPlayer offset
[color=#00b3b3]#define EntityList 0x00000 // EntityList offset
[color=#00b3b3]#define ViewMatrix 0x00000 // ViewMatrix offset
[color=#00b3b3]#define iHealth 0x00000 // iHealth offset [Always: 0xFC]
[color=#00b3b3]#define iTeamNum 0x00000 // Team offset [Always: 0xF0]
[color=#00b3b3]#define ArmorValue 0x00000 // Armor Value [Cuz cool?]
[color=#00b3b3]#define IsDormant 0x00000 // Is dormant or na? [Always: 0xE9]
[color=#00b3b3]#define vecOrigin 0x00000 // vecOrigin offset [Always: 0x134];
3) Создаем структуру; Не забываем сделать Engine, Client DWORDS, Our window RECT
Код
[color=#00b3b3][COLOR=#b3b300]DWORD Client;
DWROD Engine;
RECT OurWindow;
[COLOR=rgb(0, 179, 179)]
4) Создаем структуру для наших союзников и врагов
Код
[COLOR=#b3b300]struct SimplePlayer_t {
uintptr_t pLocal;
int Health;
int TeamNum;
int Dormant;
int ArmorValueInt;
float Posi[3];
void ReadInfo() {
pLocal = Mem.Read<uintptr_t>(Client + LocalPlayer);
Health = Mem.Read<int>(pLocal + iHealth);
TeamNum = Mem.Read<int>(pLocal + iTeamNum);
ArmorValue = Mem.Read<int>(pLocal + ArmorValue);
Dormant = Mem.Read<int>(pLocal + IsDormant);
Posi[0] = Mem.Read<float>(pLocal + vecOrigin);
Posi[1] = Mem.Read<float>(pLocal + vecOrigin + 0x4);
Posi[2] = Mem.Read<float>(pLocal + vecOrigin + 0x8);
}
}SimplePlayer;[/COLOR
4) Теперь добавим vMatrix Struct, перед тем как перейти к самому главному
Код
typedef struct {
float flMatrix[4][4];
}WorldToScreenMatrix_t;
5) А теперь самое интересное, ведь до этого было несложно). Готовы?
Код
struct EnemyPlayer_t {
uintptr_t CEntityList;
int Health;
int TeamNum;
int Dormant;
int ArmorValueInt;
float Posi[3];
void ReadInfo(int _pInfo) {
CEntityList = Mem.Read<uintptr_t>(Client + EntityList + (_pInfo * 0x10));
Health = Mem.Read<int>(CEntityList + iHealth);
TeamNum = Mem.Read<int>(CEntityList + iTeamNum);
ArmorValue = Mem.Read<int>(CEntityList + ArmorValue);
Dormant = Mem.Read<int>(CEntityList + IsDormant);
Posi[0] = Mem.Read<float>(CEntityList + vecOrigin);
Posi[1] = Mem.Read<float>(CEntityList + vecOrigin + 0x4);
Posi[2] = Mem.Read<float>(CEntityList + vecOrigin + 0x8);
}
}EnemyPlayer[32];
6) Позже мы будем читать наших врагов по ReadInfo function. Самое время для The WorldToScreen Part. Это самая сложная функция.
Код
bool WorldToScreenM(float * from, float * to) {
WorldToScreenMatrix_t WorldToScreenMatrix;
WorldToScreenMatrix = Mem.Read<WorldToScreenMatrix_t>(Client + ViewMatrix);
float w = 0.0f;
to[0] = WorldToScreenMatrix.flMatrix[0][0] * from[0] + WorldToScreenMatrix.flMatrix[0][1] * from[1] + WorldToScreenMatrix.flMatrix[0][2] * from[2] + WorldToScreenMatrix.flMatrix[0][3];
to[1] = WorldToScreenMatrix.flMatrix[1][0] * from[0] + WorldToScreenMatrix.flMatrix[1][1] * from[1] + WorldToScreenMatrix.flMatrix[1][2] * from[2] + WorldToScreenMatrix.flMatrix[1][3];
w = WorldToScreenMatrix.flMatrix[3][0] * from[0] + WorldToScreenMatrix.flMatrix[3][1] * from[1] + WorldToScreenMatrix.flMatrix[3][2] * from[2] + WorldToScreenMatrix.flMatrix[3][3];
if (w < 0.01f)
return false;
float invw = 1.0f / w;
to[0] *= invw;
to[1] *= invw;
int width = (int)(OurWindow.right - OurWindow.left);
int height = (int)(OurWindow.bottom - OurWindow.top);
float x = width / 2;
float y = height / 2;
x += 0.5 * to[0] * width + 0.5;
y -= 0.5 * to[1] * height + 0.5;
to[0] = x + OurWindow.left; // Our Window
to[1] = y + OurWindow.top;
return true;
}
7) Теперь, когда самое главное позади, возвращаемся к cDirectX.cpp
Код
#include "pEspIncludes.h" // include cfg.
8)Теперь читаем Engine.dll и Client.dll(в csgo)
Код
bool xOnce = false;
if(!xOnce) {
Client = Mem.Module("client.dll");
Engine = Mem.Module("engine.dll");
xOnce = true;
}
9) После того, как мы прочитали игроков на сервере добавляем их в ReadInfo.
Код
GetWindowRect(FindWindowA(NULL, "Counter-Strike: Global Offensive"), &OurWindow); // Find Our Window
SimplePlayer.ReadInfo(); // Read Our Player Informations.
for(int i = 0; i < 32; i++) {
//ESP Codenz.
}
EnemyPlayer[i].ReadInfo(i);
if (EnemyPlayer[i].TeamNum != 2 && EnemyPlayer[i].TeamNum != 3) //ESP
if(EnemyPlayer[i].Dormant)
continue; // Boxes
if(EnemyPlayer[i].Health < 1)
continue;
float W2SP[3];
if(WorldToScreenM(EnemyPlayer[i].Posi, W2SP)) {
// SnapLine code here.
}
DrawLine(GetSystemMetrics(SM_CXSCREEN) / 2, GetSystemMetrics(SM_CYSCREEN), W2SP[0], W2SP[1], your colors..);
int width = abs(W2SP[1] - W2SPHead[1]);
int height = width / 2