mIRC Home    About    Download    Register    News    Help

Print Thread
#243710 15/12/13 11:22 PM
L
LCX
LCX
L
I'm sure there is, and sorry if this has been asked before or covered (although I could not seem to find anything that fit what I'm seeking to do either here or anywhere) but is there a way to set up a script that would kick and/or ban a user when they join your channel based on another room they happen to have joined?

Thanks.

Joined: Mar 2004
Posts: 342
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Mar 2004
Posts: 342
it is possible.
you would need to have a variable or token list of 'bad channels' and then when a user joins your channel, you would ask services on the net for extended who is information about the nickname, and compare the information back, against the list of bad channels. check the mIRC scripting sites, many scripts are available that do this.

Z
zaza
zaza
Z
on *:join:#yourchannel:{
whois $nick
}
raw 319:*#badchannel *:{
ban #yourchannel $2
kick #yourchannel $2 reason
}

L
LCX
LCX
L
zaza, thank you for the script assist.

J
jaystew
jaystew
J
Just to add to this.....

I made this script for someone else and it could be of some use for you, At the moment zaza's script checks the user on joining your channel and then that's it. So if the user joins your channel, the script checks the user and bans them if they are in a bad channel and will leave them alone if there not.

This means the user can join your channel 1st, then join the bad channel and the script will not know as it only checks once on joining. The below code will check the user on joining your channel and then will recheck every 30 minutes and will ban the user for 15 minutes if found in a bad channel. (times can be changed)

Change the YOURCHANNEL to your channel name and the *BADCHANNEL* to the name of the bad channel, make sure the * stays on the front and end of the name.

Code:


on *:join:#: {
  if ($chan == #YOURCHANNEL) { .timer $+ $nick 0 1800 .whois $nick | .whois $nick } 

}
on *:part:#: {
  if ($chan == #YOURCHANNEL) { .timer $+ $nick off }

}
on *:quit: { 
  { .timer $+ $nick off }

}
raw 319:*: {
  if *BADCHANNEL* iswm $1- { .ban -ku900 #YOURCHANNEL $2 2 Banned for 15 minutes for being in a bad channel | timer $+ $2 off } 



If you want to add more than one bad channel just copy this section and place it at the very end of the script and change the *BADCHANNEL*

Code:

 if *BADCHANNEL* iswm $1- { .ban -ku900 #YOURCHANNEL $2 2 Banned for 15 minutes for being in a bad channel | timer $+ $2 off }



Hope this helps laugh

L
LCX
LCX
L
Thanks jaystew, I'll give yours a try since zaza's script since it seems more direct and what I want overall, and since it seems I screwed up putting it in cause it didn't work for me.

J
jaystew
jaystew
J
smile Cool, Hope it works ok for you

L
LCX
LCX
L
Ok, I've given it a shot. Question regarding the whole BADCHANNEL part. For example if I wanted to ban those who happened to be in a channel called #help, would I change BADCHANNEL to *help* or *#help*?

Thanks.

Joined: Feb 2003
Posts: 3,412
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,412
You should use the # sign.

L
LCX
LCX
L
Odd, I have it without the # sign and it works fine.

J
jaystew
jaystew
J
Hey

Sorry for the delay....... True it is odd, As i had it without the # infront of the room name, but i have tested it and it works with and without it.

It maybe safer to use it with #roomname im not sure, maybe someone could explain this to us both why this has occurred, but i have used a similar script for a while and it doesn't have the # in front of it and doesn't seem to cause no problems.

Any suggestions / advise would be appreciated.

smile

L
LCX
LCX
L
Don't know if adding this question here is better or if I should start a new topic, but would a script like this or similar work on specific nicknames or words in nicknames like Guest?

J
jaystew
jaystew
J
Hey

This is not fully my code, I got the on nick part from a tutorial page as I couldn't work it out.

Load into remotes, if a user joins a room with a guest nick then it will kick and ban them for 15 minutes. If they join your channel then do /nick guest it will kick and ban for 15 minutes (the times can be changed and can make it so it kicks only, but would be advise to ban for a short period weather its only 2 minutes etc just to stop any flood joins happening)

Code:
on @*:join:#: {
  if (Guest* iswm $nick) {
    .ban -ku900 # $nick 2 No Guest nicks allowed, /nick NewNickname
  }
}
on *:nick: {
  if (Guest* iswm $newnick) { 
    VAR %i = 0
    WHILE (%i < $comchan($newnick,0)) { 
      INC %i 
      IF ($me isop $comchan($newnick,%i)) {
        .ban -ku900 $comchan($newnick,%i) $newnick 2 Banned for 15 minutes, Guest nicks are not allowed, /nick NewNickname to change your name. 
      }
    }
  }
}



If you want to add more names to the list say for example anyone with word happy , moody or sexy in the name do the following

Code:

if ((happy* iswm $newnick) || (moody* iswm $newnick) || (sexy* iswm $newnick)) {



L
LCX
LCX
L
I'll give that one a try. Thanks again for the assist.

L
LCX
LCX
L
Sorry for the double post but the anti-guest script works. Was wondering, would that guest script work with tweaks to aim at specific names to do other things, like grant voice to certain peoples (since I can't figure out how to get chanserv to do that for me...)?

J
jaystew
jaystew
J
Hello

Yes something like this would do it - Just change my nickname, your nickname and Nick to the nicknames you want to auto voice on join.

User who is giving voice needs to be opped.

Code:
 

on @*:join:#: {
  if ($nick == JayStew) || ($nick == LCX) || ($nick == Nick) {
    .mode $chan +v $nick  }
}


Just add another
Code:
 || ($nick == NICKNAME) 
to the end of the line (before the {

Also if a total stranger enters the room with one of the nicks above they would be voiced even if it isn't that person, You could also use something to voice by the users host rather than nick maybe? Depends what your prefer

J
jaystew
jaystew
J
To add to this here's another way - If you are placing it in a bots mIRC use version 1 if you are placing it in your own mIRC use version 2


Version 1 - To add or delete user from auto voice list you must be a channel op.


VERSION 1

Code:

on *:TEXT:*:#:{
  if ($1 == !autovoice) && ($nick isop $chan) {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: !autovoice <nick> | halt }
    if ($2 !== $null) {
      if ($readini(autovoice.ini, $2, AutoVoice) !== $null) { .notice $nick User already exists in the AutoVoice list | halt }
      if ($comchan($2,0) == 0) { .notice $nick To add a user you must bring them to a channel were I am too. | halt }
      else { 
        writeini -n autovoice.ini $2 AutoVoice 100
        writeini -n autovoice.ini $2 Hostmask $mask($address($2,2),2)
        .notice $nick Added $2 to my AutoVoice list.
      }
    }
  }

  if ($1 == !DelAutoVoice) && ($nick isop $chan)  {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: !DelAutoVoice <nick>. | halt }
    if ($2 !== $null) {
      if ($readini(autovoice.ini, $2, AutoVoice) == $null) { .notice $nick $2 doesn't appear to be in my autovoice list. | halt }
      else {
        .remini autovoice.ini $2
        .notice $nick AutoVoice for $2 has been removed.
      }
    }
  }
}
on *:JOIN:#:{  
if ($readini(autovoice.ini, $nick, AutoVoice) == 100){  .mode $chan +v $nick } 
}



Commands :

!AutoVoice nickname -adds user to autovoice list
!DelAutoVoice nickname - Deletes user from autovoice nickname



VERSION 2

Code:

alias autovoice {
  if ($1 == $null) { .echo -a Command incomplete. Syntax: /autovoice <nick> | halt }
  if ($1 !== $null) {
    if ($readini(autovoice.ini, $1, AutoVoice) !== $null) { .echo -a User already exists in the AutoVoice list | halt }
    if ($comchan($1,0) == 0) { .echo -a To add a user you must bring them to a channel were I am too. | halt }
    else { 
      writeini -n autovoice.ini $1 AutoVoice 100
      writeini -n autovoice.ini $1 Hostmask $mask($address($1,2),2)
      .echo -a Added $1 to my AutoVoice list.
    }
  }
}

alias DelAutoVoice {
  if ($1 == $null) { .echo -a Command incomplete. Syntax: /DelAutoVoice <nick>. | halt }
  if ($1 !== $null) {
    if ($readini(autovoice.ini, $1, AutoVoice) == $null) { echo -a $1 doesn't appear to be in my autovoice list. | halt }
    else {
      .remini autovoice.ini $1
      .echo -a AutoVoice for $1 has been removed.
    }
  }
}

on *:JOIN:#:{  
if ($readini(autovoice.ini, $nick, AutoVoice) == 100){  .mode $chan +v $nick } 
}




Commands:

/autovoice nickname - Adds nickname to auto voice list
/DelAutoVoice nickname - Deletes nickname from auto voice list

L
LCX
LCX
L
Thank you, thank you again for all your help.
This should cover everything I hopefully need in regards to all that. smile


Link Copied to Clipboard