problem with aimbot math

S0Ft1k

Member
Joined
Oct 22, 2019
Messages
5
Reaction score
2
Location
SAMP
hi guys, i'm trying to make an aimbot skin by opcoder in c++. but i have a problem with the math of my camera. i set up the hook 0x521500 to get the camera position during aiming for smooth rotation by it (not like in sobeit) the position of my crosshair is moving incorrectly, my crosshair is to the right and above the player.

for example - youtube.com/watch?v=MYE9lfzuc7Y
C++:
using o_process_aim_t = void(__thiscall*)(void* cam_pointer, CVector* position_of_camera, float x, float y, float z);
inline o_process_aim_t o_process_aim{};

// setting up my hook with MinHook
HOOK((void*)0x00521500, process_aim, o_process_aim);

void __fastcall process_aim(void* cam_pointer, void* not_used, CVector* position_of_camera, float x, float y, float z) {
    
    // position_of_camera != Cams[0].Source
    
    const auto& crosshair_x = *(float*)0xB6EC14;
    const auto& crosshair_y = *(float*)0xB6EC10;
    const auto& aspect_ratio = *(float*)0xC3EFA4;

    const auto mult = tan((TheCamera.FindCamFOV() / 2)  * 0.017453292f);
    
    // target = the ped's pelvis bone
    auto delta = *position_of_camera - target;
    float delta_length = sqrtf(powf(delta.x, 2) + powf(delta.y, 2) + powf(delta.z, 2));

    float yaw = (3.14f - atan2f(delta.y, -delta.x));
    yaw += mult * (crosshair_x * 2 - 1.0f);
            
    float pitch = atan2f(delta_length, delta.z);
    pitch  -= (3.14f - atan2(1.0f, mult * (1.0f - crosshair_y * 2) * (1.0f / aspect_ratio)));

    *(float*)0xB6F258 = yaw;
    *(float*)0xB6F248 = pitch;
            
    o_process_aim(cam_pointer, position_of_camera, x, y, z);       
        
}
 
Top