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.

protection error

Help for those learning Tcl or writing their own scripts.
Post Reply
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

protection error

Post by r0t3n »

Ok, i have an error with the kickmsg, the kickmsg does not format correctly

The code:

Code: Select all

proc protect::protection {nickname hostname handle channel mode victim} {
   if {($nickname == "$victim") || ($nickname == "$::botnick") || ![channel get $channel "protection"]} {
      return 0
   }
   switch -exact -- $mode {
      "+o" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            putquick "PRIVMSG [protect::service $channel] :DEOPALL $channel" -next
            if {[string match -nocase $::botnick $victim]} {
               set reason "op me"
            } else {
               set reason "op anyone"
            }
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set homename *!*@[lindex [split $hostname] 1]
            }
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               if {[string match -nocase $::botnick $victim]} {
                  putquick "MODE $channel -o+b $nickname $hostname" -next
               } else {
                  putquick "MODE $channel -oo+b $nickname $victim $hostname" -next
               }
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: op\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-o" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            putquick "PRIVMSG [protect::service $channel] :DEOPALL $channel" -next
            if {[string match -nocase $::botnick $victim]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel" -next
               set reason "deop me"
            } else {
               set reason "deop anyone"
            }
            set kickid [expr {$::id} + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set homename *!*@[lindex [split $hostname] 1]
            }
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               if {[string match -nocase $::botnick $victim]} {
                  putquick "MODE $channel -o+b $nickname $hostname" -next
               } else {
                  putquick "MODE $channel -o+ob $nickname $victim $hostname" -next
               }
               putquick "KICK $channel $nickname :$kickmsg"
               putlog "punished $nickname on $channel \(Reason: op\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+v" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {[botisop $channel]} {
               putquick "MODE $channel -ov $nickname $victim"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
         putlog "punished $nickname on $channel \(Reason: voice\)"
      }
      "-v" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {[botisop $channel]} {
               putquick "MODE $channel -o+v $nickname $victim"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
         putlog "punished $nickname on $channel \(Reason: devoice\)"
      }
      "+b" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            if {[string match -nocase $::botname $victim]} {
               if {![botisop $channel]} {
                  putquick "PRIVMSG [protect::service $channel] :OP $channel" -next
               }
               set reason "ban me"
            } else {
               set reason "ban anyone"
            }
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -ob+b $nickname $victim $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: ban\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-b" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel" -next
            }
            set reason "unban anyone"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+bb $nickname $hostname $victim" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unban\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+i" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set kickmsg $protect::kickmsg
            set reason "set invite"
            set kickid [expr $::id + 1]
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -oi+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set invite\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-i" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset invite"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+ib $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset invite\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+l" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "set +l \(limit\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -ol+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set limit\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-l" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset +l \(limit\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+bl $nickname $hostname $victim" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset limit\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+m" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "set +m \(moderated\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -om+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set moderated\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-m" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset +m \(moderated\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+mb $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset moderated\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+k" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "set +k \(key\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -ok+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set key\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-k" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset +m \(moderated\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+bk $nickname $hostname $victim" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset key\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+t" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "set +t \(topic\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -ot+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set topic +t\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-t" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset +t \(topic\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+bt $nickname $hostname " -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset topic +t\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+n" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "set +n \(no external messages\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -on+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set key\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-n" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset +n \(no external messages\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+nb $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset key\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+s" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "set +s \(secret\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -os+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set secret\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-s" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset +s \(secret\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+sb $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset secret\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "+p" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "set +p \(private\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -op+b $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: set private\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
      "-p" {
         if {![matchattr $handle nmAS|nmo $channel]} {
            if {![botisop $channel]} {
               putquick "PRIVMSG [protect::service $channel] :OP $channel"
            }
            if {[string match -nocase "*users.quakenet.org" $hostname]} {
               set hostname "*!*@[lindex [split $hostname] 1]"
            }
            set reason "unset +p \(private\)"
            set kickid [expr $::id + 1]
            set kickmsg $protect::kickmsg
            set kickmsg "[format $kickmsg $reason $channel $kickid $protect::homechan]"
            newchanban $channel $hostname "$kickmsg" $protect::prot_btime
            if {[botisop $channel]} {
               putquick "MODE $channel -o+pb $nickname $hostname" -next
               putquick "KICK $channel $nickname $kickmsg"
               putlog "punished $nickname on $channel \(Reason: unset private\)"
            } else {
               putlog "Error: could not punished $nickname on $channel \(Reason: no op\)"
            }
         }
      }
   }
}
The error:

Code: Select all

* Bk`Tosser-- sets mode: +i
* aP|Trojan sets mode: -io+b Bk`Tosser-- *!Tosser@spc1-lanc1-3-0-cust169.asfd.broadband.ntl.com
* Bk`Tosser-- was kicked by aP|Trojan (6) ][ (SecureBot by #BotCentrum) ])

Kickmsg should be:
* Bk`Tosser-- was kicked by aP|Trojan ([ (You are not ALLOWED to set invite on #channel) ][ (ID: 6) ][ (SecureBot by #BotCentrum) ])
I can't seem to find an error with the format...

Thanks in advance !!
Chris :)
r0t3n @ #r0t3n @ Quakenet
Post Reply