Aimbot行为怪异

时间:2019-07-19 21:16:48

标签: c++ memory-management

您的目标是尝试制造一个瞄准机器人。 aimbot的输出很差。它开始缓慢旋转并始终以相同的方式旋转。我认为这是我获得目标头位置的方式。或者也可以是我计算角度时所做的数学运算。

我已经尝试过用google搜索我的问题,并且已经检查了我的代码,但是我不知道如何解决它。我知道我的代码有点混乱,但是我仍然在学习抱歉。

在这里我可以获得我的玩家的头位和目标

class Aimbot
    {
    public:


    vectors::Vector getMyHead(HANDLE processHandle, DWORD localPlayer, DWORD clientDLL, int entity) {

        vectors::Vector origin;
        vectors::Vector viewVector;
        vectors::Vector myHead;

        ReadProcessMemory(processHandle, (LPCVOID)(localPlayer + hazedumper::netvars::m_vecOrigin), &origin, sizeof(origin), NULL);
        ReadProcessMemory(processHandle, (LPCVOID)(localPlayer + hazedumper::netvars::m_vecViewOffset), &viewVector, sizeof(viewVector), NULL);
        myHead.x = origin.x + viewVector.x;
        myHead.y = origin.y + viewVector.y;
        myHead.z = origin.z + viewVector.z;
        return myHead;
    }
Here is where i get targets head position

    vectors::Vector getEnemyHead(HANDLE processHandle, DWORD clientDLL, DWORD entity) {
        DWORD bones;

        ReadProcessMemory(processHandle, (LPCVOID)(entity + hazedumper::netvars::m_dwBoneMatrix), &bones, sizeof(bones), NULL);
        int bone = 8;


        vectors::Vector enemyHead;
        ReadProcessMemory(processHandle, (LPCVOID)(bones + 0x30 * 8 + 0x0C), &enemyHead.x, sizeof(float), NULL);
        ReadProcessMemory(processHandle, (LPCVOID)(bones + 0x30 * 8 + 0x1C), &enemyHead.y, sizeof(float), NULL);
        ReadProcessMemory(processHandle, (LPCVOID)(bones + 0x30 * 8 + 0x2C), &enemyHead.z, sizeof(float), NULL);


        return enemyHead;
    }

};

这是主文件,我在这里计算角度。

if(AimOnOrOf){
    aimbot1(processHandle, clientDLL, engineDLL, localPlayer);
        vectors::Vector myHead;
        myHead = aimbot.getMyHead(processHandle, localPlayer, clientDLL, entity);
        vectors::Vector enemyHead;
        enemyHead = aimbot.getEnemyHead(processHandle, clientDLL, entity);
        vectors::Vector playerAngle;
        ReadProcessMemory(processHandle, (LPCVOID)(hazedumper::signatures::dwClientState), &playerAngle, sizeof(playerAngle), NULL);

        int subtract[2];

        subtract[0] = enemyHead.x - myHead.x;
        subtract[1] = enemyHead.y - myHead.y;
        subtract[2] = enemyHead.z - myHead.z;

        float hypotenuse = sqrt(subtract[2] * subtract[2] + subtract[0] * subtract[0]);
This math could also be wrong i have no clue.
        float  yaw = atan2(subtract[1], subtract[0]) - playerAngle.y;
        float  pitch = atan2(subtract[2], hypotenuse) + playerAngle.x;



mouse_event(MOUSEEVENTF_MOVE, yaw, pitch, 0, 0);

如果我忘了任何评论。但是我认为任何内存管理都没有问题,在maby中我可以找到目标头部位置。

0 个答案:

没有答案