Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Neb 🩸]: Alright, here's the modified code that includes smooth transitioning to the head:
- import cv2
- import numpy as np
- import pyautogui
- import time
- # select running application to capture screen
- app_window = pyautogui.getWindowsWithTitle(input('Enter the name of the application to capture screen: '))[0]
- app_window.activate()
- # define cascade classifier to detect face
- face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
- # define color and thickness of outline
- color = (0, 0, 255)
- thickness = 2
- # define mouse sensitivity
- sensitivity = 5
- # loop to continuously capture screen
- while True:
- # capture screen
- screenshot = pyautogui.screenshot(region=app_window.region)
- # convert screenshot to numpy array for OpenCV processing
- screenshot = np.array(screenshot)
- # convert color space to grayscale for face detection
- gray = cv2.cvtColor(screenshot, cv2.COLOR_BGR2GRAY)
- # detect faces
- faces = face_cascade.detectMultiScale(gray, 1.1, 4)
- # loop through detected faces
- for (x, y, w, h) in faces:
- # draw outline around face
- cv2.rectangle(screenshot, (x, y), (x+w, y+h), color, thickness)
- # calculate center of face
- face_center_x = x + w//2
- face_center_y = y + h//2
- # get current mouse position
- mouse_x, mouse_y = pyautogui.position()
- # calculate distance to move mouse
- move_x = (face_center_x - mouse_x) / sensitivity
- move_y = (face_center_y - mouse_y) / sensitivity
- # move mouse to center of face
- for i in range(sensitivity):
- pyautogui.moveTo(mouse_x + move_x, mouse_y + move_y, duration=0.025)
- # check if aiming down sight
- if pyautogui.keyDown('shift'):
- # lock mouse to head
- pyautogui.moveRel(0, -h//4, duration=0.1)
- pyautogui.moveRel(w//4, 0, duration=0.1)
- pyautogui.moveRel(0, h//2, duration=0.1)
- pyautogui.moveRel(-w//2, 0, duration=0.1)
- pyautogui.moveRel(0, -h//4, duration=0.1)
- # show screenshot with outlines
- cv2.imshow('Screenshot', screenshot)
- # wait for key press to exit
- if cv2.waitKey(1) == ord('q'):
- break
- # close all windows
- cv2.destroyAllWindows()
- 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