跳到主要内容

NPC_IsShooting

注意

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

描述

检查 NPC 是否正在射击。

参数说明
npcidNPC 的 ID

返回值

如果 NPC 正在射击则返回true,否则返回false

示例

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

SendClientMessage(playerid, 0x00FF00FF, "NPC %d 正在射击: %s", npcid, isShooting ? "是" : "否");
return 1;
}
return 0;
}

注意事项

  • 仅在实际射击动作期间返回 true
  • NPC 必须有武器和弹药才能射击

相关函数

相关回调