26 Nisan 2012, 15:59
#1 Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
Cevap: meal.tcl
PHP Kod: Kodu kopyalamak için üzerine çift tıklayın!
# kodun çalışmasını istediğiniz kanal set mealkanal "#islam" # satırları okuma süresini ayarlayın(dakika) set mealzaman "5" # kanala post atmaya bu satırdan başlıyoruz set mealsatir 0 # okumayı durdurmak için kullanıcaz. setudef flag durmeal # Bu kısımdan sonrasını editlemenize gerek yok if { [ info exists mealzaman ] } { timer $mealzaman "timer:meal" } set mealtxt "scripts/meal.txt" bind pub - ! meal oku : meal proc oku : meal { nick host handle chan text } { global mealkanal mealtxt mealsatir catch { channel set $mealkanal - durmeal } if { [ isop $nick $mealkanal ] || [ ishalfop $nick $mealkanal ] || [ isvoice $nick $mealkanal ] } { if { [ lindex $text 0 ] != "" } { set satiroku [ lindex $text 0 ] } else { set satiroku $mealkanal } set mealdosya [ open $mealtxt r ] set mealoku [ split [ read $mealdosya ] \ n ] close $mealdosya # durdurma işlemini kontrol ediyoruz. if {![ channel get $mealkanal durmeal ]} { putserv "PRIVMSG $satiroku :[characters [lindex $mealoku $mealsatir ]] " set mealsatir [ expr $mealsatir + 1 ] } } else { set mealdosya [ open $mealtxt r ] set mealoku [ split [ read $mealdosya ] \ n ] close $mealdosya if {![ channel get $mealkanal durmeal ]} { putserv "PRIVMSG $nick :[characters [lindex $mealoku $mealsatir ]] " set mealsatir [ expr $mealsatir + 1 ] } } } # bu kısım durdurma işlemi için bind pub - ! durmeal durmeal proc durmeal { nick host handle chan text } { global mealkanal mealtxt mealsatir if { [ isop $nick $mealkanal ] || [ ishalfop $nick $mealkanal ] || [ isvoice $nick $mealkanal ] } { catch { channel set $mealkanal + durmeal } } putserv "PRIVMSG $chan : $mealkanal kanalında meal okuma $nick tarafından durduruldu." } proc timer : meal {} { global botnick mealkanal mealzaman mealtxt mealsatir if { [ onchan $botnick $mealkanal ] && ![ channel get $mealkanal durmeal ] } { set mealdosya [ open $mealtxt r ] set mealoku [ split [ read $mealdosya ] \ n ] close $mealdosya putserv "PRIVMSG $mealkanal :[characters [lindex $mealoku $mealsatir ]] " set mealsatir [ expr $mealsatir + 1 ] timer $mealzaman "timer:meal" } } proc characters { description } { regsub - all "Ü" $description "Ü" description regsub - all "ÅŸ" $description "Ş" description regsub - all "ÄŸ" $description "G" description regsub - all "Ç" $description "Ç" description regsub - all "İ" $description "İ" description regsub - all "Ö" $description "Ö" description regsub - all "ü" $description "ü" description regsub - all "ÅŸ" $description "ş" description regsub - all "ÄŸ" $description "g" description regsub - all "ç" $description "ç" description regsub - all "ı" $description "ı" description regsub - all "ö" $description "ö" description regsub - all "{" $description "" description regsub - all "}" $description "" description return $description }