---
title: "NPC_StopMeleeAttack | open.mp"
description: "Impede que um NPC execute ataques corpo a corpo."
canonical: https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_StopMeleeAttack
language: pt-BR
---

# NPC\_StopMeleeAttack

aviso

Esta função foi adicionada no omp v1.5.8.3079 e não funcionará em versões anteriores!

## Descrição

Impede que um NPC execute ataques corpo a corpo.

| Nome | Descrição |
| --- | --- |
| npcid | O ID do NPC |

## Retornos

Retorna `true` se a operação foi bem-sucedida, caso contrário, `false`.

## Exemplos

```c
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/npcstopmelee", true))
    {
        new npcid = PlayerNPC[playerid];
        if (npcid == INVALID_NPC_ID)
            return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

        if (!NPC_IsValid(npcid))
            return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC.");

        new bool:success = NPC_StopMeleeAttack(npcid);

        SendClientMessage(playerid, 0x00FF00FF, "NPC %d stop melee attack: %s", npcid, success ? "Success" : "Failed");
        return 1;
    }
    return 0;
}

```

## Notas

-   Isso interrompe imediatamente qualquer animação de ataque corpo a corpo em andamento
-   O NPC retornará à sua posição normal
-   Não tem efeito se o NPC não estiver atacando no momento

## Funções Relacionadas

-   [NPC\_MeleeAttack](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_MeleeAttack): Iniciar ataque corpo a corpo
-   [NPC\_IsMeleeAttacking](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_IsMeleeAttacking): Verifique se NPC está atacando
-   [NPC\_SetFightingStyle](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_SetFightingStyle): Definir estilo de luta
-   [NPC\_GetFightingStyle](https://omp.itsneufox.com/pt-BR/docs/scripting/functions/NPC_GetFightingStyle): Obtenha estilo de luta

## Callbacks Relacionadas

-   [OnNPCGiveDamage](https://omp.itsneufox.com/pt-BR/docs/scripting/callbacks/OnNPCGiveDamage): Chamado quando NPC causa dano a alguém
