That script has a bunch of syntax issues and other things wrong with it.

What about using this one?

https://forums.mirc.com/ubbthreads.php/topics/245941