Can you show where you save the reals into hash?
Why this:
set udg_patrol_event = 1
set udg_patrol_event = 0
What does this? set udg_patrolUnit = u
And just setting to 0 is not really a solution. Imagine two cases.
1) Patrol point is really 0/0. Would be rarely case, but then it would bug.
2) You don't remove it from the list, but only change the value. So there won't be any check for following action you do:
call IssuePointOrder(u, "attack", LoadReal(hash, id, i+1), LoadReal(hash, id, -i-1))
Got it? xNew and yNew are the coordinates you check for the current waypoint where unit is. You check if they are equal 0.
Then you order unit to go to the next waypoint, which is not checked anymore. So unit will just go to 0/0.
In your case, if user want remove waypoint[index] then I think you have to loop from index to maxIndex and move all waypoints down one by one. And in end set maxIndex = maxIndex - 1.
____________________
If you want something some other solution. Maybe there could be a neat solution if there was something like waypointNext and waypointPrev.
Each waypoint would have one of them, and all would be easy.
For patrol would be just: Order Unit To move to <WayPointNext>.
For removing WayPoint[index] would be: Set WayPointNext[index - 1] = WayPointNext[index]
(so the waypoint before would just link no more to the Waypoint[index] but now to Waypoint[index + 1])
And it's not a big deal, really. We're here to help each other, right?