На самом деле я Zodiak
-
Автор темы
- #1
VK.com | VK
vk.com
Нашел аим на просторах необъятного, помогите пофиксить, а то его колбасит сильно
C++:
void AimAtPos(int screenwidth, int screenheight, float x, float y, float speed, float lock, bool smooth) {
int ScreenCenterX = screenwidth / 2, ScreenCenterY = screenheight / 2;
float AimSpeed = (float)speed + 0.2f;
float TargetX = 0;
float TargetY = 0;
if (x != 0) {
if (x > ScreenCenterX) {
TargetX = -(ScreenCenterX - x);
TargetX /= AimSpeed;
TargetX += lock;
if (TargetX + ScreenCenterX > ScreenCenterX * 2) TargetX = 0;
}
if (x < ScreenCenterX)
{
TargetX = x - ScreenCenterX;
TargetX /= AimSpeed;
TargetX -= lock;
if (TargetX + ScreenCenterX < 0) TargetX = 0;
}
}
if (y != 0)
{
if (y > ScreenCenterY)
{
TargetY = -(ScreenCenterY - y);
TargetY /= AimSpeed;
TargetY += lock;
if (TargetY + ScreenCenterY > ScreenCenterY * 2) TargetY = 0;
}
if (y < ScreenCenterY)
{
TargetY = y - ScreenCenterY;
TargetY /= AimSpeed;
TargetY -= lock;
if (TargetY + ScreenCenterY < 0) TargetY = 0;
}
}
if (!smooth)
{
mouse_move((int)TargetX, (int)(TargetY));
return;
}
TargetX /= 10;
TargetY /= 10;
if (abs(TargetX) < 1)
{
if (TargetX > 0)
{
TargetX = 1;
}
if (TargetX < 0)
{
TargetX = -1;
}
}
if (abs(TargetY) < 1)
{
if (TargetY > 0)
{
TargetY = 1;
}
if (TargetY < 0)
{
TargetY = -1;
}
}
mouse_move((int)TargetX, (int)(TargetY));
//mouse_event(MOUSEEVENTF_MOVE, (int)TargetX, (int)(TargetY), NULL, NULL);
}
C++:
if (GetAsyncKeyState(VK_RBUTTON)) {
float aimspeed = 250.f;
float lock = 5.f;
float Fov = 100.f;
if (CenterDistance(Headpos.x, Headpos.y, ScreenX / 2,ScreenY/ 2) <= Fov) {
AimAtPos(ScreenX, ScreenY, Headpos.x, Headpos.y, aimspeed, lock, false);
}
}