# Attachment Sanitization

O **Attachment Sanitization** é uma proteção que impede manipulações indevidas de attachments entre entidades. No entanto, alguns scripts legítimos precisam fazer attach entre jogadores (ex: carregar, algemar, transportar).

## Quando Desativar

Você deve desativar o Attachment Sanitization quando:

* Um jogador **carrega** outro jogador
* Sistemas de **algemas** ou **amarras**
* Scripts de **transporte de prisioneiros**
* Qualquer interação que faça **attach entre dois jogadores**

## Como Usar

### Para um jogador

```lua
-- Desativar antes do attach
TriggerClientEvent("AttachmentSanitization", source, false)

-- ... realizar o attach ...

-- Reativar após desanexar
TriggerClientEvent("AttachmentSanitization", source, true)
```

### Para dois jogadores (interação entre eles)

{% hint style="warning" %}
Quando há interação entre dois jogadores, você **deve** desativar para **ambos**!
{% endhint %}

```lua
-- Desativar para ambos os jogadores
TriggerClientEvent("AttachmentSanitization", source, false)
TriggerClientEvent("AttachmentSanitization", otherSource, false)

-- ... realizar o attach entre os jogadores ...

-- Reativar para ambos
TriggerClientEvent("AttachmentSanitization", source, true)
TriggerClientEvent("AttachmentSanitization", otherSource, true)
```

## Exemplo Prático — Sistema de Algemas

```lua
-- Ao algemar
RegisterServerEvent("algemas:algemar")
AddEventHandler("algemas:algemar", function(alvoId)
    local source = source
    
    -- Desativar proteção para ambos
    TriggerClientEvent("AttachmentSanitization", source, false)
    TriggerClientEvent("AttachmentSanitization", alvoId, false)
    
    -- Trigger do attach
    TriggerClientEvent("algemas:aplicar", source, alvoId)
end)

-- Ao desalgemar
RegisterServerEvent("algemas:soltar")
AddEventHandler("algemas:soltar", function(alvoId)
    local source = source
    
    -- Reativar proteção para ambos
    TriggerClientEvent("AttachmentSanitization", source, true)
    TriggerClientEvent("AttachmentSanitization", alvoId, true)
    
    -- Trigger do detach
    TriggerClientEvent("algemas:remover", source, alvoId)
end)
```


---

# Agent Instructions: 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://eqpg-network.gitbook.io/eqpg-docs/guias-de-integracao/attachment-sanitization.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.
