Chuyển tới nội dung chính

NPC_ClearPath

cảnh báo

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

Description​

Clears all points from an NPC path, making it empty.

NameDescription
pathidThe ID of the path to clear

Returns​

Returns true on success, false on failure.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/clearpatrol", true))
{
// Get the number of points before clearing
new count = NPC_GetPathPointCount(PlayerPatrolPath[playerid]);

// Try to clear the path
if (NPC_ClearPath(PlayerPatrolPath[playerid]))
{
SendClientMessage(playerid, 0x00FF00FF, "Cleared path %d (%d points removed)", PlayerPatrolPath[playerid], count);
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "Failed to clear path");
}

return 1;
}
return 0;
}

Notes​

  • This function removes all waypoints from the specified path
  • The path itself remains valid and can be reused
  • Any NPCs currently following this path will stop moving