跳到主要内容

NPC_GetPathPoint

注意

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

描述

获取 NPC 路径中特定点的坐标和停止范围。

参数说明
pathid路径的 ID
point_index点的索引(从 0 开始)
&x用于存储 X 坐标的变量
&y用于存储 Y 坐标的变量
&z用于存储 Z 坐标的变量
&stopRange用于存储停止范围的变量

返回值

成功时返回 true,失败时返回 false

示例

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkpathpoint", 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 pathid = PlayerPatrolPath[playerid];
if (pathid == INVALID_PATH_ID)
return SendClientMessage(playerid, 0xFFFF00FF, "未指定巡逻路径。");

new pointindex = NPC_GetCurrentPathPointIndex(npcid);
new Float:x, Float:y, Float:z, Float:stopRange;

if (!NPC_GetPathPoint(pathid, pointindex, x, y, z, stopRange))
return SendClientMessage(playerid, 0xFFFF00FF, "无法获取路径点。");

SendClientMessage(playerid, 0x00FF00FF, "NPC %d 路径点 %d: %.2f, %.2f, %.2f", npcid, pointindex, x, y, z);
return 1;
}
return 0;
}

注意事项

  • 所有坐标和停止范围参数都通过引用传递
  • 点的索引从 0 开始
  • 若路径或点索引无效则返回 false

相关函数

相关回调