---
title: "NPC_StopPlayingNode | open.mp"
description: "停止 NPC 的节点播放。"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_StopPlayingNode
language: zh-CN
---

# NPC\_StopPlayingNode

注意

这个函数是在omp v1.5.8.3079中添加的，在以前的版本中不起作用！

## 描述

停止 NPC 当前节点的播放。

| 参数 | 说明 |
| --- | --- |
| npcid | NPC 的 ID |

## 返回值

如果 NPC 成功停止则返回`true`，否则返回`false`。

## 示例

```c
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/npcstopnode", true))
    {
        new npcid = PlayerNPC[playerid];
        if (npcid == INVALID_NPC_ID)
            return SendClientMessage(playerid, 0xFF0000FF, "你没有在调试NPC。");

        if (!NPC_IsValid(npcid))
            return SendClientMessage(playerid, 0xFF0000FF, "无效的NPC。");

        new bool:success = NPC_StopPlayingNode(npcid);

        SendClientMessage(playerid, 0x00FF00FF, "NPC %d 停止节点：%s", npcid, success ? "成功" : "失败");
        return 1;
    }
    return 0;
}
```

## 注意事项

-   NPC 将在节点中的当前位置停止
-   如果 NPC 没有在播放节点，此函数返回`false`
-   节点保持打开状态，可以被其他 NPC 使用
-   使用 `NPC_IsPlayingNode` 检查 NPC 是否在播放节点

## 相关函数

-   [NPC\_PlayNode](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_PlayNode): 让 NPC 播放节点
-   [NPC\_IsPlayingNode](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_IsPlayingNode): 检查 NPC 是否在播放节点
-   [NPC\_PausePlayingNode](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_PausePlayingNode): 暂停节点播放
-   [NPC\_ResumePlayingNode](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_ResumePlayingNode): 恢复节点播放

## 相关回调

-   [OnNPCFinishNode](https://omp.itsneufox.com/zh-CN/docs/scripting/callbacks/OnNPCFinishNode): NPC 完成节点时调用
