Aide Script TCL TozTrivia (Quizz)
#5
Code :
#Efface la gestion du pseudo score, pour un joueur sortant du salon.
proc tgnickpart {nick uhost hand chan {msg ""}} {
    global botnick tganick
    if {$nick != $botnick} {
        if {[file exists $tganick[strlwr $nick].txt]} {
            file delete -force $tganick[strlwr $nick].txt
        } else {
            return 0
        }
    }
}

#Efface la gestion du pseudo score, pour un joueur quittant le serveur.
proc tgnickquit {nick uhost hand chan {msg ""}} {
    global botnick tganick
    if {$nick != $botnick} {
        if {[file exists $tganick[strlwr $nick].txt]} {
            file delete -force $tganick[strlwr $nick].txt
        } else {
            return 0
        }
    }
}

#Changement de nick une fois sur le salon.
proc tgnick { nick uhost handle chan newnick } {
    global botnick tganick tgstreak
    if {$nick != $botnick} {
        if {[lindex [split $tgstreak ,] 0] == [strlwr $nick]} {
        set _tmptgstreak [lindex [split $tgstreak ,] 1]
        set tgstreak [strlwr $newnick],$_tmptgstreak
        }
        if {[strlwr $newnick] != [strlwr $nick]} {
            if {[file exists $tganick[strlwr $nick].txt]} {
                set fHnd3 [open $tganick[strlwr $nick].txt r]
                set _nick [lsort -dict -increasing [split [gets $fHnd3]]]
                close $fHnd3
                set fHnd3 [open $tganick[strlwr $newnick].txt w]
                puts $fHnd3 "[strlwr $_nick]"
                close $fHnd3
                file delete -force $tganick[strlwr $nick].txt
            } else {
                set fHnd3 [open $tganick[strlwr $newnick].txt w]
                puts $fHnd3 "[strlwr $nick]"
                close $fHnd3
            }
        } else {
            return 0
        }
    }
}

#Attribution manuelle d'un nick de jeu.
proc tgmnick { nick uhost handle chan arg } {
    global botnick tganick tgchan
    if {$chan == $tgchan } {
        if {$nick != $botnick} {
            if {$arg=="fille" || $arg=="garcon"} {
                [tgpriv] $nick "[tgcolmisc1]Erreur ! Veuillez ajouter un [tgcolmisc2]S[tgcolmisc1] à [tgcolmisc2][strlwr $arg][tgcolmisc1] svp !"
                return 0
            }            
            if {$arg=="filles" || $arg=="garcons"} {
                set fHnd4 [open $tganick[strlwr $nick].txt w]
                puts $fHnd4 "[strlwr $arg]"
                close $fHnd4
                [tgpriv] $nick "[tgbold][tgcolmisc2]$nick[tgcolmisc1], J'ai bien enregistré ta demande, tu joueras avec les [strlwr $arg], Bonne chance !"
            } else {
                [tgpriv] $nick "[tgcolmisc1]Cette soirée est basé sur le thème filles contre garçons, merci de preciser votre camp, en tapant: [tgcolmisc2]!jesuis filles[tgcolmisc1] ou [tgcolmisc2]!jesuis garcons"
            }
        }
    }
}

#Attribution forcé par un admin d'un nick de jeu.
proc tgmnickadmin { nick uhost handle chan arg } {
    global botnick tganick tgchan
    if {$chan == $tgchan } {
        if {[lindex $arg 1]=="fille" || [lindex $arg 1]=="garcon"} {
            [tgpriv] $nick "[tgcolmisc1]Erreur ! Veuillez ajouter un [tgcolmisc2]S[tgcolmisc1] à [tgcolmisc2][strlwr [lindex $arg 1]][tgcolmisc1] !"
        }            
        if {[lindex $arg 1]=="filles" || [lindex $arg 1]=="garcons"} {
            set fHnd4 [open $tganick[strlwr [lindex $arg 0]].txt w]
            puts $fHnd4 "[strlwr [lindex $arg 1]]"
            close $fHnd4
            [tgpriv] $nick "[tgbold][tgcolmisc1]Validation ![tgcolmisc2] [strlwr [lindex $arg 0]] [tgcolmisc1]jouera avec les[tgcolmisc2] [strlwr [lindex $arg 1]][tgcolmisc1]."
        } else {
            return 0
        }
    }
}

#Vérification des pseudos non identifiés en filles ou garçons.
proc tgmnickcontrole { nick uhost handle chan arg } {
    global tganick tgchan
    if {$chan == $tgchan } {
        set _listenick "[tgcolmisc1]Liste des pseudos non identifiés: "
        set _listenick1 ""
        foreach nick [lsort [chanlist $tgchan]] {
            if {![file exists $tganick[strlwr $nick].txt]} {
                append _listenick1 "[tgcolmisc2]$nick[tgcolmisc1], "
            }
        }
        if {$_listenick1==""} {
            tggamemsg "[tgcolmisc1]La liste est vide."
        } else {
            append _listenick $_listenick1
            tggamemsg "$_listenick"
        }
    }    

}

j'utilise cette version du code, que j'ai crée pour la gestion des pseudos, pour les Quizz filles vs Garçons.
Pour les equipes tu peux aussi l'utiliser, en modifiant ou ajoutant quelques lignes.

Dsl pour le pavé ^^;
CrazyCat a écrit :La prochaine fois, essaye d'imaginer que j'ai un cerveau ...
Répondre Avertir


Messages dans ce sujet
[Pas de titre] - par CrazyCat - 15/11/2006, 11:28
[Pas de titre] - par BdS - 15/11/2006, 14:15
[Pas de titre] - par kephren14 - 16/11/2006, 00:55
[Pas de titre] - par BdS - 16/11/2006, 01:10
[Pas de titre] - par kephren14 - 16/11/2006, 16:00
[Pas de titre] - par CrazyCat - 16/11/2006, 19:02
[Pas de titre] - par kephren14 - 16/11/2006, 23:28
[Pas de titre] - par kephren14 - 20/11/2006, 15:42

Atteindre :


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