Aide : Mirc - Tcl - Eggdrop - Java
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
-50%
Le deal à ne pas rater :
-50% Baskets Nike Air Huarache Runner
69.99 € 139.99 €
Voir le deal

News Tcl By Euro

Aller en bas

News Tcl By Euro Empty News Tcl By Euro

Message par H3Li0s Ven 27 Fév - 16:23

#set notice_on_join "no"
set notice_on_join "yes"
set news_cookie_path "/home/hote/nom_du_robot/fichier-du-script/news/"
set salonstaff {
"#aide+"
"#staff"
" etc "
}
bind pub *|* !news show_news
bind pub *|* !flushnews flush_news
bind pub *|* !delnews del_news
bind pub *|* !addnews add_news
bind join * * checknewscript
proc checknewscript { nick host handle chan } {
global news_cookie_path notice_on_join salonstaff vhostnivnews
foreach nickok $vhostnivnews {
if {[string match -nocase $nickok $host]} {
foreach salonst $salonstaff {
if {[string equal -nocase $salonst $chan]} {
set chkuser [join [list $nick]]
if {$notice_on_join == "no" } { return 1 }
set thereis [file exists [file join $news_cookie_path $chkuser]]
if {$thereis == 0} {
set usercookie [open [file join $news_cookie_path $chkuser] "w+"]
puts $usercookie "000000000000"
close $usercookie
}
set usercookie [open [file join $news_cookie_path $chkuser] "r+"]
set cookie [gets $usercookie]
close $usercookie
set thereis [file exists [file join ./ news_$chan.txt]]
if {$thereis == 0} { return 1 }
set newsfile [open [file join ./ news_$chan.txt] "r+"]
set numonews 0
while {[eof $newsfile] == 0} {
set line [gets $newsfile]
set delimn [string last "(+++" $line]
set delimt [string last "(+-+" $line]
set stlen [string length $line]
set adtim [string range $line [expr {$delimt} + 4] [expr {$stlen} - 2]]
if { $line != "" } {
set timestamp "[string range $adtim 12 15][string range $adtim 9 10][string range $adtim 6 7][string range $adtim 0 1][string range $adtim 3 4]"
if {$timestamp > $cookie} {
incr numonews
}
}
}
close $newsfile
if {$numonews > 0} { putserv "NOTICE $nick :NEWS !!! Nouvelles news sur $chan depuis ta dernière visite. Tape \"!news $numonews\" pour les lire" }
eval "exec rm -f $news_cookie_path/$chkuser"
set newstamp [strftime "%Y%m%d%H%M"]
set usercookie [open [file join $news_cookie_path $chkuser] "w+"]
puts $usercookie "$newstamp"
close $usercookie
}
}
}
}
}
proc flush_news { nick uhost hand chan text } {
global salonstaff vhostniv3
foreach salonst $salonstaff {
if {[string match -nocase $salonst $chan]} {
foreach vhost $vhostniv3 {
if {[string match -nocase $vhost $uhost]} {
putserv "NOTICE $nick :Suppression de ttes les news de $chan"
eval "exec rm -f ./news_$chan.txt"
return 1
}
}
}
}
}
proc del_news { nick uhost hand chan text } {
global salonstaff vhostnivaddnews
if { [string match -nocase "#salon" $chan] && ([string match -nocase "*@*anim*" $uhost] || [string match -nocase "*@*OpZone*" $uhost] || [string match -nocase "*@*AdminZone*" $uhost] || [string match -nocase "*@CoChefZone*" $uhost]) } {
return 0
}
foreach salonst $salonstaff {
if {[string match -nocase $salonst $chan]} {
foreach vhost $vhostnivaddnews {
if {[string match -nocase $vhost $uhost] || [isop $nick $chan]} {
putserv "NOTICE $nick :\0034Suppression news num <\00312$text\0034>"
set thereis [file exists [file join ./ temp_$chan.txt]]
if {$thereis != 0} {
eval "exec rm -f ./temp_$chan.txt"
}
set tempfile [open [file join ./ temp_$chan.txt] "w+"]
set newsfile [open [file join ./ news_$chan.txt] "r+"]
if {[eof $newsfile]} {
putserv "NOTICE $nick :Pas de news."
close $newsfile
close $tempfile
} else {
set ln 1
while {[eof $newsfile] == 0} {
set line [gets $newsfile]
set msg $line
set dele 0
foreach prm $text {
if {$ln == $prm} {
set dele 1
}
}
if {$dele == 0} {
if {$msg != ""} {
puts $tempfile "$msg"
}
}
set dele 0
set ln [expr {$ln} +1]
}
close $tempfile
close $newsfile
eval "exec mv -f ./temp_$chan.txt ./news_$chan.txt"
}
return 1
}
}
}
}
}
proc add_news { nick uhost hand chan text } {
global news_cookie_path salonstaff vhostnivaddnews
if { [string match -nocase "#salon" $chan] && ([string match -nocase "*@*anim*" $uhost] || [string match -nocase "*@*OpZone*" $uhost] || [string match -nocase "*@*AdminZone*" $uhost] || [string match -nocase "*@CoChefZone*" $uhost]) } {
return 0
}
foreach salonst $salonstaff {
if {[string match -nocase $salonst $chan]} {
foreach vhost $vhostnivaddnews {
if {[string match -nocase $vhost $uhost] || [isop $nick $chan]} {
if {$text == ""} {
putserv "NOTICE $nick :\00312- Syntax !addnews news -"
return 0
}
set chkuser [join [list $nick]]
set msg $text
set thereis [file exists [file join ./ news_$chan.txt]]
set cmp [expr {$thereis} == 1]
if {$cmp} {
set newsfile [open [file join ./ news_$chan.txt] "a+"]
} else {
set newsfile [open [file join ./ news_$chan.txt] "w+"]
}
puts $newsfile "+ $msg (+++$chkuser) (+-+[strftime "%H:%M %d.%m.%Y"])"
putserv "NOTICE $nick :\00312- Votre news a été enregistré -"
close $newsfile
eval "exec rm -f $news_cookie_path/$chkuser"
set newstamp [strftime "%Y%m%d%H%M"]
set usercookie [open [file join $news_cookie_path $chkuser] "w+"]
puts $usercookie "$newstamp"
close $usercookie
return 1
}
}
}
}
}
proc show_news { nick uhost hand chan text } {
global news_cookie_path salonstaff salontaffdon vhostnivnews
foreach nickok $vhostnivnews {
if {[string match -nocase $nickok $uhost]} {
foreach salonst $salonstaff {
if {[string match -nocase $salonst $chan]} {
set chkuser [join [list $nick]]
set npct [lindex $text 0]
if {[llength $text] > 1 } {
putserv "NOTICE $nick :Whuz up?"
return 1
}
eval "exec rm -f $news_cookie_path/join $chkuser"
set newstamp [strftime "%Y%m%d%H%M"]
set usercookie [open [file join $news_cookie_path $chkuser] "w+"]
puts $usercookie "$newstamp"
close $usercookie
set thereis [file exists [file join ./ news_$chan.txt]]
if {$thereis == 0} {
putserv "NOTICE $nick :Pas de news pour $chan en ce moment."
return 1
}
set nbrnews [lindex [exec wc -l news_$chan.txt] 0]
if {[llength $text] == 0 || $npct > $nbrnews || $npct <= 0} {
set npct "$nbrnews"
}
set newsfile [open "| tail -n $npct news_$chan.txt" "r+"]
if {[eof $newsfile]} {
putserv "NOTICE $nick :Pas de news presentes."
close $newsfile
} else {
set yes 0
set nbrnews [lindex [exec wc -l news_$chan.txt] 0]
if {[llength $text] == 0 } {
set numnews 0
} else {
set numnews [expr {$nbrnews - $npct}]
}
while {[eof $newsfile] == 0} {
set line [gets $newsfile]
incr numnews
set delimn [string last "(+++" $line]
set delimt [string last "(+-+" $line]
set msg [string range $line 2 [expr {$delimn} - 2]]
set stlen [string length $line]
set adder [string range $line [expr {$delimn} + 4] [expr {$delimt} - 3]]
set adtim [string range $line [expr {$delimt} + 4] [expr {$stlen} - 2]]
if { $msg != "" } {
putquick "NOTICE $nick :-5 $numnews - (\0033 $adtim \017): \00312$msg \0030[encrypt lala $nick]\017(\0034$adder\017)"
}
set yes 1
}
if { $yes==0 } {
putserv "NOTICE $nick :Pas de news."
}
close $newsfile
unset numnews
}
set filetaff "./taff.txt"

if { $nick == "Escapology" } {
foreach saltaff $salontaffdon {
if {[string match -nocase $saltaff $chan]} {
foreach vhost $vhostniv2 {
if {[string match -nocase $vhost $uhost]} {
if {![file exists $filetaff]} {
putquick "PRIVMSG $nick :-5 Pas de taff -"
return 0
}
set data [open $filetaff "r"]
set numtaff 0
while {![eof $data]} {
gets $data datataff
incr numtaff
if { $datataff != "" } {
putquick "PRIVMSG $nick :-5 $numtaff - $datataff"
}
}
if {[eof $data]} {
putquick "PRIVMSG $nick :- 3Fin de la liste 1(6 taffs 1/6 bugs 1) -"
close $data
}
}
}
}
}
}
}
}
}
}
}

H3Li0s
Admin

Masculin Nombre de messages : 22
Age : 32
Date d'inscription : 27/02/2009

https://aide-tcl-mirc.kanak.fr

Revenir en haut Aller en bas

Revenir en haut


 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum