简体   繁体   中英

moving a crosshair in Games

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM