from unittest import result import torch import pyautogui import gc import numpy as np import cv2 import time import mss import win32api, win32con import dxcam def main(): # Window title to go after and the height of the screenshots videoGameWindowTitle = "Rainbow Six" # Portion of screen to be captured (This forms a square/rectangle around the center of screen) screenShotHeight = 320 screenShotWidth = 320 # How big the Autoaim box should be around the center of the screen aaDetectionBox = 320 # For use in games that are 3rd person and character model interferes with the autoaim # EXAMPLE: Fortnite and New World aaRightShift = 0 # Autoaim mouse movement amplifier aaMovementAmp = 1.1 # Person Class Confidence confidence = 0.5 # What key to press to quit and shutdown the autoaim aaQuitKey = "B" # If you want to main slightly upwards towards the head headshot_mode = False # Displays the Corrections per second in the terminal cpsDisplay = False # Set to True if you want to get the visuals visuals = True # Selecting the correct game window try: videoGameWindows = pyautogui.getWindowsWithTitle(videoGameWindowTitle) videoGameWindow = videoGameWindows[0] except: print("The game window you are trying to select doesn't exist.") print("Check variable videoGameWindowTitle (typically on line 13") exit() # Select that Window videoGameWindow.activate() # Setting up the screen shots left,top,=aaRightShift + ((videoGameWindow.left + videoGameWindow.right) // 2 - (screenShotWidth // 2)),videoGameWindow.top + (videoGameWindow.height - screenShotHeight) // 2, width,height=screenShotWidth,screenShotHeight sctArea=(left,top,width,height) # Starting screenshoting engine sct = dxcam.create() # Calculating the center Autoaim box cWidth = width / 2 cHeight = height / 2 # Used for forcing garbage collection count = 0 sTime = time.time() # Loading Yolo5 Small AI Model model = torch.hub.load('WongKinYiu/yolov7','custom','yolov7-tiny.pt') model.classes = [0] # Used for colors drawn on bounding boxes COLORS = np.random.uniform(0, 255, size=(1500, 3)) # Main loop Quit if Q is pressed last_mid_coord = None aimbot=False while win32api.GetAsyncKeyState(ord(aaQuitKey)) == 0: # Getting screenshop, making into np.array and dropping alpha dimention. npImg = np.delete(np.array(sct.grab(sctArea)))