跳到主要内容

NPC_SetNodePoint

注意

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

描述

为 NPC 节点设置当前点索引。

参数说明
nodeid节点的 ID
pointid节点中的点索引

返回值

如果点设置成功则返回true,否则返回false

示例

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/npcsetnodepoint ", true, 17))
{
new nodeid = strval(cmdtext[17]);

if (nodeid < 0 || nodeid > 63)
return SendClientMessage(playerid, 0xFF0000FF, "无效的节点ID。必须在 0 ~ 63 之间。");

new idx = 17;
while (cmdtext[idx] != ' ' && cmdtext[idx] != '\0') idx++;
while (cmdtext[idx] == ' ') idx++;

if (cmdtext[idx] == '\0')
return SendClientMessage(playerid, 0xFF0000FF, "用法:/npcsetnodepoint [节点id] [点id]");

new pointid = strval(cmdtext[idx]);

new bool:success = NPC_SetNodePoint(nodeid, pointid);

SendClientMessage(playerid, 0x00FF00FF, "设置节点 %d 为点 %d: %s", nodeid, pointid, success ? "成功" : "失败");
return 1;
}
return 0;
}

注意事项

  • 在设置点之前必须打开节点
  • 点索引通常从 0 开始
  • 使用 NPC_GetNodePointPosition 检索点坐标

相关函数

相关回调

此函数不会触发任何特定的回调。