mIRC Home    About    Download    Register    News    Help

Print Thread
#182706 13/08/07 03:35 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Can someone make a nonsense nick kick using regex to ban on join and on change to newnick?
Exemple: wgkp or qznr so ban nicks with 4 big letters or more?
Well dosent have to be regex but whatever you think is better.

Last edited by Garou; 13/08/07 03:39 PM.
Garou #182714 13/08/07 05:16 PM
Joined: Jan 2004
Posts: 509
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } | else { set %count 0 } | if (%count >= 4) { return $true } | inc %c } | return $false }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

on @*:JOIN:#:if $israndom($nick) { ban -k # $nick 2 Random nick. }

Garou #182715 13/08/07 05:25 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
This thread is a related request (regarding nonsense nick detection): click

Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx it works fine....Anyway it can be turn on/off ?

Garou #182722 13/08/07 07:59 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Use e.g. a group arround the on join event:
Code:
#nonsense off
on @*:JOIN:#: {
  ...stuff...
}
#nonsense end


Then, you can add a menu definition to toggle that group:
Code:
menu channel {
  kick nonsense nicks $+($chr(91),$group(#nonsense),$chr(93))
  .$iif(($group(#nonsense) == on),$style(1)) on : .enable #nonsense 
  .$iif(($group(#nonsense) == off),$style(1)) off : .disable #nonsense 
}


Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx Horstl.

Garou #182794 14/08/07 08:35 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
It turn on and off but i dont think its counting right cause its kicking under the set limit of 7

Code:
  on @*:JOIN:#:{
if $israndom($nick) || (%consonant == off) || (!%consonant) { return } 
{ ban -ku600 # $nick 2 14Random Nick Detected }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } | else { set %count 0 } | if (%count >= 7) { return $true } | inc %c } | return $false }

Joined: Mar 2006
Posts: 47
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Mar 2006
Posts: 47
Originally Posted By: LostShadow
Code:
alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } |  else { set %count 0 } | if (%count >= 4) { return $true } | inc %c } | return $false }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

on @*:JOIN:#:if $israndom($nick) { ban -k # $nick 2 Random nick. }


This does the same thing:
Code:
on @*:JOIN:#:if (!$regex($nick,a|e|i|o|u)) ban -k # $nick 2 Random nick.


Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Anyway, if you want to use your original code: there was a wrong syntax in the on join event.
The first opening bracket should not be in this line:
Code:
{ ban -ku600 # $nick 2 14Random Nick Detected }

And, imho it should be:
Code:
on @*:JOIN:#:{
    if (($israndom($nick)) && (%consonant == on)) { ban -ku600 # $nick 2 14Random Nick Detected } 
}

It's more clear to let for the script ban the user if 1) he has a random nick AND 2) the switch "%consonant" is toggled "on", than checking for "%consonant being off or no value for the %consonant switch at all, then do not proceed to the banning part". smile

Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Its not kicking?
Code:
 


on @*:JOIN:#chat:{
    if (($israndom($nick)) && (%consonant == on)) { ban -ku600 # $nick 2 14Random Nick Detected }

alias isconsonant { var %consonant = bcdfghjklmnpqrstvwxyz | return $iif($1 isin %consonant,$true,$false) }

alias israndom { var %c = 1 | var %count = 0 | while (%c <= $len($1)) { if ($isconsonant($mid($1,%c,1))) { inc %count } | else { set %count 0 } | if (%count >= 6) { return $true } | inc %c } | return $false }





Garou #182816 15/08/07 04:48 AM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
There is a missing closing brace in the join event.

Garou #182817 15/08/07 04:49 AM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
This time, there was a bracket missing in the on join event... smile
Here's a working piece of code. I perkily made some minor changes, too:
- merged and redrafted "israndom" and "isconsonant" aliases
- excluded the y char, as this may be used as a "vowel" in nicks
cool
Code:
; kick nicks containing 6 (or more) consonants in a row
on @*:JOIN:#chat:{
  if (($israndom($nick)) && (%consonant == on)) { ban -ku600 # $nick 2 14Random Nick Detected }
}


alias -l israndom {
  var %nr = 1, %count
  while ($mid($1,%nr,1)) { 
    if ($v1 isletter bcdfghjklmnpqrstvwxz) {
      inc %count
      if (%count >= 6) { return $true }
    }
    else { var %count = 0 }
    inc %nr
  }
  return $false
}

Tip: Don't overdo using |'s in your code. It makes the code harder to read and harder to debug - especially if you merge multiple { } brackets and/or if-then-else constructions in one line.

Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx very much...Its working great.


Link Copied to Clipboard