12/07/2009, 17:30
salut fedora,
le motd c est juste un fichier qui sert de message d accueil, si tu veus modifier la pl il fait utiliser des binds "filt" (pour les msg) "chon" et "chof" (pour les join part) et "dcc".
voila un petit code que j ai fait il y a quelque temps et qui reprend le système de box
le motd c est juste un fichier qui sert de message d accueil, si tu veus modifier la pl il fait utiliser des binds "filt" (pour les msg) "chon" et "chof" (pour les join part) et "dcc".
voila un petit code que j ai fait il y a quelque temps et qui reprend le système de box
tcl
###############################
# Pour l aide tapez .box aide #
###############################
####################################
# flag +X: (user) Box n°1 #
# flag +Y: (oper) Box n°1 et 2 #
# flag +Z: (admin) Box n°1, 2 et 3 #
####################################
set flag(u) +X
set flag(o) +Y
set flag(a) +Z
# Salon ou seront loggées les entrées
set boxlog "#tcl"
# IMPROTANT
# Supprimez le listen "users" qui se trouve dans la configuration de votre eggdrop
# Il sera remplacé par celui ci
set boxport 6000
# Ouveture du port
listen $boxport users
# Pour charger la box mettez la ligne suivente dans votre config (sans le #)
# source scripts/box.tcl
#################################
# ajout de commandes a la Box #
#################################
#bind dcc B test box::test
#proc box::test {hand idx arg} {
# .......
#}
###########################
# Fin de la configuration #
###########################
bind filt - * box:msg
bind chon - * box:chon
bind chof - * box:chof
bind dcc - box join:box
bind msg - box ctcp:box
proc ctcp:box {nick host hand arg} {
if {[validuser $hand]} {
putquick "PRIVMSG $nick :\001DCC CHAT chat [myip] $::boxport\001"
} else {
putquick "NOTICE $nick :Je n' accepte que les utilisateurs enregistré."
}
}
proc box:chon {hand idx} {
global box
if [matchattr $hand B] {
if [matchattr $hand $::flag(u)] {set b 1}
if [matchattr $hand $::flag(o)] {set b 2}
if [matchattr $hand $::flag(a)] {set b 3}
if {![info exists b]} {putdcc $idx "*** Voux entrez dans la Party Line\n \nPour l'aide de la Box utilisez \002.box -h\002";return}
set box($idx) $b
foreach id [array names box] {
if {[valididx $id] && $id!=$idx && $box($id)==$box($idx)} {
putbbox $id "*** $hand entre dans la Box n°$box($idx)"
}
}
putdcc $idx "*** Voux entrez dans la Box n°$box($idx)\n \nPour l'aide de la Box utilisez \002.box -h\002"
putboxlog $idx "Entre dans la Box n°$box($idx) (connection)"
} else {
putdcc $idx "*** Voux entrez dans la Party Line"
putboxlog $idx "Entre dans la Party Line (connection)"
}
}
proc box:chof {hand idx} {
global box
if {[info exists box($idx)]} {
foreach id [array names box] {
if {[valididx $id] && $id!=$idx && $box($id)==$box($idx)} {
putbbox $id "*** $hand sort de la Box n°$box($idx)"
}
}
putboxlog $idx "Sort de la Box n°$box($idx) (déconnection)"
unset box($idx)
}
}
proc box:msg {idx arg} {
global box
if {![matchattr [idx2hand $idx] B]} {
if {[string index $arg 0]=="."} {
return $arg
} else {
putdcc $idx "Vous n' étes pas dans une Box"
}
return
}
if {[lindex $arg 0]==".notice"} {
set nick [lindex $arg 1]
set text [lrange $arg 2 end]
if {$text==""} {putdcc $idx "\002Syntaxe:\002 .notice <pseudo> <texte>";return}
if {[valididx [hand2idx $nick]] && $box($idx)==$box([hand2idx $nick])} {
putdcc [hand2idx $nick] "\[Notice\] -\002[idx2hand $idx]@Box n°$box($idx)\002- $text"
} else {
putdcc $idx "\002$nick\002 n' est pas dans la Box n°$box($idx)"
}
return
}
if {[lindex $arg 0]==".liste"} {
if {![matchattr [idx2hand $idx] $::flag(a)]} {
putdcc $idx " Liste de la Box n°$box($idx) \n "
foreach id [array names box] {
if {$box($id)==$box($idx) && [valididx $id]} {
putdcc $idx "\002[idx2hand $id]\002"
}
}
} else {
foreach id [array names box] {
if {[valididx $id]} {
append z($box($id)) "\002[idx2hand $id]\002\n"
}
}
foreach b [array names z] {
putdcc $idx " Liste de la Box n°$b \n "
putdcc $idx "$z($b)\n"
}
}
putdcc $idx "Fin de la liste."
return
}
if [matchattr [idx2hand $idx] $::flag(a)] {
if {[lindex $arg 0]==".kill"} {
set nick [lindex $arg 1]
set text [lrange $arg 2 end]
if {$nick==""} {putdcc $idx "\002Syntaxe:\002 .kill <pseudo> ?raison?";return}
if {$text==""} {set text "Abus"}
if {[valididx [hand2idx $nick]] && [info exists box([hand2idx $nick])]} {
putdcc [hand2idx $nick] "*** vous avez été kill par [idx2hand $idx] ($text)"
putboxlog $idx "Kill \002$nick\002 de la Box n°$box([hand2idx $nick]) ($text)"
killdcc [hand2idx $nick] "KILLED ([idx2hand $idx] ($text))"
} else {
putdcc $idx "\002$nick\002 n' est pas connecté à la Box"
}
return
}
if {[lindex $arg 0]==".whois"} {
set nick [lindex $arg 1]
if {$nick==""} {putdcc $idx "\002Syntaxe:\002 .whois <pseudo>";return}
if {[valididx [hand2idx $nick]]} {
if {[info exists box([hand2idx $nick])]} {
putdcc $idx "\002[idx2hand [hand2idx $nick]]\002 se trouve dans la Box n°$box([hand2idx $nick])"
} else {
putdcc $idx "\002[idx2hand [hand2idx $nick]]\002 se trouve dans la Party Line"
}
} else {
putdcc $idx "\002$nick\002 n' est pas connecté"
}
return
}
if {[lindex $arg 0]==".msgall"} {
set text [lrange $arg 1 end]
if {$text==""} {putdcc $idx "\002Syntaxe:\002 .msgall <texte>";return}
foreach id [array names box] {
if {[valididx $id] && $id!=$idx} {
putdcc $id "<\002[idx2hand $idx]@Box n°$box($idx)\002> $text"
}
}
return
}
}
if {[string index $arg 0]=="."} {
return $arg
}
putbox $idx $box($idx) $arg
}
proc join:box {hand idx arg} {
set:box $idx $arg
}
proc set:box {idx arg} {
global box
set hand [idx2hand $idx]
if {[matchattr $hand $::flag(u)] || [matchattr $hand $::flag(o)] || [matchattr $hand $::flag(a)]} {
if {[lindex $arg 0]==""} {
putdcc $idx "Pour l'aide de la Box utilisez \002.box -h\002"
}
if {[lindex $arg 0]=="aide" || [lindex $arg 0]=="-h" || [lindex $arg 0]=="help"} {
putdcc $idx " Aide de la Box \nCommandes de gestion\n "
putdcc $idx "\002.box join ?n° 1/2/3?\002\nJoin la Box demandé. Si le n° n' est pas précisé,\njoin la plus haute Box à laquelle vous avez accés.\n "
putdcc $idx "\002.box quit\002\nVous fait quitter la Box pour rejoindre la Party Line.\n(si vous y avez accés)\n "
if [matchattr $hand $::flag(a)] {
putdcc $idx "\002.box adduser <pseudo> <host> <flag ($::flag(u)/$::flag(o)/$::flag(a))> <pass>\002\nAjoute un accés à la Box.\n "
}
putdcc $idx "Commandes de la Box\n(uniquement si vous étes connecté a une box)\n "
putdcc $idx "\002.liste\002\nAffiche la liste des users de votre box.\n "
putdcc $idx "\002.notice <pseudo> <texte>\002\nEnvoi une notice au pseudo si celui ci est dans votre box.\n "
if [matchattr $hand $::flag(a)] {
putdcc $idx "\002.msgall <texte>\002\nEnvoi un méssage à toutes les Box.\n "
putdcc $idx "\002.whois <pseudo>\002\nVous indique ou se trouve le pseudo (Box ou Party Line).\n "
putdcc $idx "\002.kill <pseudo> ?raison?\002\nKill le pseudo de la box (ne pas abuser de cette commande).\n "
}
}
if {[lindex $arg 0]=="adduser"} {
if [matchattr $hand $::flag(a)] {
set pseudo [lindex $arg 1]
set host [lindex $arg 2]
set flag [lindex $arg 3]
set pass [lindex $arg 4]
if {$pass==""} {
putdcc $idx "\002Syntaxe:\002 .box adduser <pseudo> <host> <flag ($::flag(u)/$::flag(o)/$::flag(a))> <pass>"
return
}
if {[validuser $pseudo]} {putdcc $idx "\002$pseudo\002 est deja enregistré";return}
adduser $pseudo $host
setuser $pseudo PASS $pass
chattr $pseudo +Bpl$flag
putdcc $idx "User \002$pseudo\002 ajouté avec le host \002$host\002 et le flag \002+$flag\002"
}
}
if {[lindex $arg 0]=="quit"} {
if {![info exists box($idx)]} {putdcc $idx "*** Vous n' étes dans aucune Box";return}
if [matchattr $hand o] {
chattr $hand -B
putdcc $idx "*** Voux venez de rejoindre la Party Line"
foreach id [array names box] {
if {[valididx $id] && $id!=$idx && $box($id)==$box($idx)} {
putbbox $id "*** $hand sort de la Box n°$box($idx)"
}
}
putboxlog $idx "Entre dans la Party Line (sort de la Box n°$box($idx))"
unset box($idx)
} else {
putdcc $idx "*** Vous ne pouvez pas sortir de la Box (accès refusé)"
}
return
}
if {[lindex $arg 0]=="join"} {
if {[lindex $arg 1]==""} {
if [matchattr $hand $::flag(u)] {set b 1}
if [matchattr $hand $::flag(o)] {set b 2}
if [matchattr $hand $::flag(a)] {set b 3}
}
if {[lindex $arg 1]==1} {
if {[matchattr $hand $::flag(u)] || [matchattr $hand $::flag(o)] || [matchattr $hand $::flag(a)]} {
set b 1
} else {
putdcc $idx "*** Vous ne pouvez pas entrer dans la Box n°[lindex $arg 1] (accès refusé)"
return
}
}
if {[lindex $arg 1]==2} {
if {[matchattr $hand $::flag(o)] || [matchattr $hand $::flag(a)]} {
set b 2
} else {
putdcc $idx "*** Vous ne pouvez pas entrer dans la Box n°[lindex $arg 1] (accès refusé)"
return
}
}
if {[lindex $arg 1]==3} {
if [matchattr $hand $::flag(a)] {
set b 3
} else {
putdcc $idx "*** Vous ne pouvez pas entrer dans la Box n°[lindex $arg 1] (accès refusé)"
return
}
}
if {[info exists box($idx)]} {
if {$b==$box($idx)} {putdcc $idx "*** Vous étes déjà dans la Box n°$box($idx)";return}
set old $box($idx)
}
if {![info exists b]} {putdcc $idx "*** Vous n' avez pas accès à la Box";return}
chattr $hand +B
set box($idx) $b
putdcc $idx "*** Voux entrez dans la Box n°$box($idx)"
if {[info exists old]} {
putboxlog $idx "Entre dans la Box n°$box($idx) (sort de la Box n°$old)"
} else {
putboxlog $idx "Entre dans la Box n°$box($idx) (sort de la Party Line)"
}
foreach id [array names box] {
if {[valididx $id] && $id!=$idx && [info exists old] && $box($id)==$old} {
putbbox $id "*** $hand sort de la Box n°$old"
}
if {[valididx $id] && $id!=$idx && $box($id)==$box($idx)} {
putbbox $id "*** $hand entre dans la Box n°$box($idx)"
}
}
}
} else {
putdcc $idx "Accune aide disponible."
}
}
proc putbox {idx nb arg} {
global box
foreach id [array names box] {
if {[valididx $id] && $id!=$idx && $box($id)==$nb} {
putdcc $id "<\002[idx2hand $idx]@Box n°$nb\002> $arg"
}
}
}
proc putbbox {idx arg} {
global box
if {[valididx $idx]} {
putdcc $idx "<\002$::botnick\002> $arg"
}
}
proc putboxlog {idx arg} {
putquick "PRIVMSG $::boxlog :\002[idx2hand $idx]\002 $arg"
#putlog "\002[idx2hand $idx]\002 $arg"
}
putlog "Box.tcl v0.3 par \002Dj_KennY\002"