Since $hfile is not part of mIRC (unless it's a hold over from a much older version), then that is what we call a custom identifier, which, in turn, calls for information from an alias, in this case, called hfile.
Check your script for a line that reads:
or
If you don't have either of those, then you're missing part of the script.
Looking at that script, and checking the help file, it appears that someone has things a bit mixed up, as the /sound command is not meant for playing sounds. That's the /splay command.
Try replacing that line with
.&Play Wav: .splay $$sfile($wavedir)
and add the following to the code
on *:waveend:{
.msg $active $me just played $filename
}