Advertisement
b-7

Capture Screen - Auto Lock to Head - Aimbot

b-7
Mar 11th, 2023
1,696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.41 KB | None | 0 0
  1. [Neb 🩸]: Alright, here's the modified code that includes smooth transitioning to the head:
  2.  
  3.  
  4.  
  5.  
  6. import cv2
  7. import numpy as np
  8. import pyautogui
  9. import time
  10.  
  11. # select running application to capture screen
  12. app_window = pyautogui.getWindowsWithTitle(input('Enter the name of the application to capture screen: '))[0]
  13. app_window.activate()
  14.  
  15. # define cascade classifier to detect face
  16. face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
  17.  
  18. # define color and thickness of outline
  19. color = (0, 0, 255)
  20. thickness = 2
  21.  
  22. # define mouse sensitivity
  23. sensitivity = 5
  24.  
  25. # loop to continuously capture screen
  26. while True:
  27.    # capture screen
  28.    screenshot = pyautogui.screenshot(region=app_window.region)
  29.  
  30.    # convert screenshot to numpy array for OpenCV processing
  31.    screenshot = np.array(screenshot)
  32.  
  33.    # convert color space to grayscale for face detection
  34.    gray = cv2.cvtColor(screenshot, cv2.COLOR_BGR2GRAY)
  35.  
  36.    # detect faces
  37.    faces = face_cascade.detectMultiScale(gray, 1.1, 4)
  38.  
  39.    # loop through detected faces
  40.    for (x, y, w, h) in faces:
  41.        # draw outline around face
  42.        cv2.rectangle(screenshot, (x, y), (x+w, y+h), color, thickness)
  43.  
  44.        # calculate center of face
  45.        face_center_x = x + w//2
  46.        face_center_y = y + h//2
  47.  
  48.        # get current mouse position
  49.        mouse_x, mouse_y = pyautogui.position()
  50.  
  51.        # calculate distance to move mouse
  52.        move_x = (face_center_x - mouse_x) / sensitivity
  53.        move_y = (face_center_y - mouse_y) / sensitivity
  54.  
  55.        # move mouse to center of face
  56.        for i in range(sensitivity):
  57.            pyautogui.moveTo(mouse_x + move_x, mouse_y + move_y, duration=0.025)
  58.  
  59.        # check if aiming down sight
  60.        if pyautogui.keyDown('shift'):
  61.            # lock mouse to head
  62.            pyautogui.moveRel(0, -h//4, duration=0.1)
  63.            pyautogui.moveRel(w//4, 0, duration=0.1)
  64.            pyautogui.moveRel(0, h//2, duration=0.1)
  65.            pyautogui.moveRel(-w//2, 0, duration=0.1)
  66.            pyautogui.moveRel(0, -h//4, duration=0.1)
  67.  
  68.    # show screenshot with outlines
  69.    cv2.imshow('Screenshot', screenshot)
  70.  
  71.    # wait for key press to exit
  72.    if cv2.waitKey(1) == ord('q'):
  73.        break
  74.  
  75. # close all windows
  76. cv2.destroyAllWindows()
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. If using a cronus zen via remote play you could use this to have the first official real aimbot on console, online.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement