|
Joined: Dec 2002
Posts: 25
Ameglian cow
|
OP
Ameglian cow
Joined: Dec 2002
Posts: 25 |
How do I ban bad ident when someone connect to a channel or the server?
|
|
|
|
Joined: Dec 2002
Posts: 144
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 144 |
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
|
|
|
|
Joined: Dec 2002
Posts: 25
Ameglian cow
|
OP
Ameglian cow
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 }
|
|
|
|
Joined: Dec 2002
Posts: 4
Self-satisified door
|
Self-satisified door
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 }
|
|
|
|
Joined: Dec 2002
Posts: 164
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 164 |
This line gets the User ID from a host of a nick (in the ON JOIN Event):
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) SET %BadWordList word1,word2,word3 and then use a WHILE loop and
IF ($istok(%BadWordList,%getuid,44)) { appropriate action here } Hopefully this points you into the right direction
DALnet: #HelpDesk, #mIRC, #MISHScript - Undernet: #mIRC, #mIRC-Scripts
|
|
|
|
Joined: Dec 2002
Posts: 25
Ameglian cow
|
OP
Ameglian cow
Joined: Dec 2002
Posts: 25 |
I try to use the codes above, it didn't work.
#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.
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
Merlin was correct.
#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).
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
|
|
|
|
Joined: Dec 2002
Posts: 25
Ameglian cow
|
OP
Ameglian cow
Joined: Dec 2002
Posts: 25 |
thx hammer, I hope this will work this time.
|
|
|
|
Joined: Dec 2002
Posts: 339
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 339 |
wouldn't something like if (*!*badident*@* iswm $fulladdress) || (*!*otherbadident*!*@* iswm $fulladdress) || be more simple??
|
|
|
|
Joined: Dec 2002
Posts: 2,985
Hoopy frood
|
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.
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Dec 2002
Posts: 191
Vogon poet
|
Vogon poet
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
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
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.
; 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:
; 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
|
|
|
|
Joined: Dec 2002
Posts: 191
Vogon poet
|
Vogon poet
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.
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
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) if $matchtok(%BadUserIDs,$remove($ial($nick).user,~),1,33) {
.raw $+(MODE $chan +b *!*,$ifmatch,@*,$crlf,KICK $chan $nick :,%BadUserID.KickMessage)
}
|
|
|
|
|