When translating your request into Russian language and view the provided code, it seemed to me that you wanted to do something similar to display in your mIRC.
The channel operator executes the command:
/mode #channel +h-kv nick1 key12345 nick2All channel users will see this message:
* @Admin sets mode: +h-kv nick1 key12345 nick2You will see a message like this:
* @Admin sets mode: +h-kv nick1 nick2That is, this script removes the secret key of the channel from the message about set modes. In this case, this will work if this channel key was previously set and can now be unset. The same will be displayed when set the channel key. But hiding the key will only work for those users who have this script code installed, since this message is sent to the chat from the server/services side and you will not be able to change the display of its outgoing data for other users.
Although I would prefer, instead of deleting, to simply replace the key with inscription:
* @Admin sets mode: +h-kv nick1 [hide-key] nick2If I misunderstood your idea and something needs to be fix/changed in this code - let me know about it in a new comment.