chanset tcl

Allows you to enable/disable tcl scripts or set values for them.
Command: !chanset <+/-settting> ; setting

#############################################################################
#Chanset TCL
#
# !chanset <+/-settting> ; setting
#
# BLaCkShaDoW Production
#############################################################################

set set_flags "nm|nm"

#############################################################################
bind pub $set_flags !chanset set:proc

proc set:proc {nick host hand chan arg} {
set flag [lindex [split $arg] 0]
set str [join [lrange [split $arg] 1 end]]
set value ""
set error 0
if {$flag == ""} {
puthelp "NOTICE $nick :use !set <+/-settting> ; setting "
return
}
if {[regexp {^[+-]} $flag]} {
set rem_flag [string map {"+" ""
  "-" ""} $flag]
set error [catch {channel get $chan $rem_flag} value]
}
if {$error == "1"} {
puthelp "NOTICE $nick :Invalid channel setting."
return
}
if {[regexp {^[+]} $flag]} {
if {$value == "1"} {
puthelp "NOTICE $nick :Setting \002$flag\002 is already set."
} else {
channel set $chan $flag
puthelp "NOTICE $nick :Enabled \002$flag\002 setting."
}
} elseif {[regexp {^[-]} $flag]} {
if {$value == "0"} {
puthelp "NOTICE $nick :Setting \002$flag\002 is already disabled."
} else {
channel set $chan $flag
puthelp "NOTICE $nick grinisabled \002$flag\002 setting."
}
} else {
set error [catch {channel get $chan $flag} value]
set rem_value [string map {" " ":"} $value]
if {$error == "1"} {
puthelp "NOTICE $nick :Invalid channel setting."
return
}
if {$str == ""} {
puthelp "NOTICE $nick :use !set <+/-settting> ; setting "
return
}
if {[string equal -nocase $rem_value $str]} {
puthelp "NOTICE $nick :\002$flag\002 is already set to \002$str\002"
return
}
channel set $chan $flag $str
puthelp "NOTICE $nick :Set \002$flag\002 to \002$str\002"
}
}

putlog "Chanset TCL by BLaCkShaDoW Loaded. For more TCLs visit WwW.TclScripts.Net"
loading...