[11:44:29] asAoCw was kicked by Guest17069 (abbass)
[11:44:31] asFiSb was kicked by Guest17069 (abbass)
[11:44:31] asJeXe was kicked by Guest17069 (abbass)
[11:44:31] asJyEs was kicked by Guest17069 (abbass)
[11:44:31] asKmHt was kicked by Guest17069 (abbass)
[11:44:31] asLkXw was kicked by Guest17069 (abbass)
[11:44:31] asNvSx was kicked by Guest17069 (abbass)
[11:44:31] asOcBx was kicked by Guest17069 (abbass)
[11:44:31] asPhLa was kicked by Guest17069 (abbass)
[11:44:31] asQaAo was kicked by Guest17069 (abbass)
[11:44:31] asUuZb was kicked by Guest17069 (abbass)
[11:44:31] asYiVl was kicked by Guest17069 (abbass)
[11:44:31] * asZnKs was kicked by Guest17069 (abbass)
menu Channel {
-
Kick by Nick length:KBL $chan $$len($$?="Enter length") $?="Enter reason"
-
}
alias KBL {
if ($1 ischan) && ($me isop $1) && ($2 isnum 1-) {
var %x = 1
while ($nick($1,%x,r)) {
var %nick = $v1
if ($len(%nick) == $2) { $iif(%nick ison $1,kick $1 %nick $iif($3,$3-,Banned),noop) }
inc %x
}
}
}
pff, I just lol'd when i saw that this guy has posted this snippet here. He came to me last night and asked me to write such a snippet for him. Then he f*cked it and posted it here.
This is the original snippet: http://pastebin.com/GyKcR9Tq
I used "$nick ison $chan" because i had /timer in there, (To not flood the guy off the server) so it might that the person weren't in the channel anymore and it would give error....
I'm not saying that i've written this flawlessly... It might have errors, or not working properly. Honestly, i didn't even test it, i just wrote it quickly to give the guy an idea.
Also, about checking "if ($2 isnum 1-) { ...}", it used to be a /command, that's why i just wanted to make sure that the number is positive (Just like jaytea said.). And after that the guy asked me to add a popup for it either.
Another note: I used "$len($$?="Enter length")" because he said that he want to write ???? (one question mark per character) which is really dumb.. i told him to just write a number but he wanted it like this.. lol
For isnum, and I don't know why you put "1-", you could simply use: if ($2 isnum).
maybe because he wants to ensure $2 is positive? i mean, that much is obvious, but i can't see what else there is to be confused about.
also, i don't understand how you could use the phrase 'you could simply' and then include this in the same post
if ($regex(%n,/(.){ $+ $2 $+ }/)) {
You don't need to check for ischan because you already indicate that in your menu popup. It has to be activated in channel where the client that runs the code is situated. For isnum, and I don't know why you put "1-", you could simply use: if ($2 isnum). Here is my take on your snippet:
menu channel,nicklist {
-
Kick by Nick length:kbl # $$?="Enter length" $$?="Enter reason"
-
}
alias -l kbl {
if ($me isop $1) && ($2 isnum) {
var %x = 1, %n
while ($nick($1,%x,r)) {
%n = $v1
if ($regex(%n,/(.){ $+ $2 $+ }/)) {
kick $1 %n $iif($3,$3-,Banned)
inc %x
}
}
}
}
$$len($$?="Enter length")
This will cause your script not to work properly. If someone enters "10" it will be: $len(10) = 2. And the double $ have no use either if I'm not mistaken.
if ($len(%nick) == $2) { $iif(%nick ison $1,kick $1 %nick $iif($3,$3-,Banned),noop) }
This will kick everyone with the exact length you entered, not the ones who have a nickname longer than it. If you want that, you should use ">=". And you could do the if %nick ison $1 check in the first if statement.
Try this:
if ($len(%nick) == $2) && (%nick ison $1) {
kick $1 %nick $iif($3,$3-,Banned)
}
Note: I did not change "==" to ">=" in this code.