Originally Posted by
TheGe2k
Hi guys, I just need some help what is mistake i did with that ? ESP AI doesn't work...
Code:
void CObjectType::ESPZA(LPDIRECT3DDEVICE9 pDevice)
{
auto ptr = *(DWORD*)(ObjectMgr_Addr);
if (isBadPointer(ptr)) return;
auto ObjCount = *(DWORD*)(ptr + 0xA18);
if (ObjCount < 0) return;
POINT pt;
D3DVIEWPORT9 viewP;
pDevice->GetViewport(&viewP);
float ScreenX = viewP.Width;
float ScreenY = viewP.Height;
D3DCOLOR ESP_Color = Red;
for (uint16_t i = 0; i < ObjCount; i++)
{
auto ZombieObj = GetInstancesByIndex(i);
D3DXVECTOR3 tBody = ZombieObj->GetObjectType()->GetBonePosition(6);
D3DXVECTOR3 Foot = ZombieObj->GetObjectType()->GetBonePosition(28);
if (ZombieObj != NULL)
{
if (ZombieObj->GetObjectType()->GetAIClient() != NULL)
{
if (ZombieObj->GetObjectType()->GetAIClient()->AIObject != NULL)
{
if (ZombieObj->GetObjectType()->GetAIClient()->AIHealth > 0)
{
if (Engine->WorldToScreen(pDevice, &tBody))
{
if (Bone)
{
this->DrawPlayer(pDevice, Red);
}
if (Line)
{
POINT pt;
D3DVIEWPORT9 viewP;
pDevice->GetViewport(&viewP);
float ScreenX = viewP.Width;
float ScreenY = viewP.Height;
DWORD ScreenCenterX = viewP.Width / 2;
DWORD ScreenCenterY = viewP.Height / 2;
int LinesComeFrom_X = ScreenCenterX;
int LinesComeFrom_Y = ScreenCenterX;
DirectX->DrawLine(pDevice, LinesComeFrom_X, LinesComeFrom_Y, tBody.x, tBody.y, Red);
}
}
}
}
}
}
}
}
I think mistake in ObjectCount maybe it's wrong because when i tried to Log code to find mistake it's shows nothing, i tried to get latest offset by reclass but i didn't find offset counting AIs
Thanks ALL .
Code:
class WorldTreeHelper : public IBase
{
public:
};
class ObjectMgr : public WorldTreeHelper, public singleton<ObjectMgr>
{
public:
ObjectMgr();
public:
//(Client and Server)
List* GetObjectList(int id) { return (List*)((uintptr_t)this + 0x264 + (sizeof(List) * id)); }
};
Code:
class CClientMgr : public IBase, public singleton<CClientMgr>
{
public:
CClientMgr();
public:
// The object manager. This holds the lists of all the objects (which aren't
// necessarily always in the world tree).
ObjectMgr* m_ObjectMgr() { return (ObjectMgr*)((uintptr_t)this + 0x0000); }
CNetMgr* m_NetMgr() { return this->GetValue<CNetMgr*>(0x03B8); };
ClientShell* m_pCurShell() { return this->GetValue<ClientShell*>(0x0B58); };
public:
//55 8B EC 51 89 4D FC 0F B7 45 08 8B 4D FC 3B 81 ?? ?? ?? ?? 73 29 0F B7 55 08 8B 45 FC 8B 88 ?? ?? ?? ?? 0F B6 14 D1
ModelInstance* FindObjectClient(uint16 id) { return reinterpret_cast<ModelInstance * (__thiscall*)(void*, uint16)>(m_FindObjectClient)(this, id); };
int m_ObjectMapSize() { return g_pLTBase->GetObjectElements(); };
//int ILTCSBase::GetObjectElements()
//{
// return GetVFunc<int(*)(void*)>(this, 181)(this);
//}
};
Code:
class CServerMgr : public CNetHandler, public singleton<CServerMgr>
{
public:
CServerMgr();
// The object manager. This holds the lists of all the objects (which aren't
// necessarily always in the world tree).
ObjectMgr* m_ObjectMgr() { return (ObjectMgr*)((uintptr_t)this + 0x019C); }
CNetMgr* m_NetMgr() { return this->GetValue<CNetMgr*>(0x0538); };
public:
//55 8B EC 51 A1 ?? ?? ?? ?? 8B 88 ?? ?? 00 00 89 4D FC ?? ?? ?? ?? ?? ??
static ModelInstance* FindObjectServer(uint16 id) { return reinterpret_cast<ModelInstance * (__cdecl*)(uint16)>(m_FindObjectServer)(id); };
int m_ObjectMapSize() { return this->GetValue<int>(0x73C); };
};
Client Objects Usage
Code:
Method 1
Code:
55 8B EC 8B 45 08 50 8B 0D ? ? ? ? ? ? ? ? E8 ? ? ? ? ? ? ? ? 5D C3
auto sfxlist = g_pClientMgr->m_ObjectMgr()->GetObjectList(OT_MODEL);
if (sfxlist == NULL)
return;
Link* pListHead = &sfxlist->m_Head;
if (pListHead == NULL)
return;
for (auto pCur = pListHead->m_pNext; pCur != pListHead; pCur = pCur->m_pNext)
{
if (pCur == NULL)
break;
auto pModelInst = (ModelInstance*)pCur->m_pData;
if (pModelInst == NULL)
continue;
//pModelInst <- Model Information
}
Method 2
Code:
for (int x = 0; x < g_pClientMgr->m_ObjectMapSize(); x++)
{
auto pModelInst = g_pClientMgr->FindObjectClient(x);
if (pModelInst == NULL)
continue;
//pModelInst <- Model Information
}
Server Objects Usage
Code:
Method 1
Code:
55 8B EC 83 EC 0C C7 45 ? ? ? ? ? ? ? ? ? ? 8B 4D 08 E8 ? ? ? ? ? ? ? ? 66 89 45 FC 0F B7 45 FC 3D ? ? ? ? ? ? ? ? 74 47 8B 0D ? ? ? ? ? ? ? ? 8B 91 ? ? ? ? ? ? ? ? 89 55 F4 0F B7 45 FC
auto sfxlist = g_pServerMgr->m_ObjectMgr()->GetObjectList(OT_MODEL);
if (sfxlist == NULL)
return;
Link* pListHead = &sfxlist->m_Head;
if (pListHead == NULL)
return;
for (auto pCur = pListHead->m_pNext; pCur != pListHead; pCur = pCur->m_pNext)
{
if (pCur == NULL)
break;
auto pModelInst = (ModelInstance*)pCur->m_pData;
if (pModelInst == NULL)
continue;
//pModelInst <- Model Information
}
Method 2
Code:
for (int x = 0; x < g_pServerMgr->m_ObjectMapSize(); x++)
{
auto pModelInst = g_pServerMgr->FindObjectServer(x);
if (pModelInst == NULL)
continue;
//pModelInst <- Model Information
}
Code:
class Link;
class CheapLink
{
public:
Link* m_pPrev, * m_pNext;
};
class Link : public CheapLink
{
public:
void* m_pData;
};
class List
{
public:
unsigned long m_nElements;
Link m_Head;
};
/*!
Different object types. Some can only be created on the client.
*/
enum
{
//! Invisible object. Note, client's aren't told about
OT_NORMAL = 0,
//! Model object.
OT_MODEL = 1,
//! WorldModel.
OT_WORLDMODEL = 2,
//! Sprite.
OT_SPRITE = 3,
//! Dynamic light.
OT_LIGHT = 4,
//! Camera.
OT_CAMERA = 5,
//! Particle system.
OT_PARTICLESYSTEM = 6,
//! Poly grid.
OT_POLYGRID = 7,
//! Line system.
OT_LINESYSTEM = 8,
//! Container.
OT_CONTAINER = 9,
//! Canvas (game code renders it).
OT_CANVAS = 10,
//! Volume effect.
OT_VOLUMEEFFECT = 11,
/*!
NOTE: the high bit of the object type is reserved
for the engine's networking.
ALSO NOTE: The networking assumes there are < 16 object types!
*/
NUM_OBJECTTYPES = 12,
};