跳到主要内容

NPC_IsInfiniteAmmoEnabled

注意

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

描述

检查 NPC 是否启用了无限弹药。

参数说明
npcidNPC 的 ID

返回值

如果启用了无限弹药则返回true,否则返回false

示例

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkinfiniteammo", 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:infiniteAmmo = NPC_IsInfiniteAmmoEnabled(npcid);

SendClientMessage(playerid, 0x00FF00FF, "NPC %d 无限子弹启用: %s", npcid, infiniteAmmo ? "是" : "否");
return 1;
}
return 0;
}

注意事项

  • 无限弹药防止 NPC 耗尽弹药
  • 弹药计数可能仍显示为减少,但武器功能保持正常
  • 可以通过 NPC_EnableInfiniteAmmo 切换

相关函数

相关回调