ON *:PART:#: { do this }
This will trigger when you part a channel. Not when you EXIT mIRC nor when you disconnect from a network.
ON *:EXIT: { do that }
This will trigger when mIRC Closes. aka when you EXIT mIRC
ON *:DISCONNECT: { do the other thing }
This will trigger when you disconnect from a network. Also triggers when you exit mIRC because it disconnects from networks when it closes. But for mIRC Exit use ON *:EXIT:
ON *:QUIT: { do something }
Triggers when other users quit from a network.