See help on mIRC, topic: On DNS.. i think you'll find your answer there.

(hint)
The $dns(N) identifier
This identifier can be used only in the on DNS event, and returns the address that was resolved and any associated IP addresses.



-mike