My Code
Code:
Code:
...
int GetPriorityTarget()
{
int Result = -1;
float fMaxDistance = 100.0f;
D3DXVECTOR3 PlayerEnd, LocPlayer;
for (int iSlot = 0; iSlot < 16; iSlot++)
{
if (GetCharaIndex() != iSlot && (!IsSpawn(iSlot)))
{
if (GetCharaIndex() %2 != iSlot % 2)
{
GetBoneById(LocPlayer, GetCharaIndex(), 7);
GetBoneById(PlayerEnd, iSlot, 7);
if (CalcDistance(LocPlayer, PlayerEnd) < fMaxDistance)
{
fMaxDistance = CalcDistance(PlayerEnd, LocPlayer);
Result = iSlot;
}
}
}
}
return Result;
}
void AimToEnemy(int nIdx,int AimBone)
{
D3DXVECTOR3 vDist;
D3DXVec3Subtract(&vDist, &GetBoneById2(nIdx, AimBone), &GetBoneById2(GetMySlot(), 7));
CPlayer* Player = (CPlayer*)(*(DWORD*)(g_pPlayer));
Player->Camera->Yaw = atan2(vDist.y, D3DXVec3Length(&vDist));
Player->Camera->Pitch = atan2(vDist.x, vDist.z);
}
My Problem is locks the screen and close the game
Yaw does not have the angle 0º
Help Please