Hello again )
I have another problem with this script:))
With this script the bot is protecting itself and the its users to be banned.
FIRST : when the bad guy and the bot are on same address, to bot first kickban the bad guy , and then kickbans itself. I dont want the bot to kicks itself )
SECOND : when the bad guy and a bot user ( also and me) are on same address the bot kickbans the bad guy , and then the bot user I dont want kickbans me:(((
THIRD : Can you make the script to set ChanBans in his memory and to add the bud guy with flag +d ??
thank you in advance )
Here is the script :
set daddy(ban_protect) 1
bind mode - * daddy_watch_mode
proc daddy_watch_mode {nick host hand chan mode who} {
global daddy botnick botname
if {$mode != "+b" || ![botisop $chan] || $daddy(ban_protect) == 0} {return 0}
set victim ""
set numbanlist [llength [chanbans $chan]]
if {$numbanlist > 26 } {
set banhost ""
set b_count 0
for {set loop 0} {$loop < 6} {incr loop} {
set banhost "$banhost [lindex [lindex [chanbans $chan] $loop] 0]"
set b_count [expr $b_count + 1]
if {$loop == 5 } { putserv "MODE $chan -bbbbbb $banhost"
set banhost ""
set b_count 0
}
}
}
if {[string first "!" $who] == -1 && [string first "@" $who] == -1} {set who $who!*@*}
# if {[string first "!" $who] == -1} {set who *!*$who}
if {[string first "@" $who] == -1} {set who $who*@*}
foreach user [userlist] {
foreach userhost [getuser $user HOSTS] {
if {[string match [strlwr $who] [strlwr $userhost]] && ([matchattr $user f|f $chan] || [matchattr $user f|f $chan])} {
append victim "$user "
break
}
}
}
foreach user [chanlist $chan] {
set userhand [nick2hand $user $chan]
if {$userhand != "*"} {
set userhost $user![getchanhost $user $chan]
if {[string match [strlwr $who] [strlwr $userhost]]} {
if {[matchattr $userhand n|n $chan] || [matchattr $userhand m|m $chan] || [matchattr $userhand f|f $chan] || [matchattr $userhand f|f $chan]} {
if {[string first $userhand $victim] == -1} {append victim "$userhand "}
}
}
}
}
if {[string match [strlwr $who] [strlwr $botname]]} {
if {![matchattr $hand m|m $chan] && !([matchattr $hand b] && [matchattr $hand f|f $chan])} {
putserv "MODE $chan +b $nick"
putserv "KICK $chan $nick :Don't ban me, bud"
return 0
} {
append victim "$botnick"
}
}
if {$victim != ""} {daddy_ban_warn $nick $hand $who $chan $victim}
return 0
}
proc daddy_ban_warn {nick hand ban chan victims} {
global daddy
if {![botisop $chan] || [strlwr $hand] == [string trimright [strlwr $victims] " "] || $daddy(ban_protect) == 0} {return 0}
if {$hand == "*"} {
if {[string first +userbans [channel info $chan]] != -1} {
putserv "MODE $chan +b $nick"
putserv "KICK $chan $nick :Don't ban my friends, bud"
}
return 0
}
set remove 0
foreach user $victims {
if {([matchattr $user m|m $chan] || [matchattr $user b]) && !([matchattr $hand m|m $chan] || ([matchattr $han f|f $chan] && [matchattr $hand b]))} {
set remove 1
break
}
if {([matchattr $user f|f $chan] || [matchattr $user m|m $chan]) && ![matchattr $hand n|n $chan]} {
set remove 1
break
}
}
if {$remove == 1} {putserv "MODE $chan -b $ban"}
if {![matchattr $hand b]} {
if {[llength $victims] > 1} {
putserv "MODE $chan +b $nick"
putserv "KICK $chan $nick :Don't ban my friends, bud"
}
}
return 0
}