Alt cod care mult mai bun si mult mai optimizat
Code:
## $Id: intrebari.tcl, version 0.1 , ggdrop-1.6.x 2005 dpgc@purehype.net Exp $
## Author: Kurupt
## Info: Will ask questions
## Thanks to:
# smart@UnderNet#ro-tcl
#
## Contact: mail: dpgc@purehype.net
# irc : #ro-tcl (on undernet)
# web : http://code.aitia.info
## History: Am folosit altceva in afara de switch . Ideea lui universalia
set teste(chan) "#bucuresti"
set teste(1) "Intrebarea1"
set teste(2) "Intrebarea2"
set teste(3) "Intrebarea3"
set teste(4) "Intrebarea4"
set teste(5) "Intrebarea5"
bind pub N|nm .intrebare teste:info:exist
# PROCES
proc teste:info:exist {nick uhost hand chan text} {
global teste
if {[llength $text] <= 0 } {
putserv "notice $nick :Comenzile: .intrebare <nr>"
return 0
}
if { [info exists teste($text)]} {
puthelp "PRIVMSG $chan :$teste($text)"
} {
puthelp "PRIVMSG $chan :$nick - question \002$text\002 doesn't exist"
}
}
putlog "teste loaded"