Tcl limite salon
#9
tcl
##### DEBUT DU PROGRAMME #####
 
bind time - "* * * * *" limit:time:check
bind join - "*" limit:join
bind part - "*" limit:part
proc limit:join {nick handle host chan} {
   limit:time:check 0 0 0 0 0
}
proc limit:part {nick handle host chan {msg ""}} {
   limit:time:check 0 0 0 0 0
}
proc limit:time:check { min hour day month year } {
	global limit
	set limite_actuelle 5
	foreach chan [channels] {
		if {(($limit(channel) != "all") && ([lsearch -exact $limit(channel) $chan] != -1)) || ($limit(channel) == "all")} {
			if {[string match *l* [lindex [getchanmode $chan] 0]]} {
				if {[string match *k* [lindex [getchanmode $chan] 0]]} {
					set limite_actuelle [lindex [getchanmode $chan] 2]
				} else {
					set limite_actuelle [lindex [getchanmode $chan] 1]
				}
			}
			if {![info exists limit($chan,stop)]} {
				set limit($chan,stop) 0
			}
			set limit($chan,total) [llength [chanlist $chan]]
			if {![info exists limit($chan,total,old)]} {
				set limit($chan,total,old) $limit($chan,total)
			}
			
			# on regarde si y'a pas trop de gens qui sont rentrés sur le channel en 1 minute
			if {![info exists limit($chan,danger)]} {
				set limit($chan,danger) 1
			}
			if {$limit($chan,total) == [expr $limit($chan,total,old) + $limit(plus)]} {
				if {![info exists limit($chan,danger,moment)]} {
					set limit($chan,danger,moment) "$hour:$min"
				}
				if {([lindex [split $limit($chan,danger,moment) :] 0] == $hour) && ([expr [lindex [split $limit($chan,danger,moment) :] 1] + 1] == $min)} {
					# si la limite était pleine il y a une minute deja alors on incremente le danger
					set limit($chan,danger) [expr $limit($chan,danger) + 1]
				}
 
			}
			if {$limit($chan,danger) == 2} {
				putlog "#LIMIT# Je trouve qu'il y a bcp de personne qui ont rejoin $chan ... je n'augmente plus la limite pendant X secondes !"
				puthelp "privmsg $chan :#LIMIT# Je trouve qu'il y a bcp de personne qui ont rejoin $chan ... je n'augmente plus la limite pendant X secondes !"
				set limit($chan,stop) 4
				set limit($chan,danger) 1
			} else {
				if {$limit($chan,stop) > 0} {
					set limit($chan,stop) [expr $limit($chan,stop) - 1]
				} else {
					if {$limit($chan,danger) < 2} {
						if {$limite_actuelle != [expr $limit($chan,total) + $limit(plus)]} {
							pushmode $chan +l [expr $limit($chan,total) + $limit(plus)]
							set limit($chan,total,old) $limit($chan,total)
						}
					}
				}
			}
		}
	}
	return 0
}



voila se fameux code loll ;p
Répondre Avertir


Messages dans ce sujet
Tcl limite salon - par bewess - 08/03/2008, 10:37
RE: Tcl limite salon - par bewess - 08/03/2008, 11:38
RE: Tcl limite salon - par CrazyCat - 08/03/2008, 13:31
RE: Tcl limite salon - par bewess - 16/03/2008, 19:52
RE: Tcl limite salon - par DaV34 - 18/03/2008, 10:05
RE: Tcl limite salon - par bewess - 18/03/2008, 14:16
RE: Tcl limite salon - par DJ-VARIOUS - 27/03/2008, 19:03
RE: Tcl limite salon - par DaV34 - 27/03/2008, 23:03
RE: Tcl limite salon - par DJ-VARIOUS - 28/03/2008, 07:39
RE: Tcl limite salon - par DJ-VARIOUS - 28/03/2008, 17:18
RE: Tcl limite salon - par CrazyCat - 28/03/2008, 22:06
RE: Tcl limite salon - par DJ-VARIOUS - 29/03/2008, 06:32
RE: Tcl limite salon - par DJ-VARIOUS - 29/03/2008, 06:39
RE: Tcl limite salon - par CrazyCat - 29/03/2008, 18:42
RE: Tcl limite salon - par DJ-VARIOUS - 29/03/2008, 20:10
RE: Tcl limite salon - par DJ-VARIOUS - 29/03/2008, 20:56

Atteindre :


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