That would be correct. $address will hold the [email]userid@host[/email] part, and $fulladdress will hold the full nick!userid@host.
You can then use $mask (qv) to do the masking of the $fulladdress: $mask($fulladdress,2)
I assume that you have each command on a separate line, too, rather than all on the one line:
on *:text:*:?: {
var %s.chan = #chat
if ($nick !ison %s.chan && $me isop %s.chan) {
var %nick.addr = $mask($fulladdress,2)
var %cnt = $nick(%s.chan,0)
while (%cnt) {
if ($address($nick(%s.chan,%cnt),2) == %nick.addr) {
ban -ku3600 %s.chan $nick(%s.chan,%cnt) 2 Relay Spammer Detected
}
dec %cnt
}
}
}