moving a crosshair in Games

397 Views Asked by At

im trying to make an aim bot for personal fun use against friends not to ruin others experience and to see if I can make one I am relatively new to programming and cant get my cross hair to move. I have tried using pyautogui and pydirectinput and a few other things I can get it to work in a browser but when I get into a game and the mouse is center locked and it doesn't move the crosshair to the right position

code:

from shutil import move

from time import sleep

import pyautogui 

import pydirectinput
x=5

while True:
   
 sleep(5)
   
 x, y = pyautogui.locateCenterOnScreen("ball.jpg", confidence = 0.8)
    
 pydirectinput.moveTo(x, y, duration = 0.1)
    
 pyautogui.leftClick()
 
 break

This is what I have so far and have made many variations to the move part but cant get it to move the crosshair .Currently trying to use it in aim lab it uses image recognition if I can get this to work I will probably change it to color so its more accurate once again this is for personal use not online or am I greatly underestimating the difficulty it is to do something like this .I'm currently using python 3.10.8 the latest version

1

There are 1 best solutions below

1
On

Try change this code part:

from shutil import move
from time import sleep
import pyautogui 

while True:   
 sleep(5)   
 x, y = pyautogui.locateCenterOnScreen("ball.jpg", confidence = 0.8)    
 pyautogui.moveTo(10, 10, duration = 0.1)    
 pyautogui.leftClick() 
 break