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.

tcl error, help plzz

Old posts that have not been replied to for several years.
Locked
A
AW

Post by AW »

hi, can anyone help me plz, i am getting this error when i type .+ban nick
Tcl error [pub_+ban]: can't read "ban": no such variable
i went through codes, but no luck

here are the codes!

proc pub_+ban {nick uhost hand channel rest} {
global botnick CC ban-time
if {[matchattr $hand Q] == 0} {
puthelp "NOTICE $nick :02[AW]02 This command requires you to authenticate yourself. Please /msg $botnick auth <password>"
return 0
}
if {[botisop $channel]==1} {
if {$rest == ""} {
puthelp "NOTICE $nick :02[AW]02 Usage: ${CC}+ban <hostmask> [reason]"
return 0
}
if {$rest!=""} {
set host [lindex $rest 0]
set reason [lrange $rest 1 end]
if {[string tolower $host] == [string tolower $botnick]} {
putserv "KICK $channel $nick :02[AW]02 You really shouldn't try that..."
return 0
}
if {$reason == ""} {
set reason "02requested02"
}
set options [lindex $reason 0]
if {[string index $options 0] == "-"} {
set options [string range $options 1 end]
}
switch -exact $options {
perm {
set reason [lrange $reason 1 end]
newban $host $nick "$reason" 0
if {$reason == ""} {set reason "No reason given"}
putlog "02[AW]02 <<$nick>> !$hand! +ban $reason"
return 0
}
min {
if {[val [lindex $reason 1]] == ""} {
puthelp "NOTICE $nick :02[AW]02 Error, invalid time period"
return 0
}
set time [lindex $reason 1]
set reason [lrange $reason 2 end]
newban $host $nick "$reason" $time
if {$reason == ""} {set reason "No reason given"}
putlog "02[AW]02 <<$nick>> !$hand! +ban $reason"
return 0
}
hours {
if {[val [lindex $reason 1]] == ""} {
puthelp "NOTICE $nick :02[AW]02 Error, invalid time period"
return 0
}
set time [expr [lindex $reason 1]*60]
set reason [lrange $reason 2 end]
newban $host $nick "$reason" $time
if {$reason == ""} {set reason "No reason given"}
putlog "02[AW]02 <<$nick>> !$hand! +ban $reason"
return 0
}
days {
if {[val [lindex $reason 1]] == ""} {
puthelp "NOTICE $nick :02[AW]02 Error, invalid time period"
return 0
}
set time [expr [expr [lindex $reason 1]*60]*24]
set reason [lrange $reason 2 end]
newban $host $nick "$reason" $time
if {$reason == ""} {set reason "No reason given"}
putlog "02[AW]02 <<$nick>> !$hand! +ban $reason"
return 0
}
weeks {
if {[val [lindex $reason 1]] == ""} {
puthelp "NOTICE $nick :02[AW]02 Error, invalid time period"
return 0
}
set time [expr [expr [expr [lindex $reason 1]*60]*24]*7]
set reason [lrange $reason 2 end]
newban $host $nick "$reason" $time
if {$reason == ""} {set reason "No reason given"}
putlog "02[AW]02 <<$nick>> !$hand! +ban $reason"
return 0
}
}
set reason [lrange $reason 1 end]
newban $host $nick "$reason" $ban-time
if {$reason == ""} {set reason "No reason given"}
putlog "02[AW]02 <<$nick>> !$hand! +ban $reason"
return 0
}
}
if {[botisop $channel]!=1} {
puthelp "NOTICE $nick :02[AW]02 I am not oped"
}
}
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

newban $host $nick "$reason" $ban-time

should be

newban $host $nick "$reason" ${ban-time}
A
AW

Post by AW »

Thank you much Peterson.
But somehow "reason" part is not working at all(not displaying reason), and also switch -exact $option..(perm, min, hours, days weeks) part doesn't work either, any advise/help plz, i will really appreciate it. thanks
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

too tired to debug it at the moment, but I've instantly noticed that you've got a hell of a lot of list commands on strings. Probably won't cause any security problems in this script, but it will probably not do what you expect it to do for nicks containing { or }
Locked