---
title: "NPC_IsReloading | open.mp"
description: "检查 NPC 是否正在换弹。"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_IsReloading
language: zh-CN
---

# NPC\_IsReloading

注意

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

## 描述

检查 NPC 是否正在换弹。

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

## 返回值

如果 NPC 正在换弹则返回`true`，否则返回`false`。

## 示例

```c
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/checkreloading", 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:isReloading = NPC_IsReloading(npcid);

        SendClientMessage(playerid, 0x00FF00FF, "NPC %d 正在换弹: %s", npcid, isReloading ? "是" : "否");
        return 1;
    }
    return 0;
}
```

## 注意事项

-   仅在实际换弹动画期间返回 true
-   弹夹中弹药耗尽时自动换弹
-   使用 NPC\_EnableReloading 控制换弹行为

## 相关函数

-   [NPC\_EnableReloading](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_EnableReloading): 启用/禁用换弹
-   [NPC\_GetAmmoInClip](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_GetAmmoInClip): 获取弹夹中的弹药
-   [NPC\_GetWeaponReloadTime](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/NPC_GetWeaponReloadTime): 获取换弹时间

## 相关回调

-   [../callbacks/OnNPCWeaponShot](https://omp.itsneufox.com/zh-CN/docs/scripting/callbacks/OnNPCWeaponShot): NPC 开火时调用
