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;
// default: if (GetAsyncKeyState(VK_LBUTTON)) 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;
// default: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
}
}
}
}
}
}
}
}
}
}
}
}
}
#define GetPlayerByIndex(LTClientShell, dwID) (CPlayer*)(LTClientShell + (dwID * dwCPlayerSize) + dwCPlayerStart)
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;
}
//b3bosa 3lia mini
bool qisValidClient(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);
}
// test AI MODE
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;
}


#include "Aimbot.h"
#define PI3 6.283185307179586
void cAimbot::StartAimFov(LPDIRECT3DDEVICE9 pDevice)
{
if (!Engine->IsGameReadyForHook()) return;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
switch (Var_AimFov)
{
case 1: AimFirstView = 2.50f; break; // 10.0f
case 2: AimFirstView = 6.50f; break; // 30.0f
case 3: AimFirstView = 9.50f; break; // 45.0f
case 4: AimFirstView = 12.50f; break; // 60.0f
case 5: AimFirstView = 16.50f; break; // 80.0f
case 6: AimFirstView = 18.50f; break; // 90.0f
case 7: AimFirstView = 32.50f; break; // 180.0f
case 8: AimFirstView = 64.5f; break; // 360.0f
default: AimFirstView = 6.50f;
}
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidClient(LocalPlayer))
{
if (!LocalPlayer->CharacterFx->IsDead())
{
DirectX->DrawCircle(ScreenX, ScreenY, (AimFirstView * 5.0f) * PI3, Yellow, pDevice);
}
}
}
int cAimbot::GetNearestByTargetPlayerAim(LPDIRECT3DDEVICE9 pDevice)
{
int BestTarget = -1;
float MaxDistance = INFINITE;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidClient(LocalPlayer))
{
for (int i = 0; i < Engine->GetMaxPlayer(); i++)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(i);
D3DXVECTOR3 Pos = Engine->GetBonePosition(TargetPlayer->m_Object, 6);
if (!Engine->IsValidClient(TargetPlayer))
continue;
if (!Engine->IsCheckPlayer(TargetPlayer))
continue;
if (Engine->IsTM(LocalPlayer, TargetPlayer))
continue;
// ==================== [ Get Nearest By Crosshair ] ==================== //
if (Var_AimMode == 0)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->GetDistance(Pos.x, Pos.y, ScreenX, ScreenY);
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
// ==================== [ Get Nearest By Distance ] ==================== //
if (Var_AimMode == 1)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->CalculateDistance(LocalPlayer->m_Object->Body, TargetPlayer->m_Object->Body) / 100;
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
}
}
return BestTarget;
}
int cAimbot::GetNearestByTargetZombieAim(LPDIRECT3DDEVICE9 pDevice)
{
int BestTarget = -1;
float MaxDistance = INFINITE;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidClient(LocalPlayer))
{
for (int i = 0; i < Engine->GetMaxPlayer(); i++)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(i);
D3DXVECTOR3 Pos = Engine->GetBonePosition(TargetPlayer->m_Object, 6);
if (!Engine->IsValidClient(TargetPlayer))
continue;
if (!Engine->IsCheckZombie(TargetPlayer))
continue;
if (Engine->IsZM(LocalPlayer, TargetPlayer))
continue;
// ==================== [ Get Nearest By Crosshair ] ==================== //
if (Var_AimMode == 0)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->GetDistance(Pos.x, Pos.y, ScreenX, ScreenY);
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
// ==================== [ Get Nearest By Distance ] ==================== //
if (Var_AimMode == 1)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->CalculateDistance(LocalPlayer->m_Object->Body, TargetPlayer->m_Object->Body) / 100;
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
}
}
return BestTarget;
}
void cAimbot::StartAimbot(LPDIRECT3DDEVICE9 pDevice)
{
if (!Engine->IsGameReadyForHook()) return;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
int BONE_ID = 6;
switch (Var_AimbBone)
{
case 1: BONE_ID = 5; break; // Neck
case 2: BONE_ID = 2; break; // Body
case 3: BONE_ID = 10; break; // Left Hand
case 4: BONE_ID = 17; break; // Right Hand
case 5: BONE_ID = 23; break; // Left Foot
case 6: BONE_ID = 28; break; // Right Foot
default: BONE_ID = 6; // Head
}
if (!Engine->IsRoomInfoZmMode())
{
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidPointer(LocalPlayer))
{
int TargetIndex = this->GetNearestByTargetPlayerAim(pDevice);
if (TargetIndex != -1)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(TargetIndex);
if (Engine->IsValidPointer(TargetPlayer))
{
if (TargetPlayer != LocalPlayer)
{
D3DXVECTOR3 AimPos = Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID);
if (Engine->WorldToScreen(pDevice, &AimPos))
{
float DistX = AimPos.x - ScreenX;
float DistY = AimPos.y - ScreenY;
if (Var_AimVisibleCheck == 0)
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
else if (Var_AimVisibleCheck == 1)
{
if (Engine->IsVisible(Engine->GetBonePosition(LocalPlayer->m_Object, BONE_ID), Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID)))
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
}
}
}
}
}
}
}
else if (Engine->IsRoomInfoZmMode())
{
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidPointer(LocalPlayer))
{
int TargetIndex = this->GetNearestByTargetZombieAim(pDevice);
if (TargetIndex != -1)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(TargetIndex);
if (Engine->IsValidPointer(TargetPlayer))
{
if (TargetPlayer->CharacterFx->IsMutant() != LocalPlayer->CharacterFx->IsMutant())
{
D3DXVECTOR3 AimPos = Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID);
if (Engine->WorldToScreen(pDevice, &AimPos))
{
float DistX = AimPos.x - ScreenX;
float DistY = AimPos.y - ScreenY;
if (Var_AimVisibleCheck == 0)
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
else if (Var_AimVisibleCheck == 1)
{
if (Engine->IsVisible(Engine->GetBonePosition(LocalPlayer->m_Object, BONE_ID), Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID)))
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
}
}
}
}
}
}
}
}
float DistX = 0.0f, DistY = 0.0f; if( AimPos.x > ScreenX ) DistX = -( ScreenX - AimPos.x ); else DistX = AimPos.x - ScreenX; if( AimPos.y > ScreenY ) DistY = -( ScreenY - AimPos.y ); else DistY = AimPos.y - ScreenY;

#define YAW 0x530
#define PITCH 0x534
#define DegToRad(degree) ((degree) * (3.141592654f / 180.0f))
class cPlayerPos
{
public:
char _UnkSpace[0xDC]; <----------- i don't have this
D3DXVECTOR3 Position;
};
class cLTPlayerClient
{
public:
char _UnkSpace[0x350]; <----------- i don't have this
cPlayerPos* pPlayerPos;
char _UnkSpace2[8];
float Pitch;
float Yaw;
};
cLTPlayerClient* pPlayerManager;
__forceinline float AngleNormalize(float x)
{
x = fmod(x + 180, 360);
if (x < 0) x += 360;
return x - 180;
}
void GetAngleToTarget(D3DXVECTOR3 vTargetPos, D3DXVECTOR3 vCameraPos, D3DXVECTOR2& vAngles)
{
VectorAngles(D3DXVECTOR3(vTargetPos - vCameraPos), vAngles);
}
/*
Get vector angles
*/
inline void VectorAngles(const D3DXVECTOR3 forward, D3DXVECTOR2& angles)
{
if (forward[2] == 0 && forward[0] == 0)
{
angles[0] = -90;
angles[1] = 0;
}
else
{
float tmp = sqrtf(forward[0] * forward[0] + forward[2] * forward[2]);
angles[0] = AngleNormalize(atan2f(-forward[1], tmp) * 180 / D3DX_PI);
angles[1] = AngleNormalize((atan2f(forward[2], -forward[0]) * 180 / D3DX_PI) - 90);
}
}
void SetMousePosition(LPDIRECT3DDEVICE9 pDevice, CPlayer* Me, CPlayer* pPlayer, D3DXVECTOR3 pos)
{
if (!isValidClient(pPlayer) && Me != pPlayer)
return;
//if (!isValidClient(pPlayer) || pPlayer == Me || pPlayerManager == NULL)
// return;
D3DXMATRIX View, iView;
D3DXVECTOR3 fDist;
D3DXVECTOR2 Position;
pDevice->GetTransform(D3DTS_VIEW, &View);
D3DXMatrixInverse(&iView, 0, &View);
D3DXVec3Subtract(&fDist, &pos, &D3DXVECTOR3(iView._41, iView._42, iView._43));
GetAngleToTarget(pos, D3DXVECTOR3(iView._41, iView._42, iView._43), Position);
if (Position[PITCH] != NULL)
pPlayerManager->Pitch = DegToRad(Position[PITCH]);
if (Position[YAW])
pPlayerManager->Yaw = DegToRad(Position[YAW]);
}
CPlayer* Me = GetPlayerByIndex(pLTClientShell, GetMyIndex(pLTClientShell));
CPlayer* Target = GetPlayerByIndex(pLTClientShell, iAimAt);
D3DXVECTOR3 AimPos = GetBonePosition(Target->Object, BONE_ID);
if (VisibleCheck == 1)
{
if (IsVisible(GetBonePosition(Me->Object, 6), GetBonePosition(Target->Object, BONE_ID)))
{
switch (AimKey)
{
case 1: SetMousePosition(pDevice, Me, Target, AimPos); break;
case 2: if (GetAsyncKeyState(VK_LBUTTON)) SetMousePosition(pDevice, Me, Target, AimPos); break;
case 3: if (GetAsyncKeyState(VK_RBUTTON)) SetMousePosition(pDevice, Me, Target, AimPos); break;
case 4: if (GetAsyncKeyState(VK_SHIFT)) SetMousePosition(pDevice, Me, Target, AimPos); break;
case 5: if (GetAsyncKeyState(VK_MENU)) SetMousePosition(pDevice, Me, Target, AimPos); break;
}

