mIRC Home    About    Download    Register    News    Help

Print Thread
#271003 08/11/22 09:27 PM
Joined: Nov 2022
Posts: 6
M
malaje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Nov 2022
Posts: 6
hello i have this script, it works great for bad nick which join or change new nick in room.
could someone help me, when i enter in the room, do a who and kick/ban the bad nick from the user list of that room. thanks.
I'm sorry for my english but i'm spanish and i don't speak english very well. i hope you can understand what i need.
on 1:join:#: {
$BaneaUsuarios($nick,$chan)
}


On *:nick:{
var %a 1 | while ($comchan($newnick, %a)) { $BaneaUsuarios($newnick,$v1) | inc %a }
}


alias BaneaUsuarios {
var %cuentaNicks = 1
while (%cuentaNicks <= $lines(patrones.txt)) {
if ($read(patrones.txt,%cuentaNicks) isin $1) || ($read(patrones.txt,%cuentaNicks) iswm $1) {
var %cuentaExcepciones = 1
while (%cuentaExcepciones <= $lines(patrones-exceptuados.txt)) {
if ($read(patrones-exceptuados.txt,%cuentaExcepciones) isin $1) || ($read(patrones-exceptuados.txt,%cuentaExcepciones) iswm $1) {
halt
}
inc %cuentaExcepciones
}
ban $2 $1 $+ !*@* | kick $2 $1 1Su nick no es el mas adecuado para la tematica del canal 4 $chan 1Por Favor, cambielo. 4Gracias.
halt
}
inc %cuentaNicks
}
}

malaje #271004 09/11/22 12:17 PM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
During ON JOIN there is only you in the nicklist, and you cannot kick until you receive the OP status. So better is to hook the ON OP event, and do the scan at that time.

Since the nicklist exists, and you are not checking the userid for nick!bad-word@company.com you do not need the /who reply.

If I were doing this, I would do it so that the list is not kept on disk, because you are reading a disk file many times for each nick. But, to keep it similar to this way, I make some changes to be more efficient. For example, the file is not changing, so you do not need to keep counting how many lines there are. Also, you do not need to read the same line from the disk file 2 times in order to compare the text against 2 things.

Also I changed it so that it uses /return instead of /halt so that you can check all the nicklist at the same time instead of stopping before finishing.

Also, where you see me using $nick($chan,%i,r) that is how it sees each nick in the nicklist, and the 'r' means 'regular nicks who have no status. If you want to kick ops and voices too, change the 'r' to 'a' which means 'all nicks'. If you want to check both regular nicks and voices, then change 'r' to 'rv'.

You can list the channelname(s) as I did, or to do this in all channels where you are OP, just change that line to be

on *:OP:#:{



Code
on *:OP:#channelname1,#channelname2:{
  if ($opnick != $me) return
  var %i 1
  while ($nick($chan,%i,a) != $null) {
    noop $BaneaUsuarios( $v1 , $chan )
    inc %i
  }
}

alias BaneaUsuarios {
  var %cuentaNicks = 1 , %badwords_total $lines(patrones.txt) , %except_total $lines(patrones-exceptuados.txt)
  while (%cuentaNicks <= %badwords_total) {
    var %linetext $read(patrones.txt,nt,%cuentaNicks)
    if (%linetext isin $1) || (%linetext iswm $1) {
      var %cuentaExcepciones = 1

      while (%cuentaExcepciones <= except_total) {
        var %except_linetext $read(patrones.txt,nt,%cuentaNicks)
        if (%except_linetext isin $1) || (%except_linetext iswm $1) {
          ;halt
          return
        }
        inc %cuentaExcepciones
      }

      ban $2 $1 $+ !*@* | kick $2 $1 1Su nick no es el mas adecuado para la tematica del canal 4 $chan 1Por Favor, cambielo. 4Gracias.
      return
      ;halt
    }
    inc %cuentaNicks
  }

}

maroon #271005 09/11/22 03:16 PM
Joined: Nov 2022
Posts: 6
M
malaje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Nov 2022
Posts: 6
hi maroon, thanks for replying.
i tried the script you posted and now it doesn't do anything neither when the bad nick enters, nor when they change inside the room, nor when i enter and chan gives me Op, it doesn't do anything at all. it doesn't kick in any of the ways.
I just put it as you indicated
on *:OP:#:{
just copy and paste nothing else. thanks again

Last edited by malaje; 09/11/22 03:20 PM.
malaje #271006 09/11/22 03:33 PM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
I didn't say to paste only that line, i said to *CHANGE* the line only if you didn't want to list the specific channels where it should take action.

In my script i gave a line like

on *:OP:#channelname1,#channelname2:{

so you either edit that line to list the channels where this takes action, or you CHANGE that line to instead be

on *:OP:#:{

By pasting only this 1 line, that creates a scripting error that puts the alias inside the ON OP event which should not be. Instead of replacing it, try just editing the #channelname1 word to to be the name of your channel, without putting just that 1 line in your script. Put the whole code block without any changes except changing the #channelname1

maroon #271008 10/11/22 01:28 AM
Joined: Nov 2022
Posts: 6
M
malaje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Nov 2022
Posts: 6
hello again maroon.
I'm sorry if I misspoke, I copied the whole script as you put it, I just modified it about the rooms.

on *:OP:#:{
if ($opnick != $me) return
var %i 1
while ($nick($chan,%i,a) != $null) {
noop $BaneaUsuarios( $v1 , $chan )
inc %i
}
}

alias BaneaUsuarios {
var %cuentaNicks = 1 , %badwords_total $lines(patrones.txt) , %except_total $lines(patrones-exceptuados.txt)
while (%cuentaNicks <= %badwords_total) {
var %linetext $read(patrones.txt,nt,%cuentaNicks)
if (%linetext isin $1) || (%linetext iswm $1) {
var %cuentaExcepciones = 1

while (%cuentaExcepciones <= except_total) {
var %except_linetext $read(patrones.txt,nt,%cuentaNicks)
if (%except_linetext isin $1) || (%except_linetext iswm $1) {
;halt
return
}
inc %cuentaExcepciones
}

ban $2 $1 $+ !*@* | kick $2 $1 1Su nick no es el mas adecuado para la tematica del canal 4 $chan 1Por Favor, cambielo. 4Gracias.
return
;halt
}
inc %cuentaNicks
}

}





and it doesn't work in any way, neither by entering or changing inside the room, let alone by me entering the room and putting on my @

malaje #271009 10/11/22 02:08 AM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
And I'm sorry too, I had played too fast and loose with copy paste, and I accidentally used the same filename for the excluded as used for the allowed, so it was working but was always excluding everyone. So this should work. But also remember about using the 4th parameter of $nick() to exclude the ops. It will avoid the need to add their nicks to the exclusion list, and it also makes the loop smaller because there are fewer nicks to check

Code
on *:OP:#:{
  if ($opnick != $me) return
  var %i 1
  while ($nick($chan,%i,a) != $null) {
    noop $BaneaUsuarios( $v1 , $chan )
    inc %i
  }
}

alias BaneaUsuarios {
  var %cuentaNicks = 1 , %badwords_total $lines(patrones.txt) , %except_total $lines(patrones-exceptuados.txt)
  while (%cuentaNicks <= %badwords_total) {
    var %linetext $read(patrones.txt,nt,%cuentaNicks)
    if (%linetext isin $1) || (%linetext iswm $1) {
      var %cuentaExcepciones = 1

      while (%cuentaExcepciones <= %except_total) {
        var %except_linetext $read(patrones-exceptuados.txt,nt,%cuentaNicks)
        if (%except_linetext isin $1) || (%except_linetext iswm $1) {
          ;halt
          return
        }
        inc %cuentaExcepciones
      }
      ban $2 $1 $+ !*@* | kick $2 $1 1Su nick no es el mas adecuado para la tematica del canal 4 $chan 1Por Favor, cambielo. 4Gracias.
      return
      ;halt
    }
    inc %cuentaNicks
  }

}


maroon #271016 11/11/22 01:13 AM
Joined: Nov 2022
Posts: 6
M
malaje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Nov 2022
Posts: 6
Hello Maroon, thanks for the detail again, the truth is that I didn't realize it either.
In principle, what I requested works, now what he stopped doing is what the one I left brought: ban when entering and changing inside the room, thanks again.

PS: I added this,

on 1:join:#: {
$BaneaUsuarios($nick,$chan)
}


On *:nick:{
var %a 1 | while ($comchan($newnick, %a)) { $BaneaUsuarios($newnick,$v1) | inc %a }
}



I tried it and it works bans when they enter and when they change inside the room. Do you think that what I have done is correct?
What I haven't tried in a room with between 200 to 400 users and I can flood ban massively.
thanks again. waiting if you think something else

Last edited by malaje; 11/11/22 01:42 AM.
malaje #271017 11/11/22 02:21 AM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
Yes, this looks like it's what you had already, so it should continue to work if it already worked, if these are in the same script with my additions and edits. If I had added an ON JOIN handler, it would need to be combined with your existing one. When I want to make certain that an event happens to everyone, I use "*" instead of "1" for the level, to make sure that someone in level 0 is also affected.

However, these events are not specifying a channel name, so they would attempt to activate in all channels you are inside, so if you visit another channel and they make you an op, they may not appreciate you starting to kick and ban there. That was why my examples were listing the channel(s) where it would take effect.

See /help event prefixes
for the ! or @ prefix that can avoid having events trigger when you join or you change nick, or which do not trigger unless you have @op level

In fact, it should work better now, because your original BaneaUsuarios alias used /halt, which means that your loop for the nick change would have halted after checking the 1st channel and would not do anything in the other channels.

Yes it can be a problem if you need to a lot of kicking and banning. One way to help keep yourself from flooding out is to make sure that tools/options/irc/flood has the box checked 'enable flood protect'. I believe that also checking 'op commands' would apply to putting these kicks and bans into the que, so that they might be delayed to prevent you from sending too many too quickly. As for the other settings, you might need to adjust some of them to make your server happy, if you get flooded off anyways.

Something else that might work is a script that helps combine several mode commands together instead of sending individually, so instead of sending
mode #channel +b nick1_mask
mode #channel +b nick2_mask

... you could send
mode #channel +bb nick1_mask nick2_mask

... and this should count as 1 ban by the server flood controls. You can google for keywords mirc pushmode
and find it on hawkee. I haven't used it, so I can't vouch for it. I did help someone once using a script that called a pushmodex alias, so they apparently found reason to modify it, but if this works it should also help avoid flooding you off.

I say I can't vouch for a script I have not used, because there have been some cases of hawkee or other scripts not working or worse. For example, I had 2 times when someone came for help with a cricket game script that didn't work. It turned out the script was written so that you couldn't start a game without a specific variable already set, but the script wouldn't let you set the variable unless that same variable was already set. Another time there was a script that claimed to be a channel protection script, but it had socket code inside that put you into their hidden socket bot army.

Another place you can find scripts is at the .info site I mentioned here https://forums.mirc.com/ubbthreads.php/topics/270675/re-question-to-the-chat-logs#Post270675
and if there isn't a decent pushmode style of script there already, i'll ask around and see if one can be added

maroon #271030 12/11/22 12:24 AM
Joined: Nov 2022
Posts: 6
M
malaje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Nov 2022
Posts: 6
Thanks for answering and contributing those ideas Maroon
I've been looking and trying what you're saying and the pushmode I can't hit the key gives me an error on the server that I'm in chatzona puts an unknown command smile let's see if I have time this weekend and I go into a large room and try to see what happens . Thanks again for the help provided, any help will be well received. Thank you

Last edited by malaje; 12/11/22 12:27 AM.
malaje #271031 12/11/22 05:26 AM
Joined: Jan 2004
Posts: 1,944
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
Uh, not sure what key you're talking about. Mode is not a key on the keyboard, it's the name of a script. You can search on google for "pushmode mirc" without the quotes, and it finds a script of that name on hawkee, and there's no button pushing involved. It's a script that reduces your chance of flooding by combining bans like "mode +bb #channel nick1mask nick2mask"

Something else you need to be aware of is that your ban list is not an infinite free lunch, and there will come a point where the ban fails because the list is full. If you type
/version
most networks will repeat the message they show during CONNECT which shows their settings.
there should be something like MAXLIST=beI:100 which means the banlist exceptionlist invitelist are all limited to 100. If that's not there, it probably has some other unknown limit, and you might need to make a dummy channel to see how many you can stuff into it before it stops actually adding them.
Once the banlist is full, you'll either need to delete older ones, or find a way to combine some
Unfortunately you can't trust the dates listed, because each time you recover from a netsplit, it changes the banning nick to the server name and changes the timestamp


Link Copied to Clipboard