mIRC Home    About    Download    Register    News    Help

Print Thread
#411 09/12/02 12:48 AM
Joined: Dec 2002
Posts: 25
K
KennyJ Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2002
Posts: 25
How do I ban bad ident when someone connect to a channel or the server?

#412 09/12/02 04:34 AM
Joined: Dec 2002
Posts: 144
D
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2002
Posts: 144
Code:
On @*:JOIN:#channelname:{
  var %_ident = $gettok($gettok($fulladdress,1,$asc(@)),2,$asc(!))
  if (whateverbadword isin %_ident) { ban # $nick 2 | kick # $nick bad ident }
}

Replace "#channelname" with the name of the channel that you're an op in. Replace "whateverbadword" with whatever ident you want to get banned.

I apologize if I'm using $asc() but I actually don't have a copy of mIRC available for me to verify the appropriate ASCII numbers for the respective characters. However, this should work.


"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
#413 09/12/02 06:11 AM
Joined: Dec 2002
Posts: 25
K
KennyJ Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2002
Posts: 25
HOw do I set it multi bad ident(cussing words)?

Like this.. and so on?

if (badword1 isin %_ident) (badword2 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }

#414 09/12/02 06:39 AM
Joined: Dec 2002
Posts: 4
S
Self-satisified door
Offline
Self-satisified door
S
Joined: Dec 2002
Posts: 4
Almost...

You need to have an OR between the conditions.

OR = ||

Like this:

if (badword1 isin %_ident) || (badword2 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }



Three "badwords" would be:

if (badword1 isin %_ident) || (badword2 isin %_ident) || (badword3 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }


You could also set up a list of "badwords" in a text file, read each one into the script line by line, then test to see if it exists in the ident. you would need to use $read $lines to accomplish this. If you have a long list of words, this would save a little time and programming, but for a short list the if statements would be easier.

--------------------------------------------------------------------------
//HOw do I set it multi bad ident(cussing words)?

//Like this.. and so on?

//if (badword1 isin %_ident) (badword2 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }



#415 09/12/02 07:51 AM
Joined: Dec 2002
Posts: 164
M
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 164
This line gets the User ID from a host of a nick (in the ON JOIN Event):
Code:
 
VAR %getuid = $remove($gettok($gettok($fulladdress,1,64),2,33),~) 

make a variable holding bad words (or write into a ini-file and later used $readini)
Code:
 SET %BadWordList word1,word2,word3 

and then use a WHILE loop and
Code:
 
IF ($istok(%BadWordList,%getuid,44)) {  appropriate action here }  

Hopefully this points you into the right direction smile


DALnet: #HelpDesk, #mIRC, #MISHScript - Undernet: #mIRC, #mIRC-Scripts
#416 10/12/02 03:19 AM
Joined: Dec 2002
Posts: 25
K
KennyJ Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2002
Posts: 25
I try to use the codes above, it didn't work.

Code:
#badident on
on @*:join:#: {  
  var %_ident = $gettok($gettok($fulladdress,1,$asc(@)),2,$asc(!))  
  if badword1 isin %_ident || $&
    badword2  isin %_ident || $&
    badword3  isin %_ident || $&
    badword4  isin %_ident || $&
    badword5  isin %_ident || $&
    badword6  isin %_ident || $&
    badword7  isin %_ident || $&
    badword8  isin %_ident || $&
    badword9  isin %_ident || $&
    badword10 isin %_ident || $&
    badword11 isin %_ident || $&
    badword12 isin %_ident || $&
    badword13 isin %_ident { 
      ban # $nick 2
      kick # $nick 0,1Please change your IDENT! then type /join # 
  }
}
#badident end

I even put the (badword isin %_ident) || (badword2 isin %_ident) still doesn't work.. even I put
on !@*:join:#:
on @*:join:#:
Still doesn't work.. any one know why?

EDIT: reformatted the long line for this forum and changed the obviously offensive words; changed one $1- to %_ident; no other changes. -Hammer

Last edited by Hammer; 09/03/03 10:28 PM.
#417 10/12/02 09:12 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Merlin was correct.
Code:

#BadIdent on
on @!*:JOIN:#:{
  ;
  ; Edit this line to add new bad userid's to your list, separated by exclamation marks (ASCII 33).
  var %BadUserIDs = pitch!clay!dirt!mud!slime!gross!horrid!yukky!realbad!worse
  ;
  ; Edit this line to modify your kick message.
  var %KickMessage = Please change your IDENT! Then reconnect to apply the change before you /join $chan again!
  ;
  if ($istok(%BadUserIDs,$remove($gettok($gettok($fulladdress,2,33),1,64),~),33) {
    ;
    ; This line bundles the BAN and KICK commands into a single data packet (faster)
    .raw $+(MODE $chan +b $address($nick,2),$crlf,KICK $chan :,%KickMessage)
  }
}
#BadIdent end

Of course, It makes sense that, if you're going to do such a list of bad idents/nicks/vhosts/whatever, that you're also going to have to manage them somehow. That management is best done outside of the in JOIN event. Probably something along the lines of a small system of code to manage a variable called %BadUserIDs and the same would apply to the kick message (%BadUserID.KickMessage). At that point, the code above simplifies to a single line script (split onto multiple lines for forum formatting).
Code:

on @!*:JOIN:#:{
  if ($istok(%BadUserIDs,$remove($gettok($gettok($fulladdress,2,33),1,64),~),33)) {
    .raw $+(MODE $chan +b $address($nick,2),$crlf,KICK $chan :,%BadUserID.KickMessage)
  }
}


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#418 10/12/02 11:31 PM
Joined: Dec 2002
Posts: 25
K
KennyJ Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2002
Posts: 25
thx hammer, I hope this will work this time.

#419 13/12/02 09:56 PM
Joined: Dec 2002
Posts: 339
F
Fjord artisan
Offline
Fjord artisan
F
Joined: Dec 2002
Posts: 339
wouldn't something like
Code:
if (*!*badident*@* iswm $fulladdress) || (*!*otherbadident*!*@* iswm $fulladdress) ||
be more simple??

#420 08/03/03 06:34 PM
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
When you ban them, ban this *!userid@* instead of *!*@address, otherwise they can't rejoin when they have mended their ways. grin

#421 09/03/03 09:28 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Good point, Watchdog.

on @!*:JOIN:#: if ($istok(%BadUserIDs,$remove($gettok($gettok($fulladdress,2,33),1,64),~),33)) .raw $+(MODE $chan +b *!*,$ifmatch,@* $nick,2),$crlf,KICK $chan :,%BadUserID.KickMessage)


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#422 09/03/03 11:25 AM
Joined: Dec 2002
Posts: 191
N
Vogon poet
Offline
Vogon poet
N
Joined: Dec 2002
Posts: 191
i thought $istok returned $true or $false depending if the token existed or not and you could remove one $gettok using $address in place of $fulladdress

#423 09/03/03 11:22 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Remember that %BadUserIDs contains a list of "words", tokenized on the ! character, such as:

%BadUserIDs = pitch!clay!dirt!mud!slime!gross!horrid!yukky!realbad!worse

Obviously, the ! character cannot be used in an ident, so it's a good choice to separate them.
Code:
;  Chop off the nick!
var %userid = $gettok($fulladdress, 2, 33)
 
;  Chop off @host 
%userid = $gettok(%userid, 1, 64)
 
;  And remove any leading ~ from the userid
%userid = $remove(%userid, ~)
 
;  Find a matching token number, if present
var %N = $findtok(%BadUserIDs, %userid, 1, 33)
 
;  And finally, grab the token from %BadUserIDs
var %BadUserID = $gettok(%BadUserIDs, %N, 33)
 
;  After all that, see if %BadUserID contains anything
if %BadUserID != $null {

All of that is exactly the same as this:
Code:

;  Doing it in one fell swoop
if $gettok(%BadUserIDs, $findtok(%BadUserIDs, $remove($gettok($gettok($fulladdress,2,33),1,64),~), 1, 33), 1, 33) != $null {

$istok() returns $true or $false, perfect for a conditional statement. Either their userid is present in its full form in %BadUserIDs or it's not. There is no need to $gettok() it at all - you don't really care which one they matched. If you did, you could have the same functionality by using $findtok() to get the token number and using that inside your $gettok(). However, if $istok() matches in my original way, then you can simply use their userid to ban with. You will have the same effect.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#424 10/03/03 12:06 AM
Joined: Dec 2002
Posts: 191
N
Vogon poet
Offline
Vogon poet
N
Joined: Dec 2002
Posts: 191
the reference to $istok returning $true or $false was more in relation to the $ifmatch in the ban mask,

.raw $+(MODE $chan +b *!*,$ifmatch,@* $nick,2),$crlf,KICK $chan :,%BadUserID.KickMessage)

where the $ifmatch would always add $true in the identd, not the bad identd as intended.

#425 10/03/03 12:09 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Heh. I have no clue why $ifmatch snuck in there. It certainly wasn't in the original versions I wrote. :tongue: Definitely my bad, though.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#426 10/03/03 03:38 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
$matchtok() will return the token instead of the tokens position in the string
$ial($nick).user or $gettok($address,1,64) return the same as $gettok($gettok($fulladdress,2,33),1,64)
Code:
if $matchtok(%BadUserIDs,$remove($ial($nick).user,~),1,33) {
  .raw $+(MODE $chan +b *!*,$ifmatch,@*,$crlf,KICK $chan $nick :,%BadUserID.KickMessage)
}


Link Copied to Clipboard