|
Joined: Mar 2004
Posts: 359
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2004
Posts: 359 |
I need a kicker where if someone is on a channel that matches words in a text file it will kick ban them.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Start -> Run -> wordpad -> paste code -> copy code to Scripts Editor, tab Remote (alt+r). [*] /chans_list - Lists the bad channels. [*] /chans_add <channel> - Adds a bad channel. [*] /chans_rem <channel> - Removes a bad channel. I've included a channel popup to: - Enable/disable the script - Add/remove a channel to the protection list menu channel {
Badchan Checker
.$iif($group(#badchans) == off,$style(2)) $iif($istok(%protchans,#,32),Remove,Add) protection for #:{
if $istok(%protchans,#,32) {
%protchans = $remtok(%protchans,#,1,32)
echo -ac info * Removed # from the list of protected channels
}
else {
%protchans = %protchans #
echo -ac info * Added # to the list of protected channels
}
}
.$iif($group(#badchans) == on,Disable,Enable):{
if $group(#badchans) == on) { disable #badchans | chans_save }
else { enable #badchans | chans_load }
}
}
[color:red] [/color]
#badchans on
on *!:JOIN:%protchans: .enable #chancheck | whois $nick
on *:START: chans_load
on *:EXIT: chans_save
#badchans end
[color:red] [/color]
#chancheck off
raw 318:*: haltdef | .disable #chancheck
raw 319:*: haltdef | chans_check $2-
raw *:*: if $istok(301 307 310 311 312 313 317 320 401,$numeric,32) { haltdef }
#chancheck end
[color:red] [/color]
alias chans_noprefix var %a, %b = $regsub($1-,/(?:^|\s)([^#]+)/g,$chr(32),%a) | return %a
[color:red] [/color]
alias chans_check {
var %chans = $chans_noprefix($2-), %a = 1
while $gettok(%chans,%a,32) {
if $hget(chans,$v1) { chans_comkick $1 | return }
inc %a
}
}
[color:red] [/color]
alias chans_comkick {
var %a = $comchan($1,0), %b
while $comchan($1,%a) {
%b = $v1
if $istok(%protchans,%b,32) && $me isop %b && $1 !isop %b {
ban -k %b $1 2 You are on a forbidden channel.
}
dec %a
}
}
[color:red] [/color]
alias chans_load {
if !$isfile(chans.txt) {
echo -asc info * Could not find chans.txt. Creating new file...Done.
write chans.txt
}
hmake chans
hload chans chans.txt
}
[color:red] [/color]
alias chans_save hsave chans chans.txt | hfree chans
[color:red] [/color]
alias chans_add {
hadd chans $$1 1
echo -ac info * Added $1 to list of bad channels
}
[color:red] [/color]
alias chans_rem {
hdel chans $$1
echo -ac info * Deleted $1 from list of bad channels
}
[color:red] [/color]
alias chans_list {
var %a = 1
echo -asc info ### Listing bad channels ###
while $hget(chans,%a).item {
echo -as * $v1
inc %a
}
}
[*] You probably already have a text file with all the bad channels in it, each on a seperate line. We'll have to convert it to make it work with the script. Add these 2 aliases, put your text file in the mircdir, change "yourfile.txt" to the actual name in the alias chans_convert, close the mIRC editor, and type /chans_convert alias chans_convert filter -fk yourfile.txt chans_convert2 alias -l chans_convert2 write chans.txt $+($1,$lf,1) [*] The script will only scan on channels that are in the protected list (%protchans), and while performing the comchan kick, it will also only kick from common channels who are in %protchan. I added this option because it is possible that you are an op in a channel, where they do not want to use a bad channel kicker. Enjoy.
|
|
|
|
Joined: Mar 2004
Posts: 359
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2004
Posts: 359 |
I don't have a previous text file of channels, and I can't get it to work. I've typed /chans_add #test to see if it would work (it was enabled)..didn't get any error, yet no kick/ban
EDIT: I also tried on a seperate client.
Last edited by LostServ; 13/11/04 04:43 AM.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Did you restart your mIRC before trying that? Because, as you can see, the hash table has to be created and everything in the on start event.
So to start the script, type /chans_load, or restart your mIRC.
Also, did you add the channel to %protchans with the channel popup? Right click in a channel where you want the script to scan on join, and then test it.
Also, don't forget, it will not kick a user that is an op, so if you are using your clone that gets oped or something, the script won't kick it.
I've tested the script, prior to posting it, so it should work. Btw I used the operator $v1, so this will only work in mIRC 6.16, don't know if you're aware.
Gonna go to bed now, its almost 6 am and I'm getting tired :P
Greets
EDIT: I've changed it so that if you enable/disable the script through the channel popup, that it will also load/unload the channels immediately, rather than through the on start/exit events. So you ought to recopy the whole script, as I've altered the chans_save alias as well.
Gone.
|
|
|
|
Joined: Mar 2004
Posts: 359
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2004
Posts: 359 |
Thanks, working good.
What if I wanted it to do the kickban where if a user joins and they are on a channel that has the word sex in it?
Last edited by LostServ; 13/11/04 05:30 AM.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi,
that's possible, if you just change the following in the alias chans_check:
if $hget(chans,$v1) { ...
to
if $hfind(chans,$v1,1,W) { ...
And then simply add wildcarded strings to the hash table, using /chans_add.
Examples:
/chans_add *sex* --> match with "sex" in any position of the channel name /chans_add *lol --> match with "lol" at the end of the channel name /chans_add #lame* --> match any channel that starts with #lame in its name /chans_add #xteensx -> match the channel named #xteensx /chans_add #123? -> match the channel named #123 followed by any character ...
Enjoy.
Gone.
|
|
|
|
Joined: Mar 2004
Posts: 359
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2004
Posts: 359 |
Working great, thanks! ![laugh laugh](/images/graemlins/mirc/laugh.gif)
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Gone.
|
|
|
|
Joined: Jan 2005
Posts: 1
Mostly harmless
|
Mostly harmless
Joined: Jan 2005
Posts: 1 |
hi .. i 'm new to mIRC scripting; i installed your code in mIRC 6.16 and its dropdown options ('Add ..channel to list' and 'Disable' appear, and all indications are that its running. I had made your modif to 'search' for strings within channel names, btw.
When activated for a channel, 'whois' is shown automaticlly upon each join, but immediately returns the last line in the following 4 lines of a sample 'whois' text:
••• <nick> is <whoever> ••• <nick> on EfNet.org ••• <nick> on #mircscripts ••• ········································ ••• Server does not recognize IF command
( The " IF " in the error line 4 above is actually preceded by the square 'box' character (dont have an ansi chart, sorry!)
The commands " chans_list , chans_add , " etc, DO seem to work, yet no user entering the channel with a whois contianing a 'bad chan' string is ever kicked .... the only response seems to be the above 4th line of the 'whois' .
I have another script loaded ( PnP ) which likes to be 'first' in the order of script loading, and i've placed your code at alternate locations , with no effect. Could i have inadvertently mistyped something in your code?
I must note that the series of communications re: your code here includes a comment you made where you suggested 're-copying' your code, a consequence of your having fixed a prob or two ..yet there's no ref about from where to copy. Where is the latest code to be found?
thanks so much for putting this together .. if/when it works for me it'll be a great advantage: ive searched everywhere for any code that'd do what yours is intended to do and am very grateful for your work ..thank you!
tkjtkj
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi, I had an offday when I posted this code, there was actually later on another thread about another person who had copied it and had some issues. Then i added some changes to make it better, and now you can copy the final version. Try to copy paste exactly as you see here, and put it in a brand new remote file. You are running PnP? I think PnP is not compatible with 6.16 though, so that can definitely give errors. What you are getting is not because of the code, no one including myself whotested it had those errors afaik. If it still doesnt work, then try to test it on a fresh clean 6.16, with no other scripts loaded, see what that does. In order to copy paste go to Start -> Run -> type "wordpad" without the quotes, paste the code there, then copy the code from there to -> mIRC Scripts Editor -> alt+r -> Remote, new remote file. You have probably already added some channels to the protection list by right clicking a channel and adding them. In the original script I made an error there, so you are going to have to do the following: In the mirc where you load the code, if you've already added channels, then in the command line type: //set %protchans $replace(%protchans,$chr(32),$chr(44)) This will replace the spaces in %protchans between channel names to commas, so that all channels will match properly on the on join event. If there are more problems to get it working, let me know. For completeness' sake, again an overview of the features of the script: - /chans_list - Lists the bad channels.
- /chans_add <channel> - Adds a bad channel.
You can add wildcarded strings (although you don't have to) to the hash table with this command.
Examples:
/chans_add *sex* --> match with "sex" in any position of the channel name /chans_add *lol --> match with "lol" at the end of the channel name /chans_add #lame* --> match any channel that starts with #lame in its name /chans_add #xteensx -> match the channel named #xteensx /chans_add #123? -> match the channel named #123 followed by any character - /chans_rem <channel> - Removes a bad channel.
- Script is off when you load it. To enable it: right click a channel.
- Script only works on channels that you have added to the "Protection" list, by right clicking the channel you want to protect, and add it.
menu channel {
-
Badchan Checker
.$iif($group(#badchans) == off,$style(2)) $iif($istok(%protchans,#,44),Remove,Add) protection for #:{
if $istok(%protchans,#,44) {
%protchans = $remtok(%protchans,#,1,44)
echo -ac info * Removed # from the list of protected channels
}
else {
%protchans = $addtok(%protchans,#,44)
echo -ac info * Added # to the list of protected channels
}
}
.-
.$iif($group(#badchans) == on,Disable,Enable):{
if $group(#badchans) == on { .disable #badchans | chans_unload }
else { .enable #badchans | chans_load }
}
}
[color:red] [/color]
#badchans off
on @*:JOIN:%protchans:{
hinc -mu2 chancheck $+($cid,#)
if $hget(chancheck,$+($cid,#)) < 5 {
hadd chancheck $nick 1
.enable #chancheck
whois $nick
}
}
on *:START: chans_load
on *:EXIT: chans_unload
#badchans end
[color:red] [/color]
#chancheck off
raw 318:*:{
if $hget(chancheck,$2) {
haltdef
hdel chancheck $2
if !$hget(chancheck,0).item { .disable #chancheck }
}
}
raw 319:*: if $hget(chancheck,$2) { haltdef | chans_check $2- }
raw *:*: if $hget(chancheck,$2) && $istok(301 307 310 311 312 313 317 320 330,$numeric,32) { haltdef }
#chancheck end
[color:red] [/color]
alias chans_noprefix var %a, %b = $regsub($1-,/(?:^|\s)([^#]+)/g,$chr(32),%a) | return %a
[color:red] [/color]
alias chans_check {
var %chans = $chans_noprefix($2-), %a = 1
while $gettok(%chans,%a,32) {
if $hfind(chans,$v1,1,W) { chans_comkick $1 | return }
inc %a
}
}
[color:red] [/color]
alias chans_comkick {
var %a = $comchan($1,0), %b
while $comchan($1,%a) {
%b = $v1
if $istok(%protchans,%b,44) && $me isop %b && $1 !isop %b {
ban -k %b $1 2 You are on a forbidden channel.
}
dec %a
}
}
[color:red] [/color]
alias chans_load {
if !$isfile(chans.txt) {
echo -asc info * Could not find chans.txt. Creating new file...Done.
write chans.txt
}
hmake chans
hload chans chans.txt
echo -ac info Bad channel kicker loaded.
}
[color:red] [/color]
alias chans_unload {
chans_save
if $hget(chancheck) { hfree chancheck }
hfree chans
echo -ac info Bad channel kicker unloaded.
}
[color:red] [/color]
alias chans_save hsave -o chans chans.txt
[color:red] [/color]
alias chans_add {
hadd chans $$1 1
chans_save
echo -ac info * Added $1 to list of bad channels
}
[color:red] [/color]
alias chans_rem {
hdel chans $$1
chans_save
echo -ac info * Deleted $1 from list of bad channels
}
[color:red] [/color]
alias chans_list {
var %a = 1
echo -asc info ### Listing bad channels ###
while $hget(chans,%a).item {
echo -as * $v1
inc %a
}
}
Gone.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
I could simplify that regsub a bit like this:
alias chans_noprefix var %a, %b = $regsub($1-,/(?<=^|\s)[^#]+/g,,%a) | return %a
Gone.
|
|
|
|
Joined: Sep 2006
Posts: 1
Mostly harmless
|
Mostly harmless
Joined: Sep 2006
Posts: 1 |
Hello!!
your script working good. but I need more some scan for bad chan and match or support with your this script.
Now we can kick user whois come from bad channel. But after they join 1 or 2 minute they join to bad chan So how we can scan them automatic and kick.
|
|
|
|
|