SolvedAimbot using Screen Coordinates & SendInput

Rake

Hey there fellas, I haven't found a way to write view angles yet in OpenArena so I'm trying this ghetto way of using screen coordinates & SendInput to move my mouse. I can only get it to work in 1 quadrant, I followed the same logic for the other quadrants but it doesn't want to work. It doesn't appear to be broken because of monitor coordinates vs window coordinates because if I go fullscreen I have the same exact problem.

C++:
``````void moveMouse2(vec2 target)
{
float interval = 4;
vec2 crosshair = { WINDOWWIDTH / 2, WINDOWHEIGHT / 2 };

{
target.x = target.x - crosshair.x;
target.x /= interval;
}

if (target.x < crosshair.x)//good
{
target.x = -(crosshair.x - target.x);
target.x /= interval;
}

{
target.y = target.y - crosshair.y;
target.y /= interval;
}

if (target.y < crosshair.y)//good
{
target.y = -(crosshair.y - target.y);
target.y /= interval;
}

INPUT  setAngle = { 0 };
setAngle.type = INPUT_MOUSE;
setAngle.mi.dwFlags = MOUSEEVENTF_MOVE;
setAngle.mi.dx = target.x;
setAngle.mi.dy = target.y;
SendInput(1, &setAngle, sizeof(INPUT));
}``````
I know this method is odd, but if it works, it works. Looking for suggestions

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
really simple

C++:
``````void AimAt(vec3* point)
{
float aX, aY;

vec2 screen[2];
if (!WorldToScreen(pRefdef, point, &screen))
return;

float centerX = pRefdef->width / 2.f;
float centerY = pRefdef->height / 2.f;

float enemyX = screen.x;
float enemyY = screen.y;

aX = enemyX - centerX;
aY = enemyY - centerY;

if (bSmoothAim)
{
aX /= fSmoothAmount;
aY /= fSmoothAmount;
}

mouse_event(MOUSEEVENTF_MOVE, aX, aY, 0, 0);
}``````

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
C++:
``````void MoveMouse(float X, float Y, float Interval)
{
POINT CurrPos;
GetCursorPos(&CurrPos);
X = (X - CurrPos.x) / Interval + CurrPos.x;
Y = (Y - CurrPos.y) / Interval + CurrPos.y;
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, static_cast<DWORD>(X) * 65535 / ScreenWidth, static_cast<DWORD>(Y) * 65535 / ScreenHeight, 0, 0);
}``````
Use it like dis:
C++:
``````for (UINT i = 30; i; --i) //Stepcount
{
MoveMouse(x, y, i);
Sleep(SomeAimDelay);
}``````
This is just linear mouse movement. Some hyperbolic curves would be cooler ofc.

Rake

Вroihon;40811 said:
C++:
``````void MoveMouse(float X, float Y, float Interval)
{
POINT CurrPos;
GetCursorPos(&CurrPos);
X = (X - CurrPos.x) / Interval + CurrPos.x;
Y = (Y - CurrPos.y) / Interval + CurrPos.y;
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, static_cast<DWORD>(X) * 65535 / ScreenWidth, static_cast<DWORD>(Y) * 65535 / ScreenHeight, 0, 0);
}``````
Use it like dis:
C++:
``````for (UINT i = 30; i; --i) //Stepcount
{
MoveMouse(x, y, i);
Sleep(SomeAimDelay);
}``````
Hmmmm thank you but I can't seem to make this work, I will keep trying

Rake

really simple

C++:
``````void AimAt(vec3* point)
{
float aX, aY;

vec2 screen[2];
if (!WorldToScreen(pRefdef, point, &screen))
return;

float centerX = pRefdef->width / 2.f;
float centerY = pRefdef->height / 2.f;

float enemyX = screen.x;
float enemyY = screen.y;

aX = enemyX - centerX;
aY = enemyY - centerY;

if (bSmoothAim)
{
aX /= fSmoothAmount;
aY /= fSmoothAmount;
}

mouse_event(MOUSEEVENTF_MOVE, aX, aY, 0, 0);
}``````
+300 rep, thank you! Can't believe it was that simple

JewsusChrist

Newbie
Full Member
Another way of going about it utilizing the games XYZ Acceleration coordinates, at least that's what I call it, to dictate the movement of entities. With this you can do a aim prediction of enemies within your XY Screen easily, with the added benefit of movement speed prediction as well, so killing 2 birds with one stone.

Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language