mIRC Home    About    Download    Register    News    Help

Print Thread
#185880 15/09/07 03:11 PM
Joined: Feb 2007
Posts: 28
F
Fill Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Feb 2007
Posts: 28
I'm currently having some problems with people annoying us. They just keep joining the chan with BIG nicknames ... and I'd like to have a remote that when the nickname had more than 15 letters, the bot KB him.

I have just tried this out:

On *:JOIN:#chan: {
var %usernick $nick
var %maxlength 15
while (%maxlenght < %usernick) {
/ban -uk3600 #chan %usernick Your nick is too big! Please change to a new nickname by typing /nick NewNickHere. [BUMP]
}
}

But the bot gets froze when someone joins the chan and I have to Ctrl+Alt+Del to end the mIRC bot ...

Any suggestions guys?

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Code:

on @*:JOIN:#chan: {
  if ($len($nick) > 15) {
    ban -ku3600 # $nick 3 Your nick is too big! Please change to a new nickname by typing /nick NewNickHere.
  }
}


Last edited by RoCk; 15/09/07 03:31 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Use the code Rock gave you.

And this is why your script froze when you tried it...

You set the %usernick to $nick. So it was the nickname, not the length of the nickname. That's what $len is for. So your While statement checked to see if the nickname (not the length of it) was more than 15 characters. Because of how comparisons work, if you try to check < or > between a number and a word/nick/text, it will always be true. And because you used a While statement, it would keep looping forever. It's much better to use If instead of While if you aren't actually trying to loop through something multiple times.

Btw, you can usually break out of a frozen state by using Ctrl-Break rather than using Ctrl-Alt-Del. Sometimes you'll need to hit it a few times, but it usually works... especially in a case where you're frozen because of a broken loop.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2007
Posts: 28
F
Fill Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Feb 2007
Posts: 28
thanks!

This forum is really helpful, because of you laugh

Yeah I even thought about writing something like $nicklen, actually it is $len($nick ... it's almost the same thing lool...

See ya guys ... and thanks again


Link Copied to Clipboard