Well firstly, go back to the post where you found it,
Here, and make it look the same as Watchdog posted instead of being all in one long line.
In the on text event, "/set %dns.nick $2"
Then in the on *:dns: event, check "if $dns(0).nick == %dns.nick" var that you set in the text event.