首页 > 解决方案 > AssaultCube Aimbot,我的偏航角和俯仰角值不起作用

问题描述

当我尝试使用三角函数时,我的偏航和俯仰值不起作用,即使在我运行我的瞄准机器人应用程序时数学是错误的,它至少应该在我移动时瞄准不同的角度,但事实并非如此。它只是卡在一个角度看那里。当我运行应用程序时,我的偏航值几乎接近 0,所以我认为我的计算超出了偏航值区间

请注意,yaw 值的间隔为 [ 0, 360 ],pitch 为 [ -90, 90 ]


#include "proc.h"
#include <iostream>
#include <thread>
#include <chrono>
#include <math.h>
#include <tgmath.h>
#define PI 3.14159265
//WORD m_XPos = 0x04;
//WORD m_YPos = 0x08;
//WORD m_ZPos = 0xC
//WORD YawVal = 0x0040;
//WORD PitchVal = 0x0044;

int main()
{
    // Linking the game to my code essentially here
    DWORD procID;
    procID = getProcID(L"ac_client.exe");
    HANDLE handle = 0;
    handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);

    //base address for the player and base address for the enemy
    uintptr_t localBaseAddress = 0x50F4F4;
    uintptr_t entityBaseAddress = 0x50F4F8;

    // setting up a link to get the values of playerx,y,z and view angles
    std::vector<int> playerOffsets = { 0x4 };
    uintptr_t playerX = findDMAAddress(handle, localBaseAddress, playerOffsets);
    playerOffsets = { 0x8 };
    uintptr_t playerY = findDMAAddress(handle, localBaseAddress, playerOffsets);
    playerOffsets = { 0xC };
    uintptr_t playerZ = findDMAAddress(handle, localBaseAddress, playerOffsets);
    playerOffsets = { 0x40 };
    uintptr_t playerYaw = findDMAAddress(handle, localBaseAddress, playerOffsets);
    playerOffsets = { 0x44 };
    uintptr_t playerPitch = findDMAAddress(handle, localBaseAddress, playerOffsets);


    // setting up a link to get enemy x,y,z
    /* note this is just one enemy which is the second enemy in the entity list 
    chain */
    std::vector<int> enemyOffsets = { 0x8, 0x4 };
    uintptr_t enemyX = findDMAAddress(handle, entityBaseAddress, enemyOffsets);
    enemyOffsets = { 0x8, 0x8 };
    uintptr_t enemyY = findDMAAddress(handle, entityBaseAddress, enemyOffsets);
    enemyOffsets = { 0x8, 0xC };
    uintptr_t enemyZ = findDMAAddress(handle, entityBaseAddress, enemyOffsets);

    float myX = 0;
    float myY = 0;
    float myZ = 0;

    float botX = 0;
    float botY = 0;
    float botZ = 0;

    float placeholderX = 0;
    float placeholderY = 0;
    float placeholderZ = 0;

    float magnitude = 0;

    float tempYawValue = 0;
    float tempPitchValue = 0;
    float yawValue = 0;
    float pitchValue = 0;


    while (true)
    {
        // assign values to the floats i initialized previously for calculations
        ReadProcessMemory(handle, (BYTE*)enemyX, &botX, sizeof(botX), 0);
        ReadProcessMemory(handle, (BYTE*)enemyY, &botY, sizeof(botY), 0);
        ReadProcessMemory(handle, (BYTE*)enemyZ, &botZ, sizeof(botZ), 0);

        ReadProcessMemory(handle, (BYTE*)playerX, &myX, sizeof(myX), 0);
        ReadProcessMemory(handle, (BYTE*)playerY, &myY, sizeof(myY), 0);
        ReadProcessMemory(handle, (BYTE*)playerZ, &myZ, sizeof(myZ), 0);
        ReadProcessMemory(handle, (BYTE*)playerYaw, &tempYawValue, sizeof(tempYawValue), 0);
        ReadProcessMemory(handle, (BYTE*)playerPitch, &tempPitchValue, sizeof(tempPitchValue), 0);

        //getting origin to get distance between me and enemy 
        placeholderX = botX - myX;
        placeholderY = botY - myY;
        placeholderZ = botZ - myZ;

        magnitude = sqrt(pow(placeholderX, 2) + pow(placeholderY, 2) + pow(placeholderZ, 2));

        //math for view angles
        yawValue = (atan2(tempYawValue, tempPitchValue)) * (180 / PI);
        pitchValue = acos(placeholderZ / magnitude) * (180 / PI);

        // constantly writing to player view angles memory usign the angles i calculated
        WriteProcessMemory(handle, (BYTE*)playerYaw, &yawValue, sizeof(yawValue), 0);
        WriteProcessMemory(handle, (BYTE*)playerPitch, &pitchValue, sizeof(pitchValue), 0);

    }

}

标签: c++

解决方案


推荐阅读