This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with this script PART 3 :))))

Old posts that have not been replied to for several years.
Locked
I
Insectora
Voice
Posts: 16
Joined: Thu Feb 20, 2003 2:51 am
Location: Germany

Help with this script PART 3 :))))

Post by Insectora »

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
}
Stealth
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

haha

Post by De Kus »

FIRST

Code: Select all

putserv "MODE $chan +b $nick"
putserv "KICK $chan $nick :Don't ban my friends, bud"
this is a stupid way to ban him. bette use something like

Code: Select all

newchanban $chan $nick Friendprotection "Don't ban my friends, bud"
note: if the ban matchs your bot, it will NOT set the ban and dont kick the user!

SECOND
dont use things like "putserv "MODE $chan -b $ban" use the command pushmode like "pushmode $chan -b $ban"

THIRD
to your deop, use something like a used for my channellamer script

Code: Select all

...
      if { [matchattr $hand "d|d" $chan] } { return 1 }
      if { $hand == "*" } {
        set newhandle [addnewuser $nick $uhost]
        if { $newhandle == "*" } { return 2 }
      } else { set newhandle $hand }
      chattr $newhandle |-o+d $chan
      putcmdlog "Deopper $newhandle gegen $victimhandle auf $chan deoppt am [ctime [unixtime]]."
      setuser $newhandle COMMENT "Deoppte $victimhandle auf $chan am [ctime [unixtime]]."
...

#function to ensure to get a new user and returns the new handle name
proc addnewuser {nick uhost} {
  set handle $nick
  if { !([adduser $nick [maskhost $uhost]]) } {
    set handle bad[rand 999999]
    if { !([adduser $handle [maskhost $uhost]]) } { return * }
  }
  return $handle
}
FOURTH
tcl-commands.doc wrote:mode changes are broken down into their component parts before being sent here, so the <mode-change> will always be a single mode, such as "+m" or "-o". victim will show the argument of the mode change (for o/v/b/e/I) or "" if the set mode does not take an argument.
means you dont need any foreach $victim or [string trimright [strlwr $victims] " "] or such things :).

PS: and please use this for codes:

Code: Select all

[code]...code...
[/code]
i dont know why you have that often the kickban code, but im sure you could optimized your if structures. in the optimum you should only need this expression 2 times (1 for ban, 1 for deop).
Locked