Code:
void Aimbot(LPDIRECT3DDEVICE9 pDevice)
{
DWORD inGame = (DWORD)GetModuleHandle("Object.dll");
if (!IsGameReadyForHookPoint() || !inGame) return;
DWORD CShell = (DWORD)GetModuleHandleA(eCShell);
DWORD crossfire = (DWORD)GetModuleHandleA(eCF);
if (crossfire == NULL) return;
int VisibleCheck = hMenuItem[19];
int AimBone = hMenuItem[18];
int AimKey = hMenuItem[17];
int AimMode = hMenuItem[20];
POINT pt;
D3DVIEWPORT9 viewP;
pDevice->GetViewport(&viewP);
float ScreenX = viewP.Width / 2;
float ScreenY = viewP.Height / 2;
pt.x = ScreenX;
pt.y = ScreenY;
if (IsGameReadyForHookPoint() && inGame)
{
DWORD pLTClientShell = *(DWORD*)(CShell + aLTClientShell);
if (pLTClientShell != NULL)
{
CPlayer* Me = GetPlayerByIndex(pLTClientShell, GetMyIndex(pLTClientShell));
if (isValidClient(Me))
{
if (Me->Health > 0 && AimKey > 0)
{
{
int TargetIndex, BONE_ID;
switch (AimBone)
{
case 1: BONE_ID = 6; break;//Head
case 2: BONE_ID = 5; break;//Neck
case 3: BONE_ID = 2; break;//Body
case 4: BONE_ID = 10; break;//LeftHand
case 5: BONE_ID = 17; break;//RightHand
case 6: BONE_ID = 23; break;//FeftFoot
case 7: BONE_ID = 28; break;//RightFoor
default: BONE_ID = 6;//HEAD
}
int iAimAt = -1;
float MaxDistance = 0xFFFFFFF;
for (int i = 0; i < 16; i++)
{
CPlayer* pPlayer = GetPlayerByIndex(pLTClientShell, i);
D3DXVECTOR3 pos = GetBonePosition(pPlayer->Object, 6);
if (!isValidClient(pPlayer) && Me != pPlayer) continue;
if (IsTM(Me, pPlayer)) continue;
if (WorldToScreen(pDevice, &pos))
{
float radiusx = (15 * 5.0f) * (ScreenX / 100.0f);
float radiusy = (15 * 5.0f) * (ScreenY / 100.0f);
float Tmp = NULL;
if (AimMode == 1) { // Get player distance from crosshair
Tmp = GetDistance2(pos.x, pos.y, ScreenX, ScreenY);
}
else if (AimMode == 0) { // Get player distance from player
Tmp = GetDistance2(pos.x, pos.y, ScreenX, ScreenY);
}
//if in fov
if (pos.x >= ScreenX - radiusx && pos.x <= ScreenX + radiusx && pos.y >= ScreenY - radiusy && pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
iAimAt = i;
}
}
}
}
if (iAimAt == -1)
return;
if (iAimAt > -1)
{
CPlayer* Target = GetPlayerByIndex(pLTClientShell, iAimAt);
if (isValidClient(Target))
{
if (Target && Target->Object && Target->Health > 0 && Target != Me)
{
D3DXVECTOR3 AimPos = GetBonePosition(Target->Object, BONE_ID);
if (WorldToScreen(pDevice, &AimPos))
{
float DistX = AimPos.x - ScreenX;
float DistY = AimPos.y - ScreenY;
if (VisibleCheck == 0)
{
{
switch (AimKey)
{
case 1: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 5: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
}
}
}
if (VisibleCheck == 1)
{
if (IsVisible(GetBonePosition(Me->Object, 6), GetBonePosition(Target->Object, BONE_ID)))
{
switch (AimKey)
{
case 1: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 5: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
}
}
}
}
}
}
}
}
}
}
}
}
}
Engine:
Code:
bool IsGameReadyForHookPoint()
{
if (GetModuleHandleA("CShell.dll") != NULL && GetModuleHandleA("ClientFx.fxd") != NULL && GetModuleHandleA("crossfire.exe") != NULL && GetModuleHandleA("d3d9.dll") != NULL && GetModuleHandleA("SndDrv.dll") != NULL)
return true;
return false;
}
bool isValidClient(CPlayer* Clients)
{
if ((Clients != NULL) && (Clients->Health > 0) && (strlen(Clients->Name) > 2) && (Clients->Object != NULL))
return true;
return false;
}
D3DXVECTOR3 GetMidPoint(D3DXVECTOR3 V1, D3DXVECTOR3 V2)
{
return D3DXVECTOR3((V1.x + V2.x) / 2, (V1.y + V2.y) / 2, (V1.z + V2.z) / 2);
}
char GetMyIndex(DWORD pLTCLientShell)
{
if (pLTCLientShell)
{
BYTE clients = *(BYTE*)(pLTCLientShell + dwCPlayerStart);
if (clients < 16)
return *(char*)(pLTCLientShell + clients * dwCPlayerSize + MEOffset);
}
return -1;
}
bool inGame()
{
DWORD CShell = (DWORD)GetModuleHandleA(eCShell);
DWORD pLTClientShell = *(DWORD*)(CShell + aLTClientShell);
CPlayer* player = GetPlayerByIndex(pLTClientShell, GetMyIndex(pLTClientShell));
if ((player != NULL) && (strlen(player->Name) > 2) && (player->Object != NULL))
return true;
return false;
}
bool IsTM(CPlayer* Me, CPlayer* Target)
{
if (Me->Team != Target->Team)
return false;
return true;
}
void GetBonePositionEx(cObject* obj, UINT Bone, _Transform* Trans)
{
DWORD CShell = (DWORD)GetModuleHandleA(eCShell);
DWORD ClientFx = (DWORD)GetModuleHandleA("ClientFx.fxd");
if (!CShell && !ClientFx) return;
DWORD pLTModel = *(DWORD*)(CShell + aLTModel);
__asm
{
MOV ECX, pLTModel
MOV EDX, DWORD PTR DS : [ECX]
MOV EDX, DWORD PTR DS : [EDX + 0x3C]
PUSH 1
PUSH Trans
PUSH Bone
PUSH obj
CALL EDX
}
}
D3DXVECTOR3 GetBonePosition(cObject* obj, UINT Bone)
{
_Transform Trans;
GetBonePositionEx(obj, Bone, &Trans);
return (Trans.Pos);
}
void GetNodePosition(cObject* obj, UINT Bone, D3DXVECTOR3& Out)
{
_Transform Trans;
GetBonePositionEx(obj, Bone, &Trans);
Out = Trans.Pos;
Out.y += 5;
}
float GetDistance(float Xx, float Yy, float xX, float yY)
{
return sqrt((yY - Yy) * (yY - Yy) + (xX - Xx) * (xX - Xx));
}
float CalculateDistance(D3DXVECTOR3 from, D3DXVECTOR3 to)
{
return sqrt((to.x - from.x) * (to.x - from.x) + (to.y - from.y) * (to.y - from.y) + (to.z - from.z) * (to.z - from.z));
}
float CalculateDistance2(LTVector from, LTVector to)
{
return sqrt((to.x - from.x) * (to.x - from.x) + (to.y - from.y) * (to.y - from.y) + (to.z - from.z) * (to.z - from.z));
}
bool WorldToScreen(LPDIRECT3DDEVICE9 pDevice, D3DXVECTOR3* InOut)
{
D3DXVECTOR3 vScreen;
D3DXVECTOR3 PlayerPos(InOut->x, InOut->y, InOut->z);
D3DVIEWPORT9 viewPort = { 0 };
D3DXMATRIX projection, view, world;
pDevice->GetTransform(D3DTS_VIEW, &view);
pDevice->GetTransform(D3DTS_PROJECTION, &projection);
pDevice->GetTransform(D3DTS_WORLD, &world);
pDevice->GetViewport(&viewPort);
D3DXVec3Project(&vScreen, &PlayerPos, &viewPort, &projection, &view, &world);
if (vScreen.z < 1.0f && vScreen.x > 0.0f && vScreen.y > 0.0f && vScreen.x < viewPort.Width && vScreen.y < viewPort.Height)
{
*InOut = vScreen;
return true;
}
return false;
}
Class
Code:
struct cObject
{
public:
char _UnkSpace[4];
D3DXVECTOR3 Body;
D3DXVECTOR3 Foot;
D3DXVECTOR3 Head;
};
class CPlayer
{
public:
char _0x0000[4];
cObject* Object; //0x0004
__int8 ClientID; //0x0008
__int8 Team; //0x0009
char _Name[12]; //0x000A
char _0x0016[2];
cCharacterFX* cCharacterFX; //0x0018
__int32 PlayerSlotTeam; //0x001c
char _0x0020[4];
bool HasC4; //0x0024
char _0x0025[7];
_int32 Rank; //0x002c
char _0x0030[16];
__int8 Health; //0x0040
__int8 kills; //0x0041
__int32 Deaths; //0x0042
char _0x0046[58];
};
struct IntersectQuery
{
D3DXVECTOR3 From; //0x0000
D3DXVECTOR3 To; //0x000C
char _UnkSpace[12]; //SPACE
unsigned int Flags; //0x0024
ObjectFilterFn FilterFn; //0x0028
void* FilterIntersectParam; //0x002C
ObjectFilterFn FilterIntersectFn; //0x0030
void* FilterParam; //0x0034
void* PolyFilterParam; //0x0038
};
about Address and offset i already Every new update I post new addresses
https://www.mpgh.net/forum/showthread.php?t=1523835
and you still lerning c++ for working all that