How to make stop NPC from looping through waypoints.

I’m using a script from this forum post

http://forum.unity3d.com/threads/54678-A-Waypoint-Script-Explained-in-Super-Detail!

When the character gets to the last waypoint it turns around and goes to the firs one. HO can I modify this so that the character stops?

private var stopWaypointLoop: boolean;
function Start ()
{
functionState = 0;
stopWaypointLoo = false;
}

function Update () 
{
    if(stopWaypointLoop == false)
    {
         if (functionState == 0) 
         {
             Accell (); 
         }

         if (functionState == 1)
         {
             Slow ();
         }
         waypoint = waypoints[WPindexPointer]; 
    }
}

function OnTriggerEnter ()
{
    functionState = 1; 
    WPindexPointer++;  

    if (WPindexPointer >= waypoints.Length)
    {
        stopWaypointLoop = true; // when the NPC reaches last waypoint, with this code we stop it from doing that.
        WPindexPointer = 0; // NPC keeps going on waypoints.

    }

}