> 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/exemplos/perfil-por-mapa.md).

# Perfil por mapa

Guarda o skybox e a terceira pessoa de cada mapa e aplica sozinho quando você entra nele. Mostra:

* `menu.get` e `menu.set` em opções do Perfect, incluindo uma cor (`:to_hex()` para salvar);
* `engine.map_name()`;
* `client.notify`;
* `storage` com uma chave por mapa.

Salve como `map_profile.lua` na pasta de scripts e ligue na aba **Scripts**.

```lua
-- @name Map Profile
-- @author perfect
-- @version 1.0
-- @description Remembers the skybox and third person for each map.

ui.group("Map Profile", "Saved per map")
local current = ui.text("Map", "Not in a match")

ui.button("Save for this map", "Stores the current skybox and third person", function()
    local map = engine.map_name()
    if not map then return end
    storage.set(map .. ".skybox", menu.get("world.skybox"))
    storage.set(map .. ".skybox_color", menu.get("world.skybox_color"):to_hex())
    storage.set(map .. ".third_person", menu.get("world.third_person"))
    client.notify("Map Profile", "Saved for " .. map, "success")
end, "Save")

local function apply(map)
    if storage.get(map .. ".skybox") == nil then return end
    menu.set("world.skybox", storage.get(map .. ".skybox"))
    menu.set("world.skybox_color", color(storage.get(map .. ".skybox_color")))
    menu.set("world.third_person", storage.get(map .. ".third_person", false))
    client.notify("Map Profile", "Applied the profile for " .. map)
end

-- Applies the profile once each time the map changes.
local applied_for = nil
callbacks.add("draw", function()
    local map = engine.is_in_game() and engine.map_name() or nil
    current:description(map or "Not in a match")
    if map and map ~= applied_for then
        applied_for = map
        apply(map)
    end
end)
```

Configure o mundo como quiser em cada mapa e clique em **Save**. Da próxima vez que entrar no mesmo mapa, o perfil é aplicado.


---

# 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/exemplos/perfil-por-mapa.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.
