I tried de-coding your code to see what kind of result you expected: Try this and tell me if this is what you wanted:
Code:
on *:INPUT:#: {
if (: isin $1) {
var %n $left($1,-1)
var %f $fline(#,%n $+ *,0,1)
while (%f) {
var %nick $fline(#,%n $+ *,%f,1).text
msg # &b&k5 $+ %nick $+ &k&b&u:&u $2-
dec %f
}
}
halt
}