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
}
}