as mentioned by Animan8000 and by point #5 of the thread, you're pressing buttons too fast and your game can't handle it, you need to slow down
quick solution, just add this line inside of your "freezing loop":5. The default SetBatchLines value makes your script sleep around 10-15.6 milliseconds every line. Make it -1 to not sleep (but remember to include at least one Sleep in your loops to avoid high CPU waste!).
DllCall("Sleep","UInt",1)