> For the complete documentation index, see [llms.txt](https://docs.neuralaim.ru/napi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.neuralaim.ru/napi/programmy-or-primery/pervyi-aimbot-na-neiroseti..md).

# Первый AimBot на нейросети.

{% hint style="info" %}
**Сперва Python!** - Синтаксис Python очень простой, но рекомендуется ознакомится с ним заранее, перед использованием NAPI
{% endhint %}

## Код:

```python
half_fov = FOV / 2 # Центр Fov, FOV - это константа из конфига пользователя
width, height = screen.size # Получаем размеры экрана (ширина/высота)
center_x, center_y = width / 2, height / 2

mon_x1, mon_y1 = center_x - half_fov, center_y - half_fov # Левый верхний угол
mon_x2, mon_y2 = center_x + half_fov, center_y + half_fov # Нижний правый угол

while True: # Вечный цикл
    img = screen.capture(mon_x1, mon_y1, mon_x2, mon_y2) # Захват экрана с размерами Fov (128px)
    enemys = neural.detect(img, conf=0.5) # Поиск всех врагов на изображение
    
    if enemys['heads']: # Если найдена голова/ы врагов
        box, conf = enemys['heads'][0] # Получаем координаты головы врага
        x1, y1, x2, y2 = box
        width = x2 - x1 # Ширина врага, (право-лево)
        height = y2 - y1 # Высота врага, (верх-низ)
        center_x = x1 + width / 2 # Центр по ширине
        center_y = y1 + height / 2 # Центр по высоте
        mouse.move(center_x - half_fov, center_y - half_fov) # Двигаем мышку
        if x1 < half_fov < x2 and y1 < half_fov < y2: # Если голова на прицеле
            mouse.click() # Стреляем! (Кликаем мышкой)
```

{% hint style="info" %}
Вы можете добавить сюда алгоритм, который будет сортировать на основе координат врагов и выбирать самую ближайшую цель
{% endhint %}

{% hint style="info" %}
Вы можете добавить настройку скорострельности стрельбы, если враг обнаружен
{% endhint %}

{% hint style="info" %}
Вы можете написать алгоритм для предугадывания позиции головы на основе координат тела, если враг слишком далеко.
{% endhint %}

И многое, многое другое! Всё это можно делать с NAPI!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.neuralaim.ru/napi/programmy-or-primery/pervyi-aimbot-na-neiroseti..md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
