Im using ozh's addme script http://www.egghelp.org/cgi-bin/tcl_arch ... oad&id=823 and i pretty much love how it works except for one thing. The game community is used to random teams. Could someone fix this so it randomly picks 8 people (without repeating the people)
proc addme_2leaders {chan} {
# Internal proc (no output printed) selecting 2 leaders from topic list, if supposed to do so
global addme_list
global addme_leaders
global addme_pick2players
if {$addme_pick2players($chan) == 0} {
set addme_leaders($chan) " "
return 2leaders:no_leader_picking
}
set nicklist [split $addme_list($chan) "/"]
set pif1 [rand [llength $nicklist]]
set pif2 [rand [llength $nicklist]]
set pif3 [rand [llength $nicklist]]
set pif4 [rand [llength $nicklist]]
set pif5 [rand [llength $nicklist]]
set pif6 [rand [llength $nicklist]]
set pif7 [rand [llength $nicklist]]
set pif8 [rand [llength $nicklist]]
while {$pif1 == $pif8} {set pif8 [rand [llength $nicklist]]}
set leader1 [lindex $nicklist $pif1]
set leader2 [lindex $nicklist $pif2]
set leader3 [lindex $nicklist $pif3]
set leader4 [lindex $nicklist $pif4]
set leader5 [lindex $nicklist $pif5]
set leader6 [lindex $nicklist $pif6]
set leader7 [lindex $nicklist $pif7]
set leader7 [lindex $nicklist $pif8]
set addme_leaders($chan) "(Human: $leader1 $leader2 $leader3 $leader4 Infected: $leader5 $leader6 $leader7 $leader8)"
}
Unfortunately that dont work as the scripts picks the same name more than once instead of using all 8 names it generates in the topic. If someone could give me a fix i would love you for life. Thank you very much in advance.
proc addme_2leaders {chan} {
# Internal proc (no output printed) selecting 2 leaders from topic list, if supposed to do so
global addme_list
global addme_leaders
global addme_pick2players
if {$addme_pick2players($chan) == 0} {
set addme_leaders($chan) " "
return 2leaders:no_leader_picking
}
set ::add_nicklist [split $addme_list($chan) "/"]
set leader1 [giveAnick $::add_nicklist]
set leader2 [giveAnick $::add_nicklist]
set leader3 [giveAnick $::add_nicklist]
set leader4 [giveAnick $::add_nicklist]
set leader5 [giveAnick $::add_nicklist]
set leader6 [giveAnick $::add_nicklist]
set leader7 [giveAnick $::add_nicklist]
set leader8 [giveAnick $::add_nicklist]
set addme_leaders($chan) "(Human: $leader1 $leader2 $leader3 $leader4 Infected: $leader5 $leader6 $leader7 $leader8)"
}
############################################
# add this proc somewhere in the script
# this will randomly pick a nickname, and remove it from
# the list so two nicknames can never be the same
proc giveAnick {nicks} {
set name [lindex $nicks [set nick [rand [llength $nicks]]]]
set ::add_nicklist [lreplace $nicks $nick $nick]
return $name
}