mIRC Home    About    Download    Register    News    Help

Print Thread
#209581 18/02/09 10:03 AM
Joined: Jun 2004
Posts: 124
S
sigbin Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 124
Code:
on *:JOIN:#channel: {
  if (!$hget(badnick)) hmake badnick 10
  var %i = 1
  while ($gettok($badnick,%i,32)) {
    if ($+(*,$gettok($badnick,%i,32),*) iswm $nick) {
      if ($nick !isop $chan) {
        hinc badnick $nick
        var %badnick = $gettok($badnick,%i,32)
        if ($hget(badnick,$nick) == 1) .ban # $nick $+ !*@* 2 75 change nick (forbidden nick: %badnick $+ )
      }
    }
    inc %1
  }
}


how can i make this script work without the incrementation of the variable "%i" anyone?

and one more thing can anyone help me to change this script to work in change nick like when a user change nick to a badnick it will be kicked or banned or warned...

thankz in advanced

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Sorry, this script is incomplete. You are missing a badnick alias. Also, at the very bottom, I think it needs to say /inc %i. Not %inc 1.

Not sure what your issue is but possibly this will fix it for you? Personally, I think you will achieve your best result by describing the result you are hoping for.

As for nick change.


on *:nick:{
if ($hget(badnick,$newnick)) { .ban # $newnick $+ !*@* 2 75 change nick (forbidden nick: $newnick $+ )
}

Now I dont know if this will match your list. Also, Im not sure in the nick event if you would kick $nick or $newnick.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
on *:NICK: { 
  if ($hget(badnick,$newnick)) {
    var %n = $comchan($newnick,0)
    while (%n) { if ($me isop $comchan($newnick,%n)) {
        ban -k $comchan($newnick,%n) $newnick 2 please change nick (forbidden nick)
      }
      dec %n
    }
  }
}
on *:START:if (!$hget(badnick)) hmake badnick 100
on *:PART:hsave -o badnick badnick.hsh
on *:DISCONNECT:hsave -o badnick badnick.hsh

So basically you just enter:
Code:
/hadd -m badnick <badnick here> 1
to add a bad nick. Then every time someone matches a bad nick you've added in the hash tables, he or she will be kicked and banned upon a nick change.

Joined: Jun 2004
Posts: 124
S
sigbin Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 124
that script was from another script i just compiled it then i was hoping that it will just have a 1 command to perform the 2nd command where it will perform the second command...

here is the whole script look like
Code:
alias badnick {
  return badnick1 badnick2 badnick3

on *:JOIN:#channel: {
  if (!$hget(badnick)) hmake badnick 10
  var %i = 1
  while ($gettok($badnick,%bnk,32)) {
    if ($+(*,$gettok($badnick,%i,32),*) iswm $nick) {
      if ($nick !isop $chan) {
        hinc badnick $nick
        var %badnick = $gettok($badnick,%i,32)
        if ($hget(badnick,$nick) == 1) command 1
        if ($hget(badnick,$nick) == 2) command 2
      }
    }
    inc %i
  }
}


i was hoping the second will be removed and the variable "i" be remove also because it will be useless... i hope i stated the thing i want in this script...

i was also hoping that another script that will ban a nick that will match the alias list of bad nick...

Last edited by sigbin; 18/02/09 11:30 AM.
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
No offense, but I don't see the need of hash tables in your code, along with your alias. Removing the variable %i in your script will break the script and result an infinite loop. Why not just do this:
Code:
on *:JOIN:#: {
  var %i = $nick(#,0)
  while (%i) {
    if ($istok(badnick1 badnick2 badnick3 badnick4,$nick(#,%i),32)) {
      ban -k # $nick 2 please change nick (forbidden nick)
    }
    dec %i
  }
}

and without the while loop:
Code:
on *:JOIN:#: {
  var %badnick = badnick1 badnick2 badnick3 badnick4
  if ($istok(%badnick,$nick,32)) { ban -k # $nick 2 please change nick (forbidden nick) }
}

Code:
on *:NICK: {
  var %badnick = badnick1 badnick2 badnick3 badnick4
  if ($istok(%badnick,$newnick,32)) { ban -k # $newnick 2 please change nick (forbidden nick) }
}

Also, I'm not clear on what you mean by first command and second command.

Joined: Jun 2004
Posts: 124
S
sigbin Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 124
how about this one ive diiged up my old script and this what i found...

Code:
on *:NICK: {
  if $nick(#channel,$newnick,a,o) {
    var %bcnk = 1
    while $gettok($badnick,%bcnk,32) {
      if $+(*,$gettok($badnick,%bcnk,32),*) iswm $newnick {
        hinc -m badnick $newnick
        var %badnick = $gettok($badnick,%bcnk,32)
        if ($hget(badnick,$newnick) == 1) command 1
        if ($hget(badnick,$newnick) == 2) command 12
      }
    }
    dec %bcnk
  }
}


its okay now.. i fixed it

thankz for the answer guys

Last edited by sigbin; 18/02/09 02:35 PM.
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Thats cool you fixed it. I just wanted to talk real quick about retrieving information.

When storing data I try to store it to make it the quickest and easiest to return. So this script should have a list of nicknames. There are a few ways of doing this. I do not suggest a while loop for this.

You were shown $istok which is a great way to check here.

I can have a variable like.

%badnick = nick1,nick2,nick3,nick4

then I can check

if ($istok(%badnick,$nick,44)) { }

Alot less code and easier on mIRC than a while loop in the join event.

What I was going to suggest though, is that since you already have a hash table, instead of using a while loop to scan through the table, why not set the nicknames as the item names.

So: /hadd badnick $nick $chan

$chan isnt important. I would store any information I may need in my script. If there wasn't any additional info I needed I may just make it $true.

The diffence is, instead of a while loop, all you say is:

if ($hget(badnick,$nick)) { ban --- }


On an aside, your new script here sets the variable at 1, then dec's it. This will only run through the loop once since when it gets to the first time to dec %i it will change to 0 and end. If this is indeed your intention I'd get rid of the loop. Otherwise you probably want the total number of nicknames or something, then dec those. OR start at 1 and INC the variable until it returns a $null value.


Cheers and have fun!



Joined: Jun 2004
Posts: 124
S
sigbin Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 124
i just wanted to remove the while loop since i dont want a second command to be executed... but if i cant remove it then ill just remove the 2nd command... its working even with a 1 coomand... i hope you understand what im saying...

Joined: Feb 2009
Posts: 5
L
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2009
Posts: 5
Code:
on !*:JOIN:#:{
  var %x = 1
  while (%x <= $lines($mircdirbnicks.txt)) {
    if ($read(bnicks.txt,%x) iswm $nick) {
      kick $chan $nick Bad nick. < $+ $read(bnicks.txt,%x) $+ >
      ban $chan $address($nick,3)
    }
    inc %x
  }
}

alias checknicks {
  var %x = 1
  while (%x <= $lines($mircdirbnicks.txt)) {
    var %i = 1
    while (%i <= $nick($chan,%i)) {
      if ($read(bnicks.txt,%x) iswm $nick($chan,%i)) {
        kick $chan $nick($chan,%i) Bad Nick. < $+ $read(bnicks.txt,%x) $+ >
        ban $chan $nick($chan,%i)
      }
      inc %i
    }
    inc %x
  }
}

on !*:NICK:{ checknicks }

i hope this helps


Link Copied to Clipboard