Начинающий
-
Автор темы
- #1
Здраствуйте прошу помощи сделать наводку для ai aimbot
В скрипте присутствует ai vision там наглядно видно что он детектит врагов но скрипт не наводит попрошу переписать наводку для aimbot и отдать сразу весь готовый скрипт а не советы просто в роботе с aimbot 0
В скрипте присутствует ai vision там наглядно видно что он детектит врагов но скрипт не наводит попрошу переписать наводку для aimbot и отдать сразу весь готовый скрипт а не советы просто в роботе с aimbot 0
Python:
import time
import numpy as np
import mss
import cv2
import pyautogui
from ultralytics import YOLO
# Initialize YOLOv8 model (using the smallest model for performance)
model = YOLO('best.pt') # Use 'yolov8n' for better performance
# Screen resolution for 2560x1600
screen_width, screen_height = 2560, 1600
monitor = {"top": 0, "left": 0, "width": screen_width, "height": screen_height}
screen_capture = mss.mss()
# FPS calculation
last_time = time.time()
fps = 0
# Capture window size: 400x400 centered on the screen
window_width, window_height = 400, 400
center_x = screen_width // 2
center_y = screen_height // 2
fov_left = center_x - (window_width // 2)
fov_right = center_x + (window_width // 2)
fov_top = center_y - (window_height // 2)
fov_bottom = center_y + (window_height // 2)
# Function to process each frame
def process_frame(img):
global fps, last_time
# Resize image to reduce processing load (scale down to 640x640)
img_resized = cv2.resize(img, (640, 640))
# Object detection using YOLOv8
results = model(img_resized)
# Process detected objects
for result in results:
boxes = result.boxes
for box in boxes:
x1, y1, x2, y2 = box.xyxy[0] # Get bounding box coordinates
confidence = box.conf[0]
if confidence > 0.5: # Only assist if confidence is greater than 50%
# Draw bounding box around detected object
img_resized = cv2.rectangle(img_resized, (int(x1), int(y1)), (int(x2), int(y2)), (255, 0, 0), 2)
# Calculate center of the detected object
obj_center_x = (x1 + x2) / 2
obj_center_y = (y1 + y2) / 2
# Convert to full screen coordinates
scale_x = screen_width / window_width
scale_y = screen_height / window_height
# Scale object center to full screen
screen_obj_x = fov_left + obj_center_x
screen_obj_y = fov_top + obj_center_y
screen_obj_x = int(screen_obj_x * scale_x)
screen_obj_y = int(screen_obj_y * scale_y)
# Calculate the mouse movement from the center of the screen
move_x = screen_obj_x - center_x
move_y = screen_obj_y - center_y
# Apply a factor to make the movement smooth (adjust this factor for sensitivity)
sensitivity = 5 # Increase sensitivity if movement is too slow
move_x *= sensitivity
move_y *= sensitivity
# Move the mouse from the center to the detected object
pyautogui.moveRel(move_x, move_y)
# Calculate FPS
new_time = time.time()
fps = 1 / (new_time - last_time)
last_time = new_time
# Show FPS on the image
cv2.putText(img_resized, f"FPS: {int(fps)}", (10, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
# Display image
cv2.imshow("AI Vision Window", img_resized)
# Check for 'q' key press to exit
if cv2.waitKey(1) & 0xFF == ord('q'):
return False
return True
# Function to capture the screen and process it
def capture_screen():
while True:
# Capture the screen
screenshot = screen_capture.grab(monitor)
img = np.array(screenshot)
# Convert from BGR (OpenCV) to RGB (YOLO)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# Crop the image based on the FOV (400x400 window)
img_cropped = img[fov_top:fov_bottom, fov_left:fov_right]
# Process the frame
if not process_frame(img_cropped):
break
cv2.destroyAllWindows()
# Set up the AI Vision window
def setup_window():
# Create a named window that can be resized
cv2.namedWindow("AI Vision Window", cv2.WINDOW_NORMAL)
cv2.moveWindow("AI Vision Window", 0, 0) # Move to the top-left corner
cv2.resizeWindow("AI Vision Window", window_width, window_height) # Set window size
# Run the setup and capture screen in the main thread
setup_window()
# Start the screen capture in the main thread
capture_screen()