This is having the same problem as a similar script you were asking about months ago. If you want to catch the 1st nick, then you need to keep track of all nicks for all messages, just in case one of them happens to get repeated later. This script is only taking action when the hash is repeated, without having saved the nick who did the original hash.
And as I'll remind you of what I mentioned the last time, that kicking the original nick would give great opportunity for lolz, where all I need to do to get someone kicked also - is to repeat what they innocently put into a channel message.
* *
Some things you might take a look at:
1. burcmo is excluding italic and strikethru. If your intent is to remove all control codes, then that 2nd parm can just be skipped.
2. Curious why you're limiting $2- to 400, and not just using the entire string. As a spammer, i can send a message where $left($2-,400) is different each time, followed by my repeated spam beginning at position 401 of $2-. Plus, you're limiting to 400 before stripping the controlcodes, so the string seen by $hash could be very short if someone used a lot of control codes
3. The script should be updated to use a different hash instead. For one thing, it's easy to create 2 different strings which match the same $hash(string,32) value. These match, and if you insert the same string in front of both examples, then those match each other too:
//echo -a $base($hash(ABCDEF,32),10,16) / $base($hash(ABDDEE,32),10,16)
For another thing, there are only 2^24 possible $hash(string,32) values, so you're better off using $crc($strip($2-),0). And if you're worried about someone creating intentional collisions, which can be done in a few seconds with $crc, you can make it a little harder with $crc(secret constant $strip($2-),0) and can have a simple mechanism to change the 'secret' daily
Something fairly fast and less likely to have a false match is:
alias md5hash { return $right( $base($right($md5($1),13),16,36) , $iif($2 isnum 1-11,$2,11) ) }
This squeezes 2^52 possible hashes into a 1-11 digit hash, and you can use $2 if you want to shorten it even further. Or if string space isn't an issue you can just store the whole hash. Even though MD5 has been discredited from a crypto standpoint, that's because of the ease involved in creating 2 binary strings that match each other, but I've yet to find an example where someone has created an MD5 collision between 2 UTF8 text strings, and even the existing MD5 collisions take longer to create than your -z countdown.
4. Just confirming your intent is to halt all irccloud messages rather than just /return
5. You may want to switch to putting this all in a hash table. These are values which don't need to be a global variable that exists the next time mIRC restarts, which requires an ON START even to clear them up. Because if mIRC crashes after the variable is written to vars.ini and before it reaches zero, that variable will exist as a %global that's not in the -z countdown, just waiting to match someone.
Also, if you switch to using a hashtable, you can create hashtable items and check their values using $+(protect.r.,$chan,.,$chan,.,%h) without needing to use any compound braces at all, which means your scripts will be a lot easier for you to read later. Plus, since this is data that does not need to be saved for the next session, that's no problem because the hashtable doesn't get saved to disk unless you use /hsave.