saywhat | 29 Mart 2013 03:38 | Cevap: !duyuruekle & !duyurucikar kodu baştan sıfırdan yazdım... eski haline göre yazmak kafamı karıştırmaktan başka işe yaramıyordu..bi sürü salakça hatalar vardı.
<bu kodda hiç denenmedi> çalışıp çalışmayacağını bilmiyorum.sadece syntax check yaptım...ters bir döneme denk geldi benim için şu aralar PC başında geçirecek vaktim olmuyor.
kod hiç denenmedi.denemek yine size kalıyor. kodu şurdan da alabilirsiniz -> [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] foruma yapıştırırken iç içe geçiyor. Kod:
setudef flag duyuru
bind pub -|- "*" duyuru:pub
bind msgm -|- "*" duyuru:duyur
proc duyuru:pub {nick uhost hand chan text} {
if {![channel get $chan duyuru] || ![isop $nick $chan]} { :return }
set dyrkmt [lindex [split $text] 0]
set dyrno [lindex [split $text] 1]
set dyrmsg [join [lrange [split $text] 2 end]]
set dzn "duyurular.txt"
switch -- $dyrkmt {
"!dyrekle" {
if {[llength "$text"] == "0"} {
putserv "notice $nick :eksik giriş"
return
}
if {![file exists "$dzn"]} {
set abc [open "$dzn" w]
} else {
set abc [open "$dzn" a]
}
puts $abc "$text"
close $abc
putserv "notice $nick :eklendi \002$text\002"
}
"!dyrsil" {
if {![file exists "$dzn"]} {
putserv "notice $nick :\002$dzn\002 boş"
return
}
if {[llength "$dyrno"] == "0"} {
putserv "notice $nick :eksik komut"
return
}
set abc [open "$dzn"]
set lines [split [read -nonewline $abc] "\n"]
close $abc
if {[llength $lines] == "0"} {
putserv "notice $nick :\002$dzn\002 boş"
return
}
set say 0
set satir [lsearch $lines $dyrno]
while {"$satir" != "-1"} {
set lines [lreplace $lines $satir $satir]
set satir [lsearch $lines $dyrno]
incr say
}
set abc [open "$dzn" w]
puts $abc [join $lines "\n"]
close $abc
if {"$say" > "1"} {
set s ""
} else {
set s "s"
}
putserv "notice $nick :istenen \002$dyrno\002 silindi $say süre$s"
}
"!dyrliste" {
if {![file exists "$dzn"]} {
putserv "notice $nick :\002$dzn\002 yok"
return
}
set dyrno 0
set abc [open "$dzn"]
set lines [split [read -nonewline $abc] "\n"]
close $abc
if {[llength $lines] == "0"} {
putserv "notice $nick :\002$dzn\002 boş"
return
}
foreach line $lines {
if {[llength $line] == "0"} {
set line "-Yok-"
}
putserv "notice $nick :\002$dyrno \002 $line"
incr dyrno
}
putserv "notice $nick :son"
}
"default" {
if {![file exists "$dzn"]} {
putserv "privmsg $nick :\002$dzn\002 boş"
return
}
set dyrno 0
set abc [open "$dzn"]
while {![eof $abc]} {
set line [gets $abc]
if {[llength $line] == "0"} {
set line "-Yok-"
}
putserv "privmsg $nick :$dyrno $line"
incr dyrno
}
close $abc
putserv "privmsg $nick :son"
}
return 1
}
}
proc duyuru:duyur {nick dyrkmt dyrno} {
set dyrkmt [lindex [split $text] 0]
set dyrno [lindex [split $text] 1]
if {[string match "dyr" $dyrkmt] || [string match "duyur*" $dyrkmt]} {
return $duyuru:pub
}
}
putlog "tamam..."
# EOF |