scritp tcl !bombe
#15
cestlemien a écrit :je voulait juste demontrer/chercher que si le +c est appliqué sur un des salons ou le bombe.tcl est actif, la plupart des message ne pourront être delivrés sur le dit salon à cause des couleurs dans le script.Et donc chercher une solution, soit la detection du +c, soit et faire agir le bot en fonction.Je ne vois en rien là dedans le fait que l'on "invente" quelque chose.

La détection du +c était présente dans la première version qu'a donné alias_angelius, le souci était qu'il mettait les mêmes messages (avec les codes couleurs donc) dans les deux cas (présence ou non du +c).
Tout ce qu'il avait à faire était de supprimer les codes couleurs dans 50% des putserv.

La correction qu'alias_angelius a faite est encore pire que tout, on dirait que des lignes ont été effacées au hasard.

J'ai fait un petite version (non testée) qui vous fera peut-être comprendre comment on réfléchit à un développement:
TCL
# bombe.tcl
# !bomb <pseudo>
# !cut <couleur>
 
 
bind pub - !bomb bombe:pub
bind pub - !cut cut:pub
 
set fils(couleur) {
      jaune
      rouge
      marron
      bleu
      vert
      noir
      violet
      orange
      gris
      cyan
      blanc
      fushia
}
 
set bombe(set) 0
set bombe(nick) ""
set bombe(kickeur) ""
set bombe(good) ""
set bombe(list) ""
set bombe(timer) ""
set bombe(chan) ""
set bombe(antifloodt) ""
set bombe(antiflood) 0
set bombe(antiflood2) 0
 
proc antiflood:bomb {chan} {
      global bombe
      if {$bombe(antiflood) >= 3} {
            if {$bombe(antiflood2) == 1} { return 0 }
            putserv "PRIVMSG $chan :Contrôle de flood activé pour la commande !bomb : pas plus de 3 requête(s) toutes les 200 secondes."
            set bombe(antiflood2) 1
            set bombe(antifloodt) [utimer 200 {set bombe(antiflood) 0 ; set bombe(antiflood2) 0}]
            return 0
      } else {
            incr bombe(antiflood)
      }
}
 
proc filtout {chan text} {
      if [string match "*c*" [getchanmode $chan]] {
            return [stripcodes abcgru $text]
      } else {
            return $text
      }
}
 
proc bombe:pub {nick uhost hand chan arg} {
      global fils bombe botnick
      if {[string tolower [lindex $arg 0]] == [string tolower $botnick]} {
            putkick $chan $nick [filtout $chan "\00313O\0031wned \00313<3"]
            return 0
      }
      if {$bombe(set) == 1} {
            set msg [filtout $chan "\00314Bombe \| \0034Le jeu est deja en cours d'utilisation."]
            putserv "PRIVMSG $chan :$msg"
            return 0
      }
      if {[lindex $arg 0] == ""} {
            set msg [filtout $chan "\00314Bombe\003 \| !bomb PSEUDO"]
            putserv "PRIVMSG $chan :$msg"
            return 0
      }
      if {![antiflood:bomb $chan]} { return 0 }
 
      set bombe(set) 1
      set bombe(nick) [lindex $arg 0]
      set bombe(kickeur) $nick
      set cdf [rand 4]
      incr cdf
      set x 0      
      set bombe(chan) $chan
      set bombe(timer) [utimer 30 {putkick $bombe(chan) $bombe(nick) [filtout $bombe(chan) "\002Boum !!!\002 Temps écoulé !"]; set bombe(set) 0}]
       while {$x<=$cdf} {
            if {$x == 0} { set bombe(list) "" }
             set bombe(list) "$bombe(list) [lindex $fils(couleur) [rand [llength $fils(couleur)]]]"
 
             incr x
       }
      set bombe(good) [lindex $bombe(list) [rand [llength $bombe(list)]]]
      putlog "$bombe(list) + $bombe(good)"
      set msg [filtout $chan "\00314Bombe \| \0031Attention\0034 $bombe(nick) \0031Tu dois couper le bon fil tu as 30 secondes :\0034 $bombe(list) \0031( !cut couleur )"]
	  putserv "PRIVMSG $chan :$msg"
}
 
 
proc cut:pub {nick uhost hand chan arg} {
      global bombe
      if {$bombe(set) == 1} {
            if {$nick == $bombe(nick)} {
                  if {[lindex $arg 0] == $bombe(good)} {
                        set msg [filtout $chan "\00314Bombe \| \0031Joli\0034 $nick !! Tu as trouvé le bon fil \0031:D"]
                        putserv "PRIVMSG $chan :$msg"
                  } else {
                        set msg 
                        putkick $chan $nick [filtout $chan "\00314Boum !! Dtc !! Le bon fil était\0034 $bombe(good)"]
                  }
                  set bombe(set) 0
                  killutimer $bombe(timer)
            } else {
                  set msg [filtout $chan "\00314Bombe\003 \| C'est a $bombe(nick) de couper le fil !"]
                  putserv "PRIVMSG $chan :$msg"
            }
      }
}
 
putlog "\[bomb\] a été chargé."



EditRazzetite modification pour utiliser des putkick plutôt que des putserv "kick" partout.
Répondre


Messages dans ce sujet
scritp tcl !bombe - par cecile155 - 29/12/2010, 17:14
RE: scritp tcl !bombe - par CrazyCat - 29/12/2010, 17:23
RE: scritp tcl !bombe - par cestlemien - 29/12/2010, 17:27
RE: scritp tcl !bombe - par cecile155 - 29/12/2010, 17:32
RE: scritp tcl !bombe - par cestlemien - 29/12/2010, 17:36
RE: scritp tcl !bombe - par cecile155 - 29/12/2010, 17:36
RE: scritp tcl !bombe - par CrazyCat - 29/12/2010, 18:48
RE: scritp tcl !bombe - par cestlemien - 29/12/2010, 18:55
RE: scritp tcl !bombe - par CrazyCat - 29/12/2010, 19:01
RE: scritp tcl !bombe - par cestlemien - 29/12/2010, 19:07
RE: scritp tcl !bombe - par cestlemien - 29/12/2010, 20:20
RE: scritp tcl !bombe - par cestlemien - 29/12/2010, 20:56
RE: scritp tcl !bombe - par CrazyCat - 29/12/2010, 22:35
RE: scritp tcl !bombe - par cestlemien - 29/12/2010, 23:12
RE: scritp tcl !bombe - par CrazyCat - 30/12/2010, 13:14
RE: scritp tcl !bombe - par cecile155 - 30/12/2010, 14:12
RE: scritp tcl !bombe - par CrazyCat - 30/12/2010, 21:24
RE: scritp tcl !bombe - par cecile155 - 30/12/2010, 22:29

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté