Fab's VIP Script

Paste Your code(s) here, and state your problem.

Fab's VIP Script

Postby sHiZo » Sat Apr 11, 2009 11:59 am

Hello sp00fed

I got a Problem, i need a VIP Script so people who are oped/voiced on a certain channel get voiced on another one. I've found a very popular public Script for this, Fab's Vip Script. But... unfortunately it's not working for me.

I can load it via eggdrop, commands are working so far, tested it, but everytime i set up the vip message and try !vip msg show (to let it show the current vip msg) it does NOTHING -> Partyline says me at that time: "(12:18:29) (Eggdrop) [12:18] Tcl error [vip:set]: this setting needs an argument"

I've already tried testing it, adding a vipchan, joined there and stuff (had op on vipchan), and NOTHING happens. No error via partyline, just nothing happens.

I have tried the english (old) and the new german v2 version of the script, both same error/issue.

Can you help me? It cant be that the script isnt working, its so popular and added in every script database. Maybe you can spot an error, here's the code:

that's the new v2 german version, i can upload the english version also if its better for you to understand and stuff.
Code: Select all
##
## Fab's VIP-BOT Script
## Version 2.0
##
## FaaB@psych0o.de
## #psych0o @ Qnet
##
## Dank an:
## #ra!d (raid) für Beta-Test und Bot und allem anderem :D
##
##

##
## Settings
##
   ## Trigger
   set vip(trigger) "!"

   ## Onwer/Master/ops no vip
   set vip(nouservip) "off"
##
## Vorgefertigte VIP Skins
##
   set vip(skin,vip,0) "‹\002‹\002‹ \002V\002IP™ Detected ›\002›\002› \002W\002illkommen \002:nick:\002 ›\002›\002› \002D\002ank \002:status:\002 geb ich dir \002:give:\002 ›\002›\002› \002ID:\002 :id: ›\002›\002›"
   set vip(skin,vip,1) "\0031,0\002‹\002 \0037,0\002Vip joined\0031,0 \002• \002\0037,0:nick: \002\0031,0has\002\0037,0 :status: \0031,0\002and gets \0037,0\002:give:\0031,0\002 • \0037,0\002I\0031,0D:\0037,0\002 \002:id:\002 \0031,0\002›"
##
## Script Skins
##
   set vip(skin,pre) "\002\00312«\002\0030•\002\00312»\002 \0030#\002\00312BoT\002\0030.\002\Net \00312«\0030\002•\002\00312»\002\003"
   set vip(skin,msg) ":msg:"
   set vip(skin,aft) "\002\00312«\0030\002•\002\00312»\003\002"
   set vip(skin,chan,list) "\002Channel:\002 :chan: \002Status:\002 :status: \002bekommt:\002 :give:"
   set vip(skin,msg,show) "Dezeit: :vipmsg:"
   set vip(skin,msg,list) "\002\[ID:\002 :id:\002\]\002 :vipmsg:"
   set vip(skin,methode) "Derzeit gesetzt auf: \002:methode:\002"
##
## Messages
##
   set vip(msg,chan,add,ok) "Channel erfolgreich hinzugefügt"
   set vip(msg,chan,add,alrdy) "Channel bereits verhanden"
   set vip(msg,chan,add,usage) "Usage: $vip(trigger)vip chan add <@/+> <#channel> <op/voice>"
   set vip(msg,chan,del,ok) "Erfolgreich gelöscht"
   set vip(msg,chan,del,no) "Keinen passenden Eintrag gefunden"
   set vip(msg,chan,del,usage) "Usage: $vip(trigger)vip chan del <(@/+) (#channel) (op/voice)> (siehe Hilfe)"
   set vip(msg,chan,types) "Verfügbare Types: add del list"
   set vip(msg,msg,set,off) "VIP Msg deaktiviert"
   set vip(msg,msg,set,ok) "Neue VIP Msg gespeichert"
   set vip(msg,msg,usage) "Usage: $vip(trigger)vip msg <show/list/<vip msg>/<skin id>"
   set vip(msg,msg,no,skin) "Skin ID nicht gefunden"
   set vip(msg,method,chan) "Erfolgreich auf Public-Channel Nachricht gesetzt"
   set vip(msg,method,notc) "Erfolgreich auf Private-Notice Nachricht gesetzt"
   set vip(msg,methode,types) "Verfügbare Optionen: chan notice show"
   set vip(msg,syntax,del) "Fehler bei der eingabe. Bitte überprüfen und erneut versuchen"
   set vip(msg,syntax,chan) "Das ist kein gültiger Channel-Name"
   set vip(msg,syntax,give) "Kein gültiger Mode (op/voice) angegeben"
   set vip(msg,syntax,status) "Kein gültigen Status (@/+) angegeben"
   set vip(msg,on) "VIP Funktion aktiviert"
   set vip(msg,off) "VIP Funktion deaktiviert"
   set vip(msg,options) "Verfügbare Optionen: chan msg methode on/off"
##
## Setudefs
##
   setudef flag vip
   setudef str vipmsg
   setudef str vipchans
   setudef str vipid
   setudef str vipmethode
##
## Public Command Binds
##
   bind pub nm|nm  "$vip(trigger)vip"   vip:set
   bind pub nm|nm "$vip(trigger)clearvip" vip:clear
##
## Stuff Binds
##
   bind join - *             vip:check:join
   bind raw - 319             vip:check:whois
##
## Proc vip:clear
##
   proc vip:clear { nick uhost hand chan arg } {
      global vip
      channel set $chan "vipchans" ""
      channel set $chan "vipmethode" "chan"
      putserv "NOTICE $nick :cleared"
   }
##
## Proc vip:set
##
   proc vip:set { nick uhost hand chan arg } {
      global vip
      set vip_show "$vip(skin,pre) $vip(skin,msg) $vip(skin,aft)"
      if {$arg != ""} {
         set vipcmd [lindex $arg 0]
         switch -- $vipcmd {
            "chan" {
               set vipsub [lindex $arg 1]
               if {$vipsub != ""} {
                  set viparg [lrange $arg 2 end]
                  switch -- $vipsub {
                     "add" {
                        if {$viparg != ""} {
                           set vipadd_status [lindex [split $viparg] 0]
                           set vipadd_chan [lindex [split $viparg] 1]
                           set vipadd_give [lindex [split $viparg] 2]
                           if {$vipadd_status == "@" || $vipadd_status == "+"} {
                              if {$vipadd_give == "op" || $vipadd_give == "voice"} {
                                 if {[string match "#*" $vipadd_chan]} {
                                    set vipchanlist [channel get $chan "vipchans"]
                                    set found 0
                                    foreach checkvipchan [split $vipchanlist] {
                                       if {$checkvipchan == "$vipadd_status:$vipadd_chan:$vipadd_give"} {
                                          set found 1
                                       }
                                    }
                                    if {$found == 0} {
                                       lappend vipchanlist "$vipadd_status:$vipadd_chan:$vipadd_give"
                                       channel set $chan "vipchans" $vipchanlist
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,add,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,add,alrdy) vip_show
                                    }
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,syntax,chan) vip_show
                                 }
                              } else {
                                 regsub -all -- {:msg:} $vip_show $vip(msg,syntax,give) vip_show
                              }
                           } else {
                              regsub -all -- {:msg:} $vip_show $vip(msg,syntax,status) vip_show
                           }
                        } else {
                           regsub -all -- {:msg:} $vip_show $vip(msg,chan,add,usage) vip_show
                        }
                     }
                     "del" {
                        if {$viparg != ""} {
                           set viplength [llength $viparg]
                           switch -- $viplength {
                              "1" {
                                 set vipoldchans [channel get $chan "vipchans"]
                                 set vipnewchans ""
                                 set found 0
                                 if {$viparg == "+" || $viparg == "@"} {
                                    foreach checkvipchan [split $vipoldchans] {
                                       if {![string match "$viparg:*" $checkvipchan]} {
                                          lappend vipnewchans $checkvipchan
                                       } else {
                                          set found 1
                                       }
                                    }
                                    if {$found == 1} {
                                       channel set $chan "vipchans" $vipnewchans   
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                    }
                                 } elseif {$viparg == "op" || $viparg == "voice"} {
                                    foreach checkvipchan [split $vipoldchans] {
                                       if {![string match "?:#*:$viparg" $checkvipchan]} {
                                          lappend vipnewchans $checkvipchan
                                       } else {
                                          set found 1
                                       }
                                    }
                                    if {$found == 1} {
                                       channel set $chan "vipchans" $vipnewchans   
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                    }
                                 } elseif {[string match "#*" $viparg]} {
                                    foreach checkvipchan [split $vipoldchans] {
                                       if {![string match "?:$viparg:*" $checkvipchan]} {
                                          lappend vipnewchans $checkvipchan
                                       } else {
                                          set found 1
                                       }
                                    }
                                    if {$found == 1} {
                                       channel set $chan "vipchans" $vipnewchans   
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                    }
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,syntax,del) vip_show
                                 }
                              }
                              "2" {
                                 set vipoldchans [channel get $chan "vipchans"]
                                 set vipnewchans ""
                                 set found 0
                                 foreach checkvipchan [split $vipoldchans] {
                                    if {![string match "*$viparg*" $checkvipchan]} {
                                       lappend vipnewchans $checkvipchan
                                    } else {
                                       set found 1
                                    }
                                 }
                                 if {$found == 1} {
                                    channel set $chan "vipchans" $vipnewchans   
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                 }
                              }
                              "3" {
                                 set vipoldchans [channel get $chan "vipchans"]
                                 set vipnewchans ""
                                 set vipdelmode [lindex [split $viparg] 0]
                                 set vipdelchan [lindex [split $viparg] 1]
                                 set vipdelgive [lindex [split $viparg] 2]
                                 set found 0
                                 foreach checkvipchan [split $vipoldchans] {
                                    if {![string match "$vipdelmode:$vipdelchan:$vipdelgive" $checkvipchan]} {
                                       lappend vipnewchans $checkvipchan
                                    } else {
                                       set found 1
                                    }
                                 }
                                 if {$found == 1} {
                                    channel set $chan "vipchans" $vipnewchans   
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                 }
                              }
                              "default" {
                                 regsub -all -- {:msg:} $vip_show $vip(msg,syntax,del) vip_show
                              }
                           }
                        } else {
                           regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,usage) vip_show
                        }
                     }
                     "list" {
                        set vipchanlist [channel get $chan "vipchans"]
                        set alrdystarted 0
                        foreach checkvipchan [split $vipchanlist] {
                           if {$alrdystarted == 1} {
                              putserv "NOTICE $nick :$vip_show"
                           }
                           if {[string match "?:#*:*" $checkvipchan]} {
                              set vipstatus [lindex [split $checkvipchan ":"] 0]
                              set vipchan [lindex [split $checkvipchan ":"] 1]
                              set vipgive [lindex [split $checkvipchan ":"] 2]
                              set vip_show "$vip(skin,pre) $vip(skin,msg) $vip(skin,aft)"
                              regsub -all -- {:msg:} $vip_show $vip(skin,chan,list) vip_show
                              regsub -all -- {:status:} $vip_show $vipstatus vip_show
                              regsub -all -- {:chan:} $vip_show $vipchan vip_show
                              regsub -all -- {:give:} $vip_show $vipgive vip_show
                              if {$alrdystarted == 0} {
                                 set alrdystarted 1
                              }
                           }
                        }
                     }
                     "default" {
                        regsub -all -- {:msg:} $vip_show $vip(msg,chan,types) vip_show
                     }
                  }
               } else {
                  regsub -all -- {:msg:} $vip_show $vip(msg,chan,types) vip_show
               }
            }
            "msg" {
               set viparg [lrange $arg 1 end]
               if {$viparg == "off"} {
                  channel set $chan "vipmsg" "0"
                  regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,off) vip_show
               } elseif {[isnumber $viparg]} {
                  set vipnr [expr $viparg - 1]
                  if {[info exists vip(skin,vip,$vipnr)]} {
                     channel set $chan "vipmsg" $vip(skin,vip,$vipnr)
                     regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,ok) vip_show
                  } else {
                     regsub -all -- {:msg:} $vip_show $vip(msg,msg,no,skin) vip_show
                  }
               } elseif {$viparg == "show"} {
                  set vip_msg [channel set $chan "vipmsg"]
                  if {$vip_msg != 0} {
                       regsub -all -- {:msg:} $vip_show $vip(skin,msg,show) vip_show
                     regsub -all -- {:vipmsg:} $vip_show $vip_msg $vip_show
                  } else {
                     regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,off) vip_show
                  }
               } elseif {$viparg == "list"} {
                  set started 0
                  set count 0
                  while {[info exists vip(skin,vip,$count)]} {
                     if {$started == 1} {
                        putserv "NOTICE $nick :$vip_show"
                     }
                     set vipidnr [expr $count + 1]
                     set vip_show "$vip(skin,pre) $vip(skin,msg) $vip(skin,aft)"
                     regsub -all -- {:msg:} $vip_show $vip(skin,msg,list) vip_show
                     regsub -all -- {:id:} $vip_show $vipidnr vip_show
                     regsub -all -- {:vipmsg:} $vip_show $vip(skin,vip,$count) vip_show
                     if {$started == 0} {
                        putserv "NOTICE $nick :$vip_show"
                        set started 1
                     }
                     incr count
                  }
               } elseif {$viparg == ""} {
                  regsub -all -- {:msg:} $vip_show $vip(msg,msg,usage) vip_show
               } else {
                  channel set $chan "vipmsg" $viparg
                  regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,ok) vip_show
               }
            }
            "methode" {
               set viparg [lindex $arg 1]
               switch -- $viparg {
                  "chan" {
                     channel set $chan "vipmethode" "chan"
                     regsub -all -- {:msg:} $vip_show $vip(msg,method,chan) vip_show
                  }
                  "notice" {
                     channel set $chan "vipmethode" "notice"
                     regsub -all -- {:msg:} $vip_show $vip(msg,method,notc) vip_show
                  }
                  "show" {
                     set vip_meth [channel get $chan "vipmethode"]
                     regsub -all -- {:msg:} $vip_show $vip(skin,methode) vip_show
                     regsub -all -- {:methode:} $vip_show $vip_meth vip_show
                  }
                  "default" {
                     regsub -all -- {:msg:} $vip_show $vip(msg,methode,types) vip_show
                  }
               }
            }
            "on" {
               channel set $chan "+vip"
               regsub -all -- {:msg:} $vip_show $vip(msg,on) vip_show
            }
            "off" {
               channel set $chan "-vip"
               regsub -all -- {:msg:} $vip_show $vip(msg,off) vip_show
            }
            "default" {
               regsub -all -- {:msg:} $vip_show $vip(msg,options) vip_show
            }
         }
      } else {
         regsub -all -- {:msg:} $vip_show $vip(msg,options) vip_show
      }
      putserv "NOTICE $nick :$vip_show"
   }
##
## Proc vip:check:join
##
   proc vip:check:join { nick uhost hand chan } {
      global vip botnick
      if {[channel get $chan "vip"] && $nick != $botnick} {
         if {$vip(nouservip) == "off"} {
            if {![info exists vip(check,$chan)]} {
               set vip(check,$nick) $chan
            } else {
               lappend vip(check,$nick) $chan
            }
            putquick "WHOIS $nick"
         } else {
            if {[validuser [nick2hand $nick]]} {
               if {![matchattr [nick2hand $nick] |o $chan] && ![matchattr [nick2hand $nick] o]} {
                  if {![info exists vip(check,$chan)]} {
                     set vip(check,$nick) $chan
                  } else {
                     lappend vip(check,$nick) $chan
                  }
                  putquick "WHOIS $nick"
               } else {
                  pushmode $chan +o $nick
               }
            } else {
               if {![info exists vip(check,$chan)]} {
                  set vip(check,$nick) $chan
               } else {
                  lappend vip(check,$nick) $chan
               }
               putquick "WHOIS $nick"
            }
         }
      }
   }
##
## Proc vip:check:whois
##
   proc vip:check:whois { from key text } {
      global vip
      set checknick [lindex [split $text] 1]
      if {[info exists vip(check,$checknick)]} {
         foreach checkchan [split $vip(check,$checknick)] {
            if {[channel get $checkchan "vip"] && [channel get $checkchan "vipchans"] != ""} {
               set give ""
               set give_vip ""
               set chanlist [lindex [split $text ":"] 1]
               foreach check_chans [split $chanlist] {
                  if {[string index $check_chans 1] == "#"} {
                     set vipchancheck [string range $check_chans 1 end]
                     set vipmodecheck [string index $check_chans 0]
                     set vipchans [channel get $checkchan "vipchans"]
                     foreach checkvip [split $vipchans] {
                        if {[string match "?:#*:*" $checkvip]} {
                           set themode [lindex [split $checkvip ":"] 0]
                           set thechan [lindex [split $checkvip ":"] 1]
                           set thegive [lindex [split $checkvip ":"] 2]
                           switch -- $themode {
                              "+" {
                                 if {$vipchancheck == $thechan} {
                                    if {$vipmodecheck == "+" || $vipmodecheck "@"} {
                                       if {![info exists give] || $give != "op"} {
                                          set give $thegive
                                       }
                                       lappend give_vip "$vipmodecheck:$vipchancheck"
                                    }
                                 }
                              }
                              "@" {
                                 if {$vipchancheck == $thechan} {
                                    if {$vipmodecheck == "@"} {
                                       if {![info exists give] || $give != "op"} {
                                          set give $thegive
                                       }
                                       lappend give_vip "$vipmodecheck:$vipchancheck"
                                    }
                                 }
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
         if {[info exists give] && $give != ""} {
            switch -- $give {
               "op" {
                  set vipmodegive "+o"
               }
               "voice" {
                  set vipmodegive "+v"
               }
            }
            set welikegive ""
            foreach wegotchan [split $give_vip] {
               set ourmode [lindex [split $wegotchan ":"] 0]
               set ourchan [lindex [split $wegotchan ":"] 1]
               append welikegive "$ourmode on $ourchan,"
            }
            set vip_msg [channel get $checkchan "vipmsg"]
            set vip_id [channel get $checkchan "vipid"]
            if {$vip_id == "" || ![isnumber $vip_id]} {
               set vip_id 1
            } else {
               incr vip_id
            }
            channel set $checkchan "vipid" $vip_id
            set vip_methode [channel get $checkchan "vipmethode"]
            switch -- $vip_methode {
               "notice" {
                  set vipmethode "NOTICE $checknick"
               }
               "chan" {
                  set vipmethode "PRIVMSG $checkchan"
               }
               "default" {
                  set vipmethode "PRIVMSG $checkchan"
               }
            }
            if {$vip_msg != "0"} {
               regsub -all -- {:nick:} $vip_msg $checknick vip_msg
               regsub -all -- {:status:} $vip_msg $welikegive vip_msg
               regsub -all -- {:give:} $vip_msg $give vip_msg
               regsub -all -- {:id:} $vip_msg $vip_id vip_msg
               putquick "$vipmethode :$vip_msg"
            }
            if {[info exists vipmodegive]} {
               pushmode $checkchan $vipmodegive $checknick
            }
         }
      }
      unset vip(check,$checknick)
   }
##
## Log Eintrag
##
   putlog "FaB's VIP-Bot Script Ver. 2  loaded... (c) by. #psych0o www.psych0o.de"
##
## Ende
##


Thanks a lot in advance!
sHiZo
 

Re: Fab's VIP Script

Postby Cristian » Sun Apr 12, 2009 2:10 pm

Hi and welcome sHiZo

I tried the script, and got the same message as you, and edited it, so now it shows you the current message.

Code: Select all
##
## Fab's VIP-BOT Script
## Version 2.0
##
## FaaB@psych0o.de
## #psych0o @ Qnet
##
## Dank an:
## #ra!d (raid) für Beta-Test und Bot und allem anderem :D
##
##

##
## Settings
##
   ## Trigger
   set vip(trigger) "!"

   ## Onwer/Master/ops no vip
   set vip(nouservip) "off"
##
## Vorgefertigte VIP Skins
##
   set vip(skin,vip,0) "‹\002‹\002‹ \002V\002IP™ Detected ›\002›\002› \002W\002illkommen \002:nick:\002 ›\002›\002› \002D\002ank \002:status:\002 geb ich dir \002:give:\002 ›\002›\002› \002ID:\002 :id: ›\002›\002›"
   set vip(skin,vip,1) "\0031,0\002‹\002 \0037,0\002Vip joined\0031,0 \002• \002\0037,0:nick: \002\0031,0has\002\0037,0 :status: \0031,0\002and gets \0037,0\002:give:\0031,0\002 • \0037,0\002I\0031,0D:\0037,0\002 \002:id:\002 \0031,0\002›"
##
## Script Skins
##
   set vip(skin,pre) "\002\00312«\002\0030•\002\00312»\002 \0030#\002\00312BoT\002\0030.\002\Net \00312«\0030\002•\002\00312»\002\003"
   set vip(skin,msg) ":msg:"
   set vip(skin,aft) "\002\00312«\0030\002•\002\00312»\003\002"
   set vip(skin,chan,list) "\002Channel:\002 :chan: \002Status:\002 :status: \002bekommt:\002 :give:"
   set vip(skin,msg,show) "Dezeit: :vipmsg:"
   set vip(skin,msg,list) "\002\[ID:\002 :id:\002\]\002 :vipmsg:"
   set vip(skin,methode) "Derzeit gesetzt auf: \002:methode:\002"
##
## Messages
##
   set vip(msg,chan,add,ok) "Channel erfolgreich hinzugefügt"
   set vip(msg,chan,add,alrdy) "Channel bereits verhanden"
   set vip(msg,chan,add,usage) "Usage: $vip(trigger)vip chan add <@/+> <#channel> <op/voice>"
   set vip(msg,chan,del,ok) "Erfolgreich gelöscht"
   set vip(msg,chan,del,no) "Keinen passenden Eintrag gefunden"
   set vip(msg,chan,del,usage) "Usage: $vip(trigger)vip chan del <(@/+) (#channel) (op/voice)> (siehe Hilfe)"
   set vip(msg,chan,types) "Verfügbare Types: add del list"
   set vip(msg,msg,set,off) "VIP Msg deaktiviert"
   set vip(msg,msg,set,ok) "Neue VIP Msg gespeichert"
   set vip(msg,msg,usage) "Usage: $vip(trigger)vip msg <show/list/<vip msg>/<skin id>"
   set vip(msg,msg,no,skin) "Skin ID nicht gefunden"
   set vip(msg,method,chan) "Erfolgreich auf Public-Channel Nachricht gesetzt"
   set vip(msg,method,notc) "Erfolgreich auf Private-Notice Nachricht gesetzt"
   set vip(msg,methode,types) "Verfügbare Optionen: chan notice show"
   set vip(msg,syntax,del) "Fehler bei der eingabe. Bitte überprüfen und erneut versuchen"
   set vip(msg,syntax,chan) "Das ist kein gültiger Channel-Name"
   set vip(msg,syntax,give) "Kein gültiger Mode (op/voice) angegeben"
   set vip(msg,syntax,status) "Kein gültigen Status (@/+) angegeben"
   set vip(msg,on) "VIP Funktion aktiviert"
   set vip(msg,off) "VIP Funktion deaktiviert"
   set vip(msg,options) "Verfügbare Optionen: chan msg methode on/off"
##
## Setudefs
##
   setudef flag vip
   setudef str vipmsg
   setudef str vipchans
   setudef str vipid
   setudef str vipmethode
##
## Public Command Binds
##
   bind pub nm|nm  "$vip(trigger)vip"   vip:set
   bind pub nm|nm "$vip(trigger)clearvip" vip:clear
##
## Stuff Binds
##
   bind join - *             vip:check:join
   bind raw - 319             vip:check:whois
##
## Proc vip:clear
##
   proc vip:clear { nick uhost hand chan arg } {
      global vip
      channel set $chan "vipchans" ""
      channel set $chan "vipmethode" "chan"
      putserv "NOTICE $nick :cleared"
   }
##
## Proc vip:set
##
   proc vip:set { nick uhost hand chan arg } {
      global vip
      set vip_show "$vip(skin,pre) $vip(skin,msg) $vip(skin,aft)"
      if {$arg != ""} {
         set vipcmd [lindex $arg 0]
         switch -- $vipcmd {
            "chan" {
               set vipsub [lindex $arg 1]
               if {$vipsub != ""} {
                  set viparg [lrange $arg 2 end]
                  switch -- $vipsub {
                     "add" {
                        if {$viparg != ""} {
                           set vipadd_status [lindex [split $viparg] 0]
                           set vipadd_chan [lindex [split $viparg] 1]
                           set vipadd_give [lindex [split $viparg] 2]
                           if {$vipadd_status == "@" || $vipadd_status == "+"} {
                              if {$vipadd_give == "op" || $vipadd_give == "voice"} {
                                 if {[string match "#*" $vipadd_chan]} {
                                    set vipchanlist [channel get $chan "vipchans"]
                                    set found 0
                                    foreach checkvipchan [split $vipchanlist] {
                                       if {$checkvipchan == "$vipadd_status:$vipadd_chan:$vipadd_give"} {
                                          set found 1
                                       }
                                    }
                                    if {$found == 0} {
                                       lappend vipchanlist "$vipadd_status:$vipadd_chan:$vipadd_give"
                                       channel set $chan "vipchans" $vipchanlist
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,add,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,add,alrdy) vip_show
                                    }
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,syntax,chan) vip_show
                                 }
                              } else {
                                 regsub -all -- {:msg:} $vip_show $vip(msg,syntax,give) vip_show
                              }
                           } else {
                              regsub -all -- {:msg:} $vip_show $vip(msg,syntax,status) vip_show
                           }
                        } else {
                           regsub -all -- {:msg:} $vip_show $vip(msg,chan,add,usage) vip_show
                        }
                     }
                     "del" {
                        if {$viparg != ""} {
                           set viplength [llength $viparg]
                           switch -- $viplength {
                              "1" {
                                 set vipoldchans [channel get $chan "vipchans"]
                                 set vipnewchans ""
                                 set found 0
                                 if {$viparg == "+" || $viparg == "@"} {
                                    foreach checkvipchan [split $vipoldchans] {
                                       if {![string match "$viparg:*" $checkvipchan]} {
                                          lappend vipnewchans $checkvipchan
                                       } else {
                                          set found 1
                                       }
                                    }
                                    if {$found == 1} {
                                       channel set $chan "vipchans" $vipnewchans   
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                    }
                                 } elseif {$viparg == "op" || $viparg == "voice"} {
                                    foreach checkvipchan [split $vipoldchans] {
                                       if {![string match "?:#*:$viparg" $checkvipchan]} {
                                          lappend vipnewchans $checkvipchan
                                       } else {
                                          set found 1
                                       }
                                    }
                                    if {$found == 1} {
                                       channel set $chan "vipchans" $vipnewchans   
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                    }
                                 } elseif {[string match "#*" $viparg]} {
                                    foreach checkvipchan [split $vipoldchans] {
                                       if {![string match "?:$viparg:*" $checkvipchan]} {
                                          lappend vipnewchans $checkvipchan
                                       } else {
                                          set found 1
                                       }
                                    }
                                    if {$found == 1} {
                                       channel set $chan "vipchans" $vipnewchans   
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                    } else {
                                       regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                    }
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,syntax,del) vip_show
                                 }
                              }
                              "2" {
                                 set vipoldchans [channel get $chan "vipchans"]
                                 set vipnewchans ""
                                 set found 0
                                 foreach checkvipchan [split $vipoldchans] {
                                    if {![string match "*$viparg*" $checkvipchan]} {
                                       lappend vipnewchans $checkvipchan
                                    } else {
                                       set found 1
                                    }
                                 }
                                 if {$found == 1} {
                                    channel set $chan "vipchans" $vipnewchans   
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                 }
                              }
                              "3" {
                                 set vipoldchans [channel get $chan "vipchans"]
                                 set vipnewchans ""
                                 set vipdelmode [lindex [split $viparg] 0]
                                 set vipdelchan [lindex [split $viparg] 1]
                                 set vipdelgive [lindex [split $viparg] 2]
                                 set found 0
                                 foreach checkvipchan [split $vipoldchans] {
                                    if {![string match "$vipdelmode:$vipdelchan:$vipdelgive" $checkvipchan]} {
                                       lappend vipnewchans $checkvipchan
                                    } else {
                                       set found 1
                                    }
                                 }
                                 if {$found == 1} {
                                    channel set $chan "vipchans" $vipnewchans   
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,ok) vip_show
                                 } else {
                                    regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,no) vip_show
                                 }
                              }
                              "default" {
                                 regsub -all -- {:msg:} $vip_show $vip(msg,syntax,del) vip_show
                              }
                           }
                        } else {
                           regsub -all -- {:msg:} $vip_show $vip(msg,chan,del,usage) vip_show
                        }
                     }
                     "list" {
                        set vipchanlist [channel get $chan "vipchans"]
                        set alrdystarted 0
                        foreach checkvipchan [split $vipchanlist] {
                           if {$alrdystarted == 1} {
                              putserv "NOTICE $nick :$vip_show"
                           }
                           if {[string match "?:#*:*" $checkvipchan]} {
                              set vipstatus [lindex [split $checkvipchan ":"] 0]
                              set vipchan [lindex [split $checkvipchan ":"] 1]
                              set vipgive [lindex [split $checkvipchan ":"] 2]
                              set vip_show "$vip(skin,pre) $vip(skin,msg) $vip(skin,aft)"
                              regsub -all -- {:msg:} $vip_show $vip(skin,chan,list) vip_show
                              regsub -all -- {:status:} $vip_show $vipstatus vip_show
                              regsub -all -- {:chan:} $vip_show $vipchan vip_show
                              regsub -all -- {:give:} $vip_show $vipgive vip_show
                              if {$alrdystarted == 0} {
                                 set alrdystarted 1
                              }
                           }
                        }
                     }
                     "default" {
                        regsub -all -- {:msg:} $vip_show $vip(msg,chan,types) vip_show
                     }
                  }
               } else {
                  regsub -all -- {:msg:} $vip_show $vip(msg,chan,types) vip_show
               }
            }
            "msg" {
               set viparg [lrange $arg 1 end]
               if {$viparg == "off"} {
                  channel set $chan "vipmsg" "0"
                  regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,off) vip_show
               } elseif {[isnumber $viparg]} {
                  set vipnr [expr $viparg - 1]
                  if {[info exists vip(skin,vip,$vipnr)]} {
                     channel set $chan "vipmsg" $vip(skin,vip,$vipnr)
                     regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,ok) vip_show
                  } else {
                     regsub -all -- {:msg:} $vip_show $vip(msg,msg,no,skin) vip_show
                  }
               } elseif {$viparg == "show"} {
                  set vip_msg [channel get $chan "vipmsg"]
                  if {$vip_msg != 0} {
                       regsub -all -- {:msg:} $vip_show $vip(skin,msg,show) vip_show
                     regsub -all -- {:vipmsg:} $vip_show $vip_msg $vip_show
                  } else {
                     regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,off) vip_show
                  }
               } elseif {$viparg == "list"} {
                  set started 0
                  set count 0
                  while {[info exists vip(skin,vip,$count)]} {
                     if {$started == 1} {
                        putserv "NOTICE $nick :$vip_show"
                     }
                     set vipidnr [expr $count + 1]
                     set vip_show "$vip(skin,pre) $vip(skin,msg) $vip(skin,aft)"
                     regsub -all -- {:msg:} $vip_show $vip(skin,msg,list) vip_show
                     regsub -all -- {:id:} $vip_show $vipidnr vip_show
                     regsub -all -- {:vipmsg:} $vip_show $vip(skin,vip,$count) vip_show
                     if {$started == 0} {
                        putserv "NOTICE $nick :$vip_show"
                        set started 1
                     }
                     incr count
                  }
               } elseif {$viparg == ""} {
                  regsub -all -- {:msg:} $vip_show $vip(msg,msg,usage) vip_show
               } else {
                  channel set $chan "vipmsg" $viparg
                  regsub -all -- {:msg:} $vip_show $vip(msg,msg,set,ok) vip_show
               }
            }
            "methode" {
               set viparg [lindex $arg 1]
               switch -- $viparg {
                  "chan" {
                     channel set $chan "vipmethode" "chan"
                     regsub -all -- {:msg:} $vip_show $vip(msg,method,chan) vip_show
                  }
                  "notice" {
                     channel set $chan "vipmethode" "notice"
                     regsub -all -- {:msg:} $vip_show $vip(msg,method,notc) vip_show
                  }
                  "show" {
                     set vip_meth [channel get $chan "vipmethode"]
                     regsub -all -- {:msg:} $vip_show $vip(skin,methode) vip_show
                     regsub -all -- {:methode:} $vip_show $vip_meth vip_show
                  }
                  "default" {
                     regsub -all -- {:msg:} $vip_show $vip(msg,methode,types) vip_show
                  }
               }
            }
            "on" {
               channel set $chan "+vip"
               regsub -all -- {:msg:} $vip_show $vip(msg,on) vip_show
            }
            "off" {
               channel set $chan "-vip"
               regsub -all -- {:msg:} $vip_show $vip(msg,off) vip_show
            }
            "default" {
               regsub -all -- {:msg:} $vip_show $vip(msg,options) vip_show
            }
         }
      } else {
         regsub -all -- {:msg:} $vip_show $vip(msg,options) vip_show
      }
      putserv "NOTICE $nick :$vip_show"
   }
##
## Proc vip:check:join
##
   proc vip:check:join { nick uhost hand chan } {
      global vip botnick
      if {[channel get $chan "vip"] && $nick != $botnick} {
         if {$vip(nouservip) == "off"} {
            if {![info exists vip(check,$chan)]} {
               set vip(check,$nick) $chan
            } else {
               lappend vip(check,$nick) $chan
            }
            putquick "WHOIS $nick"
         } else {
            if {[validuser [nick2hand $nick]]} {
               if {![matchattr [nick2hand $nick] |o $chan] && ![matchattr [nick2hand $nick] o]} {
                  if {![info exists vip(check,$chan)]} {
                     set vip(check,$nick) $chan
                  } else {
                     lappend vip(check,$nick) $chan
                  }
                  putquick "WHOIS $nick"
               } else {
                  pushmode $chan +o $nick
               }
            } else {
               if {![info exists vip(check,$chan)]} {
                  set vip(check,$nick) $chan
               } else {
                  lappend vip(check,$nick) $chan
               }
               putquick "WHOIS $nick"
            }
         }
      }
   }
##
## Proc vip:check:whois
##
   proc vip:check:whois { from key text } {
      global vip
      set checknick [lindex [split $text] 1]
      if {[info exists vip(check,$checknick)]} {
         foreach checkchan [split $vip(check,$checknick)] {
            if {[channel get $checkchan "vip"] && [channel get $checkchan "vipchans"] != ""} {
               set give ""
               set give_vip ""
               set chanlist [lindex [split $text ":"] 1]
               foreach check_chans [split $chanlist] {
                  if {[string index $check_chans 1] == "#"} {
                     set vipchancheck [string range $check_chans 1 end]
                     set vipmodecheck [string index $check_chans 0]
                     set vipchans [channel get $checkchan "vipchans"]
                     foreach checkvip [split $vipchans] {
                        if {[string match "?:#*:*" $checkvip]} {
                           set themode [lindex [split $checkvip ":"] 0]
                           set thechan [lindex [split $checkvip ":"] 1]
                           set thegive [lindex [split $checkvip ":"] 2]
                           switch -- $themode {
                              "+" {
                                 if {$vipchancheck == $thechan} {
                                    if {$vipmodecheck == "+" || $vipmodecheck "@"} {
                                       if {![info exists give] || $give != "op"} {
                                          set give $thegive
                                       }
                                       lappend give_vip "$vipmodecheck:$vipchancheck"
                                    }
                                 }
                              }
                              "@" {
                                 if {$vipchancheck == $thechan} {
                                    if {$vipmodecheck == "@"} {
                                       if {![info exists give] || $give != "op"} {
                                          set give $thegive
                                       }
                                       lappend give_vip "$vipmodecheck:$vipchancheck"
                                    }
                                 }
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
         if {[info exists give] && $give != ""} {
            switch -- $give {
               "op" {
                  set vipmodegive "+o"
               }
               "voice" {
                  set vipmodegive "+v"
               }
            }
            set welikegive ""
            foreach wegotchan [split $give_vip] {
               set ourmode [lindex [split $wegotchan ":"] 0]
               set ourchan [lindex [split $wegotchan ":"] 1]
               append welikegive "$ourmode on $ourchan,"
            }
            set vip_msg [channel get $checkchan "vipmsg"]
            set vip_id [channel get $checkchan "vipid"]
            if {$vip_id == "" || ![isnumber $vip_id]} {
               set vip_id 1
            } else {
               incr vip_id
            }
            channel set $checkchan "vipid" $vip_id
            set vip_methode [channel get $checkchan "vipmethode"]
            switch -- $vip_methode {
               "notice" {
                  set vipmethode "NOTICE $checknick"
               }
               "chan" {
                  set vipmethode "PRIVMSG $checkchan"
               }
               "default" {
                  set vipmethode "PRIVMSG $checkchan"
               }
            }
            if {$vip_msg != "0"} {
               regsub -all -- {:nick:} $vip_msg $checknick vip_msg
               regsub -all -- {:status:} $vip_msg $welikegive vip_msg
               regsub -all -- {:give:} $vip_msg $give vip_msg
               regsub -all -- {:id:} $vip_msg $vip_id vip_msg
               putquick "$vipmethode :$vip_msg"
            }
            if {[info exists vipmodegive]} {
               pushmode $checkchan $vipmodegive $checknick
            }
         }
      }
     if {[info exists vip(check,$checknick)]} {
       unset vip(check,$checknick)
     }
   }
##
## Log Eintrag
##
   putlog "FaB's VIP-Bot Script Ver. 2  loaded... (c) by. #psych0o www.psych0o.de"
##
## Ende
##
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: Fab's VIP Script

Postby sHiZo » Sun Apr 12, 2009 3:56 pm

Thanks a lot Sumsar
sHiZo
 


Return to TCL Scripting Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron