Bekar explainded why your code did not work; but I'd suggest the following modification of your code:
; menu
menu nicklist {
Ban Real Name of $$1 : rban $active $$1
}
; set a var for: action, chan and nick
alias rban {
set -eu6 %theop rban
set -eu6 %rban_chan $1
set -eu6 %rban_nick $2
who $2
}
; who reply: if a var for "action rban" is set, and the nick to rban is this nick:
raw 352:*:{
if ((%theop == rban) && (%rban_nick == $6)) {
; ban his realname on the chan stored above, replacging space with underscore
mode %rban_chan +b ~r: $+ $replace($9-,$chr(32),$chr(95))
unset %rban*
}
}
The method will be faster than yours:
- who is faster than whois
- the ban will be set the very moment the raw (352 who reply) had been received.
Notes:
- I think you don't need a if/else check to determine whether there are $chr(32) in the realname or not. If there are no $chr(32), the $replace will nevertheless return the (untouched) realname
- In your code (raw 311): $1 might
by chance be the channel you wanted to set the ban on. I stored the name of the chan in a variable as well, to ensure that. For the same reason; I removed the "ban option" for query popups. Executed out of a query and without further input, your script cannot know on what chan the ban should be set.
Regards