inainte de toate:
1. cand mai postezi cod, te rog sa o faci intre tagurile [code] si [/code]
2. threadurile cu subiect (titlu) gen 'help me pliz' sunt sterse de regula foarte repede. incearca sa pui un scurt rezumat al problemei tale pe post de titlu.
cateva din greselile importante din codul tau:
1. nu folosi niciodata instructiuni de trimitere goale. pur si simplu nu isi au rostul
2. e de preferat sa folosesti nume mai descriptive pentru denumirea proceselor (nu doar "1").
3. in acelasi proc 1, trebuia declarata si variabila $canal ca fiind globala. din cauza asta nu primeai nici un mesaj pe canal. (fie declari canal la global, fie folosesti in proc $::canal in loc de $canal)
ce as folosi eu:
Code:
set ask(chan) "#canal"
set ask(qmax) "2"
set ask(question1) "intrebarea 1"
set ask(question2) "intrebarea 2"
## adaugi intrebari dupa modelul de mai sus
## dar modifici si $ask(qmax)
bind pubm m|m "$ask(chan) !start" pub:start
bind pubm m|m "$ask(chan) !stop" pub:stop
bind time - "* * * * *" timed:ask
proc pub:start {nick uhost hand chan arg} {
global ask
if {$ask(start)} {
puthelp "PRIVMSG $chan :questions already started"
} else {
set ask(start) 1
set ask(q) 1
puthelp "PRIVMSG $chan :starting questions"
}
}
proc pub:stop {nick uhost hand chan arg} {
global ask
if {!$ask(start)} {
puthelp "PRIVMSG $chan :questions not running"
} else {
set ask(start) 0
puthelp "PRIVMSG $chan :stopping questions"
}
}
proc timed:ask {min hour day month year} {
global ask
if {![info exists ask(start)]} { set ask(start) 0 }
if {$ask(start)} {
if {$ask(q) < [expr $ask(qmax)+1]} {
puthelp "PRIVMSG $ask(chan) :$ask(question$ask(q))"
incr ask(q)
} else {
set ask(start) 0
}
}