You can try using this variant of the script:
on *:TEXT:*words*:#chan:{ .ban -k $chan $nick 3 | .mode $chan +b $+(*!*,$remove($gettok($address($nick,0),1,64),*,!),*@*) }
Step-by-step explanation of the sequence of actions:
1.
$address($nick,0) - this returns the mask of the address of the user who is on the channel. More details:
Here 2.
$gettok($address($nick,0),1,64) - this returns 1 mask token, separated by "
@". More details:
Here 3.
$remove($gettok($address($nick,0),1,64),*,!) - this will cut out all the extra characters. More details:
Here 4.
$+(*!*,$remove($gettok($address($nick,0),1,64),*,!),*@*) - this adds any required wildcards to the identifier. More details:
HereThe correct syntax for the user address mask is: "
nick!ident@host"