Does mIRC just STOP/HALT executing your script, or does mIRC completely FREEZE? If mIRC is freezing up as a result of your code, it is probably getting stuck in an infinite loop somewhere. If there are no loops in that event or and of the aliases that it calls, then maybe you have another event which is causing the problems. To confirm which event is causing the problems, just add a /return line to the top of ONE event at a time and then reconnect. When you add /return to an event and the problem stops, you know which event caused the problem. You can also try adding this line to the top of your first onCONNECT event:

/debug @debug

That will allow you to see if any commands are being sent to the server and if they are being accepted properly.

-genius_at_work