bind pub m|m "!LockDown" LockDown
bind pub m|m "!UnLock" UnLock
bind pubm - "*CONNECT*" CONNECTLOCKDOWN
proc LockDown { nick host hand chan text } {
global botnick LockDown
set LockDown on
putquick "MODE $botnick +s +cFs"
foreach chan [channels] {
putquick "MODE $chan +mNipCRS"
putquick "MODE $chan +k LockDownModeInitiated"
putquick "PRIVMSG $chan Network is going into lockdown mode, from this point until LockDown is removed, no one will be able to connect to this network."
}
}
proc UnLock { nick host hand chan text } {
global botnick LockDown
set LockDown off
putquick "MODE $botnick -s -cFs"
foreach chan [channels] {
putquick "MODE $chan -mNipCRS"
putquick "MODE $chan -k LockDownModeInitiated"
putquick "PRIVMSG $chan Network is off of LockDown, everything is back to normal."
}
}
proc CONNECTLOCKDOWN { nick host hand chan text } {
global LockDown
set User [lindex [split $text] 3]
if {$chan == "#4ct1v1ty" && $LockDown == "on"} {
putserv "GLINE [stripcodes bcruag $User] 5m :Network is in lockdown mode, this ban will expire in 5 minuets, please reconnect at that time"
} else {
return
}
}
I get this error:
[10/04/08][14:48:04] <NightCrawler> [11:41] Tcl error [CONNECT]: can't read "LockDown": no such variable
Last edited by Branden on Sat Oct 04, 2008 3:13 pm, edited 1 time in total.
This is because the variable isn't declared yet. The global command only links the variable name in the local namespace to the one in globalspace, or simply, "myvar" is translated to "::myvar". You still have to create ::myvar.
In your case, it is most likely due to neither LockDown or UnLock being called yet. Easy fix would be to instantiate the variable as the script loads: