Ugrás a fő tartalomhoz

NPC_GetPathPoint

vigyázat

This function was added in omp v1.5.8.3079 and will not work in earlier versions!

Description

Gets the coordinates and stop range of a specific point in an NPC path.

NameDescription
pathidThe ID of the path
point_indexThe index of the point (starting from 0)
&xVariable to store the X coordinate
&yVariable to store the Y coordinate
&zVariable to store the Z coordinate
&stopRangeVariable to store the stop range

Returns

Returns true on success, false on failure.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkpathpoint", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

if (!NPC_IsValid(npcid))
return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC.");

new pathid = PlayerPatrolPath[playerid];
if (pathid == INVALID_PATH_ID)
return SendClientMessage(playerid, 0xFFFF00FF, "No patrol path assigned.");

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, "Failed to get path point.");

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

Notes

  • All coordinate and stopRange parameters are passed by reference
  • Point indices start from 0
  • Returns false if the path or point index is invalid