While it might help I'm not sure that it will. $host and $ip return the host and IP mIRC already know about, and /localhost changes the host and IP mIRC know about.
Changing the lookup method to "Server" in mIRC Options -> Connect -> Local Info should fix it for people who aren't using vhosts/etc.