OK...once change necessary.
Change: var %bad.name = $hget(bad.name,%a)
To: var %bad.name = $hget(bad.name,%a).item

With that change, it should work properly.

If not, then ensure that the names are going into the hash table correctly. You can do this easily, by exiting mIRC or disconnecting from the network, then viewing the file bad.name.hsh which will be in the mIRC directory. This file is in standard text format, so any word processor (eg: notepad, wordpad, Microsoft Word, Word Perfect, etc.) will read it.