---
title: "NPC_RemovePointFromPath | open.mp"
description: "Removes a waypoint from an NPC path."
canonical: https://omp.itsneufox.com/docs/scripting/functions/NPC_RemovePointFromPath
language: en
---

# NPC\_RemovePointFromPath

warning

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

## Description

Removes a waypoint from an NPC path.

| Name | Description |
| --- | --- |
| pathid | The ID of the path |
| point\_index | The index of the point to remove |

## Returns

Returns `true` on success, `false` on failure.

## Examples

```c
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strncmp(cmdtext, "/removepatrolpoint ", 19, true))
    {
        if (!NPC_IsValidPath(PlayerPatrolPath[playerid]))
        {
            SendClientMessage(playerid, 0xFF0000FF, "No valid patrol path. Use /createpatrol first.");
            return 1;
        }

        new pointIndex = strval(cmdtext[19]);
        new totalPoints = NPC_GetPathPointCount(PlayerPatrolPath[playerid]);

        if (pointIndex < 0 || pointIndex >= totalPoints)
        {
            SendClientMessage(playerid, 0xFF0000FF, "Invalid point index. Valid range: 0-%d", totalPoints - 1);
            return 1;
        }

        if (NPC_RemovePointFromPath(PlayerPatrolPath[playerid], pointIndex))
        {
            SendClientMessage(playerid, 0x00FF00FF, "Removed point %d from path %d (now has %d points)", pointIndex, PlayerPatrolPath[playerid], totalPoints - 1);
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000FF, "Failed to remove point %d from path", pointIndex);
        }
        return 1;
    }
    return 0;
}
```

## Notes

-   Point indices start at 0
-   Removing a point will shift all subsequent points down by one index
-   If the specified index is out of bounds, the function will return `false`
-   You cannot remove points from an invalid path

## Related Functions

-   [NPC\_AddPointToPath](https://omp.itsneufox.com/docs/scripting/functions/NPC_AddPointToPath): Add a point to a path
-   [NPC\_ClearPath](https://omp.itsneufox.com/docs/scripting/functions/NPC_ClearPath): Clear all points from a path
-   [NPC\_GetPathPointCount](https://omp.itsneufox.com/docs/scripting/functions/NPC_GetPathPointCount): Get number of points in a path
-   [NPC\_GetPathPoint](https://omp.itsneufox.com/docs/scripting/functions/NPC_GetPathPoint): Get information about a path point

## Related Callbacks

-   [OnNPCFinishMovePath](https://omp.itsneufox.com/docs/scripting/callbacks/OnNPCFinishMovePath): Called when NPC finishes moving along a path
-   [OnNPCFinishMove](https://omp.itsneufox.com/docs/scripting/callbacks/OnNPCFinishMove): Called when NPC finishes any movement
