Hello everyone, can someone please help with the esp? It doesn't want to work at all, I have suspicion that the getnodetransformation is broken which is causing the esp to fail.
Code:
void DX::DrawESP2D() {
Game& g_CF = Game::get();
if (!g_CF.CLT_SHELL || !g_CF.InGame() || !espOn) return;
BYTE* curAddr = (BYTE*)(g_CF.CLT_SHELL + offs::ENT_BEGIN);
for (int i = 0; i < 16; i++) {
Player curP = *(Player*)curAddr;
if (curP.info.health) {
D3DXVECTOR3 ptH = D3DXVECTOR3(curP.model->posH.x, curP.model->posH.y, curP.model->posH.z);
D3DXVECTOR3 ptF = D3DXVECTOR3(curP.model->posF.x, curP.model->posF.y, curP.model->posF.z);
if (w2s(&ptH) && w2s(&ptF)) {
vec2 top, bot;
top.x = ptH.x;
top.y = ptH.y;
bot.x = ptF.x;
bot.y = ptF.y;
if (curP.info.team == 1)
DrawBox2D(top, bot, 2, D3DCOLOR_ARGB(255, 0, 0, 255));
else
DrawBox2D(top, bot, 2, D3DCOLOR_ARGB(255, 220, 170, 40));
HXDrawText(curP.info.name, bot.x, bot.y - 12, D3DCOLOR_ARGB(255, 255, 255, 255));
HXDrawText(std::to_string(curP.info.health).c_str(), top.x, top.y + 4, D3DCOLOR_ARGB(255, 255, 255, 255));
}
}
curAddr += offs::ENT_SIZE;
}
}
Code:
void Game::GetBonePosition(PlayerModel* obj, uint32_t idx, LTransform* tfm) {
pLTModel->GetNodeTransform(obj, idx, tfm, true);
}
Player* Game::GetPlayerByIndex(int i) {
return (Player*)(CLT_SHELL + offs::ENT_BEGIN + (i * offs::ENT_SIZE));
}
class CLTModel
{
public:
uint32_t GetNodeTransform(PlayerModel* hObj, uint32_t hNode, LTransform* transform, bool bWorldSpace)
{
typedef uint32_t(__thiscall* oGetNodeTransform)(void*, PlayerModel*, uint32_t, LTransform*, bool);
return GetVFn<oGetNodeTransform>(this, 15)(this, hObj, hNode, transform, bWorldSpace);
}
};
template< class type > type GetVFn(PVOID base, SIZE_T index)
{
DWORD64* vtablefunc = *(DWORD64**)base;
return (type)(vtablefunc[index]);
}
void DX::DrawLine(vec2 start, vec2 end, int thickness, D3DCOLOR color) {
if (!DXLINE)
D3DXCreateLine(m_pDevice, &DXLINE);
D3DXVECTOR2 Line[2];
Line[0] = D3DXVECTOR2(start.x, start.y);
Line[1] = D3DXVECTOR2(end.x, end.y);
DXLINE->SetWidth(thickness);
DXLINE->Draw(Line, 2, color);
}
void DX::DrawBox2D(vec2 top, vec2 bot, int thickness, D3DCOLOR color) {
int height = abs(top.y - bot.y);
vec2 tl, tr;
tl.x = top.x - height / 4;
tr.x = top.x + height / 4;
tl.y = tr.y = top.y;
vec2 bl, br;
bl.x = bot.x - height / 4;
br.x = bot.x + height / 4;
bl.y = br.y = bot.y;
DrawLine(tl, tr, thickness, color);
DrawLine(bl, br, thickness, color);
DrawLine(tl, bl, thickness, color);
DrawLine(tr, br, thickness, color);
}
struct PlayerModel {
char unk0[8];
Vector3 posF;
Vector3 posH;
};
struct PlayerInfo {
__int8 clientID;
__int8 team;
char name[12];
char unk0[46];
__int32 health;
};
struct Player {
PlayerModel* model;
PlayerInfo info;
};
struct LTransform {
Vector3 m_Vec;
char unk[2048];
};
The offsets I used:
const DWORD64 LT_SHELL = 0x1E39DD8;
const DWORD64 LT_MODELCLIENT_PTR = 0x1E39708;
const DWORD64 LOCAL_ENT = 0x298;
const DWORD64 ENT_SIZE = 0xD98;
const DWORD64 ENT_BEGIN = 0x289;
Much appreciated for the help.