Whenever you want to use/add any command to script code, it is recommended to first study the syntax and also look at the examples to understand how this command works and what it does in order to use it correctly or perhaps you need to choose another command that is suitable for implementing your idea.
The provided code uses these commands: "
var", "
while", "
if", "
ban", "
inc". You can find all the information about these and other commands in the help documentation.
The full list of available built-in mIRC commands is here:
https://en.wikichip.org/wiki/mirc/commandsSo, to set a ban only on a nick, by the specified mask, try replacing
ban $chan $nick($chan,%i)
with
mode $chan +b $+(*,$nick($chan,%i),*!*@*)
Leave a comment if this helped solve problem or not.