11/11/2011, 12:01
petites corrections
tcl
namespace eval ::av {
variable salons "#salon1 #salon2 #salon3"
variable time 15
variable lignes 5
bind time - "* * * * *" av::Vvoice
proc Vvoice {1 2 3 4 5} {
variable idle
variable salons
variable time
foreach salon [string tolower $salons] {
if ![validchan $salon] continue
foreach nick [chanlist $salon] {
if {[isbotnick $nick] || [isop $nick $salon]} continue
if {[info exists idle($salon)] && [dict exists $idle($salon) $nick]} {
set n [dict get $idle($salon) $nick]
set t1 [lindex $n 1]
set t [expr [unixtime]-$t1]
if {$t>[expr $time*60] && [isvoice $nick $salon]} {
pushmode $salon -v $nick
}
if {$t>300} {
dict set idle($salon) $nick [list 0 $t1]
}
} else {
dict set idle($salon) $nick [list 0 [unixtime]]
}
}
flushmode $salon
}
}
bind pubm - * av::Pvoice
proc Pvoice {nick host hand chan arg} {
variable lignes
variable salons
variable idle
set chan [string tolower $chan]
if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
set n [dict get $idle($chan) $nick]
set i [lindex $n 0]
dict set idle($chan) $nick [list [incr i] [unixtime]]
if {$i>=$lignes} {pushmode $chan +v $nick}
} else {
dict set idle($chan) $nick [list 1 [unixtime]]
}
}
bind join - * av::joinC
proc joinC {nick host hand chan} {
variable salons
set chan [string tolower $chan]
if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
variable idle
dict set idle($chan) $nick [list 0 [unixtime]]
}
bind nick - * av::chgn
proc chgn {nick host hand chan new} {
variable salons
set chan [string tolower $chan]
if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
variable idle
if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
dict set idle($chan) $new [dict get $idle($chan) $nick]
dict unset idle($chan) $nick
} else {
dict set idle($chan) $new [list 0 [unixtime]]
}
}
}
Citation :Il devrai se déclenché au boue de 5 phrases au pire a la 6eme bah la il se déclenche a la 11eme Smile alors que ma variable et a 5 Smilechez moi ça fonctionne parfaitement, essais de restart ton bot