> For the complete documentation index, see [llms.txt](https://docs.perfectcs2.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.perfectcs2.com/documentacao/api/menu.md).

# menu

Ler e mudar as opções do Perfect.

Com `menu` o script lê e muda **qualquer opção do próprio Perfect**: aimbot, ESP, mundo, overlays e configurações. São 546 opções, cada uma com um caminho fixo:

```lua
menu.set("legitbot.rifles.fov", 3.5)
menu.set("player.esp.enemies.box", "Edge")
menu.set("world.skybox_color", color(80, 120, 255))

print(menu.get("ragebot.awp.min_damage"))  --> 30
```

A lista completa, com tipos e limites, está em [Todas as opções do menu](/referencia/opcoes-do-menu.md).

## Caminhos

* São em minúsculas, com `.` entre os níveis e `_` entre as palavras.
* Grupos de arma são um nível próprio:
  * Legitbot: `general`, `pistols`, `rifles`, `smgs`, `snipers`, `heavy`;
  * Ragebot: `general`, `pistols`, `deagle`, `revolver`, `rifles`, `smgs`, `scout`, `auto`, `awp`, `heavy`.
* O ESP é separado por alvo: `player.esp.enemies.*` e `player.esp.teammates.*`.
* Opções com liga/desliga e cor ficam em dois caminhos: `player.esp.enemies.name` (boolean) e `player.esp.enemies.name_color` (color).

{% hint style="info" %}
Os grupos de arma, exceto o `general`, só usam os próprios valores quando `override_general` está `true`. Antes disso, seguem o General.
{% endhint %}

***

## menu.get

```lua
local value = menu.get(path)
```

| Tipo da opção              | Devolve                                          |
| -------------------------- | ------------------------------------------------ |
| boolean                    | `true` / `false`                                 |
| integer / number           | o número                                         |
| string (lista de escolhas) | o **nome** da escolha e a posição dela (1, 2, …) |
| color                      | [color](/documentacao/tipos/color.md)            |
| key                        | nome da tecla ou `nil`                           |
| string (texto)             | o texto                                          |

Um caminho que não existe dá erro.

## menu.set

```lua
menu.set(path, value)
```

Muda a opção como se ela fosse mexida no menu:

* números são limitados ao mínimo e máximo da opção;
* em listas de escolha, use o nome (sem diferenciar maiúsculas) ou a posição;
* em teclas, use um [nome de tecla](/referencia/teclas.md), ou `nil` para limpar;
* em texto, o que passar do tamanho máximo é cortado.

Um valor do tipo errado dá erro.

{% hint style="warning" %}
Se o script muda opções do Perfect, desfaça no callback `unload`, para não deixar a config da pessoa diferente depois que o script parar.
{% endhint %}

## menu.list

```lua
local paths = menu.list([prefix])
```

Lista os caminhos que começam com `prefix`. Sem `prefix`, devolve todos.

```lua
for _, path in ipairs(menu.list("player.esp.enemies.flag")) do
    if menu.info(path).type == "boolean" then
        menu.set(path, true)   -- every flag on (skips the *_color paths)
    end
end
```

## menu.info

```lua
local info = menu.info(path)
```

Devolve uma tabela com:

* `path`;
* `type`: `"boolean"`, `"integer"`, `"number"`, `"string"`, `"color"` ou `"key"`;
* `label`: onde a opção fica no menu.

Números têm também `min` e `max`, e listas de escolha têm `choices`.

```lua
local info = menu.info("legitbot.general.target")
print(info.label)                       --> Legitbot › General › Aimbot › Target
print(table.concat(info.choices, ", ")) --> Head, Neck, Chest, Stomach, Closest
```

***

## Estado do menu

| Função                | Devolve / faz                                                                                           |
| --------------------- | ------------------------------------------------------------------------------------------------------- |
| `menu.is_open()`      | `true` se o menu está aberto                                                                            |
| `menu.set_open(bool)` | Abre ou fecha o menu                                                                                    |
| `menu.accent()`       | A cor de destaque atual, como [color](/documentacao/tipos/color.md); muda com o tema e o modo arco-íris |
| `menu.theme()`        | `"Dark"`, `"AMOLED"`, `"Midnight"`, `"Light"`, `"Christmas"`, `"Halloween"` ou `"Easter"`               |
| `menu.language()`     | `"en"`, `"pt"`, `"es"` ou `"ru"`                                                                        |
| `menu.tab()`          | Nome da aba aberta, como `"Player"` ou `"Scripts"`                                                      |
| `menu.set_tab(name)`  | Abre uma aba pelo nome                                                                                  |
| `menu.rect()`         | `x, y, width, height` da janela do menu, ou `nil`                                                       |

```lua
-- script text in the menu's language
local label = ({ pt = "Inimigo", es = "Enemigo", ru = "Враг" })[menu.language()] or "Enemy"
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.perfectcs2.com/documentacao/api/menu.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
