Her kommer mit cup script lige en gang til.. samme features som sidst:
- Hver spiller kan kun være på ET hold
- Alle spillerne skal være på channel ved tilmelding
- Spillernes $mask bliver gemt så de kan findes selv om de skifter nick
- .unwin hvis et hold skal fjernes igen som vinder
- .fill hvis man kun kan få 14 ud af 16 hold tilmeldt bliver cuppet startet med kun de 14 hold + 2 Walk Over teams
- Kontakt person for hvert hold står i brackets, Lys blå hvis personen er på channel, mørk hvis han er partet.
- Win/Lose/In Game status på hver kamp under brackets.
- Mulighed for at tilføje badnicks (fishbot,Q,S,wowbot) til cup\badnicks.txt så de ikke kan tilmeldes cup
Det nye ved botten:
- Er man AUTH'd ved tilmelding bliver der registreret points til ens auth ved Cup start
- Commands .top5 og .rank
- En del bug fixes men dem vil der sikkert være flere af :)
Skriver lige igen:
- Husk at /set %cupchan #DINCHAN
- Og nej IAL scriptet er ikke mit egetda wiebes(?) virker optimalt
alias -l max.who {
return 500
}
alias -l delay.who {
return 60
}
alias -l repeat.who {
return 30
}
on *:part:%cupchan: {
if ($nick == $me) {
if ($nick == $me && $chan == %cupchan) {
.timerconnect off
unset %auth.*
}
}
else {
unset %auth. [ $+ [ $nick ] ]
}
}
on *:join:%cupchan: {
if ($nick == $me) {
if (!$.timer($+($cid,.ial-update.update))) {
.timer $+ $cid $+ .ial-update.update 1 $$delay.who ial-update.update
}
if ($nick == $me && $chan == %cupchan) {
.timerconnect off
who $chan n%nar
}
}
else {
who $nick n%nar
}
}
on *:NICK: {
if ($newnick ison %noremovechan) {
unset %auth. [ $+ [ $nick ] ]
.who $newnick n%na
}
}
raw 354:*: {
/haltdef
if ($3 != 0) {
/set %auth. [ $+ [ $2 ] ] $3
}
}
on *:load:{ scon -am1 .timer $!+ $!cid $!+ .ial-update.update 1 $$delay.who ial-update.update }
alias ial-update.update {
var %c, %n
if ($ial) {
if (!$hget($+(ial-update.,$cid))) { var %c = $ial-update.chan($max.who,400)
if (%c) { ial-update.hash %c | .quote WHO %c }
else { var %n = $ial-update.nick($max.who,400)
if (%n) { ial-update.hash %n | .quote WHO %n }
}
}
if (%c) || (%n) || ($hget($+(ial-update.,$cid))) { .timer $+ $cid $+ .ial-update.update 1 $$repeat.who ial-update.update }
}
}
alias -l ial-update.sort {
var %x = 1, %c
while (%x <= $comchan($me,0)) {
if ($chan($comchan($me,%x)).ial == $false) { var %c = $addtok(%c,$+($nick($comchan($me,%x),0),.,%x),32) }
inc %x
}
return $sorttok(%c,32,n)
}
alias -l ial-update.max {
var %x = 1, %t = 0, %c = $ial-update.sort, %w
while (%x <= $numtok(%c,32)) && (%t < $1) { inc %t $gettok($gettok(%c,%x,32),1,46)
if (%t > $1) { break }
var %w = $addtok(%w,$gettok($gettok(%c,%x,32),2,46),32)
inc %x
}
return %w
}
alias -l ial-update.chan {
var %x = 1, %l = 0, %c = $ial-update.max($1), %w
while (%x <= $numtok(%c,32)) && (%l < $2) { inc %l $len(%chan)
if (%l > $2) { break }
var %w = $addtok(%w,$comchan($me,$gettok(%c,%x,32)),44)
inc %x
}
return %w
}
alias -l ial-update.nick {
var %x = 1
while ($chan($comchan($me,%x)).ial != $false) && (%x <= $comchan($me,0)) { inc %x }
if ($chan($comchan($me,%x)).ial == $false) { var %y = 1, %t = 0, %l = 0, %w
while (%t <= $1) && (%l < $2) && (%y <= $nick($comchan($me,%x),0)) {
if (!$ial($nick($comchan($me,%x),%y))) { inc %l $len($nick($comchan($me,%x),%y))
if (%l > $2) { break }
var %w = $addtok(%w,$nick($comchan($me,%x),%y),44)
}
inc %y
}
return %w
}
}
alias -l ial-update.hash {
if ($2 == $null) { var %x = $numtok($1,44)
while (%x) { hadd -m $+(ial-update.,$cid) $gettok($1,%x,44) 1 | dec %x }
hadd -m $+(ial-update.,$cid) -mask $1
}
elseif ($2 == -remove) { var %x = $numtok($1,44)
while (%x) { if ($hget($+(ial-update.,$cid))) { hdel $+(ial-update.,$cid) $gettok($1,%x,44) } | dec %x }
hdel $+(ial-update.,$cid) -mask
if ($hget($+(ial-update.,$cid),0).item == 0) && ($hget($+(ial-update.,$cid))) { hfree $+(ial-update.,$cid) }
}
}
raw 352:& & & & & & & & *: {
if ($hget($+(ial-update.,$cid),$2)) || ($hget($+(ial-update.,$cid),$6)) {
if ($hget($+(ial-update.,$cid),$2)) && ($comchan($6,0)) { var %x = $comchan($6,0)
while (%x) { var %c = $comchan($6,%x)
if ($hget($+(ial-update.,$cid),%c)) {
if (* isin $7) { hinc $+(ial-update.,$cid) $+(%c,$chr(44),oper) }
if (G isincs $7) { hinc $+(ial-update.,$cid) $+(%c,$chr(44),away) }
if (d isincs $7) { hinc $+(ial-update.,$cid) $+(%c,$chr(44),deaf) }
if (x isincs $7) { hinc $+(ial-update.,$cid) $+(%c,$chr(44),xhost) }
}
dec %x
}
}
haltdef
}
}
raw 315:& & end of /WHO list.: {
if ($hget($+(ial-update.,$cid),-mask) == $2) { var %x = $numtok($2,44)
while (%x) { if ($me ison $gettok($2,%x,44)) { var %c = $gettok($2,%x,44)
var %oper = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),oper)),$ifmatch,0)
var %oper = %oper / $round($calc(%oper / $nick(%c,0) * 100),1) $+ % opers
var %away = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),away)),$ifmatch,0)
var %away = %away / $round($calc(%away / $nick(%c,0) * 100),1) $+ % away
var %deaf = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),deaf)),$ifmatch,0)
var %deaf = %deaf / $round($calc(%deaf / $nick(%c,0) * 100),1) $+ % deaf
var %xhost = $iif($hget($+(ial-update.,$cid),$+(%c,$chr(44),xhost)),$ifmatch,0)
var %xhost = %xhost / $round($calc(%xhost / $nick(%c,0) * 100),1) $+ % xhost
echo -t $gettok($2,%x,44) * IAL updated ( $+ %oper ---- %away ---- %deaf ---- %xhost $+ )
}
hdel $+(ial-update.,$cid) $+(%c,$chr(44),oper) | hdel $+(ial-update.,$cid) $+(%c,$chr(44),away)
hdel $+(ial-update.,$cid) $+(%c,$chr(44),deaf) | hdel $+(ial-update.,$cid) $+(%c,$chr(44),xhost)
dec %x
}
ial-update.hash $2 -remove
haltdef
}
}
on *:disconnect:{
if ($hget($+(ial-update.,$cid))) {
hfree $+(ial-update.,$cid)
}
}
on *:TEXT:.commands:%cupchan: {
if (!%antispammeren) {
if ($nick isop %cupchan) {
.cnotice $nick %cupchan %ctstart COMMANDS: .start|.stop|.fill|.win|.unwin|.setmap|.setslots|.setprize|.setadmin|. add|.remove|.status|.teams|.show|.whois|.prize|.maps %ctstop
}
else {
.cnotice $nick %cupchan %ctstart COMMANDS: .add|.remove|.status|.teams|.show|.whois|.prize|.maps %ctstop
}
set -u5 %antispammeren 1
}
}
on *:TEXT:.start*:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
set -u5 %antispammeren 1
if (%Cup.start == 1) {
.cnotice $nick %cupchan %ctstart ERROR! A Cup is already running, use .stop to end it. %ctstop
}
elseif (!$2 || !$3) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .start <SLOTS> <xonx> <PRIZE> %ctstop
}
elseif (!$istok(4 8 16 32 64,$2,32)) {
.cnotice $nick %cupchan %ctstart ERROR! Only 4 - 8 - 16 - 32 - 64 slots are supported! %ctstop
}
else {
set %ctstart 7,1::0,1
set %ctstop 7,1::0,1
mkdir $mircdir $+ Cup
mkdir $mircdir $+ Cup\teams
set %Cup.start 1
set %Cup.slots $2
set %Cup.mod $left($3,1)
set %Cup.prize $4-
set %Cup.admin $nick
set %Cup.round 0
.msg %cupchan %ctstart Cup is 9ON0 with %Cup.slots slots available. Your admin is: %Cup.admin $+ . %ctstop
.msg %cupchan %ctstart Use: .add $str(<Player> $+ $chr(160),$calc(%cup.mod - 1)) $+ <Team> , to add your team. %ctstop
}
}
}
on *:TEXT:.rank:%cupchan: {
if (!%antispammeren) {
set -u3 %antispammeren
if (!%auth. [ $+ [ $nick ] ]) {
.cnotice $nick $chan %ctstart You are not AUTH'd. AUTH and /hop on %cupchan %ctstop
}
elseif (!$read(cup\rank.txt,w,%auth. [ $+ [ $nick ] ] *)) {
.cnotice $nick $chan %ctstart You are not added to the ranking list. Remember to be AUTH'd when adding your team %ctstop
}
else {
.cnotice $nick $chan %ctstart You are rank $readn of $lines(cup\rank.txt) with ' $+ $gettok($read(cup\rank.txt,w,%auth. [ $+ [ $nick ] ] *),2,32) $+ ' points. %ctstop
}
}
}
on *:TEXT:.award*:%cupchan: {
if ($nick isop %cupchan) {
if ($left($2,1) == $chr(35) && $istok(- +,$left($3,1),32)) {
award $right($2,-1) $3
.msg $chan %ctstart points updated for $2 %ctstop
}
else {
if ($2 ison $chan && %auth. [ $+ [ $2 ] ]) {
award %auth. [ $+ [ $2 ] ] $3
.msg $chan %ctstart points updated for $2 %ctstop
}
else {
.msg $chan %ctstart Cant award $2 %ctstop
}
}
}
}
on *:TEXT:.stop:%cupchan: {
if ($nick isop %cupchan) {
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
else {
unset %Cup.*
.remove Cup\current.txt
.remove Cup\next.txt
.remove Cup\players.txt
var %x = $findfile($mircdir\Cup\Teams,*.txt,0)
while (%x >= 0) {
.remove $findfile($mircdir\Cup\Teams,*.txt,%x)
dec %x
}
.msg %cupchan %ctstart $nick stopped the Cup. %ctstop
}
}
}
on *:TEXT:.status:%cupchan: {
if (!%antispammeren) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif ($lines(Cup\current.txt) == %Cup.slots) {
.msg %cupchan %ctstart You cannot add a team - all slots are full. Currently in round %Cup.round $+ . With $calc(%Cup.slots / 2 - %Cup.nextround) $iif($calc(%Cup.slots / 2 - %Cup.nextround) > 1,matches,match) left. %ctstop
}
else {
.msg %cupchan %ctstart Cup is 9ON0 with %Cup.slots slots available. Your admin is: %Cup.admin $+ . %ctstop
.msg %cupchan %ctstart Use: .add $str(<Player> $+ $chr(160),$calc(%cup.mod - 1)) $+ <Team> , to add your team. %ctstop
}
}
}
alias randomfile {
var %i = 1
while (%i <= $lines($1)) {
write -il $+ $rand(1,$lines(Cup\randfile.txt)) Cup\randfile.txt $read($1, %i)
inc %i
}
.remove $1
.rename Cup\randfile.txt $1
}
on *:TEXT:.teams:%cupchan: {
if (!%antispammeren) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif ($lines(Cup\current.txt) < 1) {
.msg %cupchan %ctstart Teams assigned are $chr(91) $+ $lines(Cup\current.txt) of %Cup.slots $+ $chr(93) Teams are: None %ctstop
}
else {
var %x = 1
while (%x <= $lines(Cup\current.txt)) {
var %teams = $addtok(%teams,$read(Cup\current.txt,%x) -,32)
inc %x
}
.msg %cupchan %ctstart Teams assigned are $chr(91) $+ $lines(Cup\current.txt) of %Cup.slots $+ $chr(93) Teams are: $left(%teams $+ $str($chr(160) $+ X -,$calc(%Cup.slots - $numtok($remove(%teams,-),32))),-2) %ctstop
}
}
}
on *:TEXT:.whois*:%cupchan: {
if (!%antispammeren) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .whois <TEAM-NAME> %ctstop
}
elseif ($lines(Cup\current.txt) < 1) {
.msg %cupchan %ctstart No teams added at the moment. %ctstop
}
elseif (!$read(Cup\current.txt,w,$2)) {
.msg %cupchan %ctstart No team is added by that name. Check for spelling errors! %ctstop
}
else {
var %x = 1
while (%x <= $lines(Cup\teams\ $+ $2 $+ .txt)) {
var %team = $addtok(%team,$iif($ial($gettok($read(Cup\teams\ $+ $2 $+ .txt,%x),2,32),1),$ial($gettok($read(Cup\teams\ $+ $2 $+ .txt,%x),2,32),1).nick,$gettok($read(Cup\teams\ $+ $2 $+ .txt,%x),1,32)),32)
inc %x
}
.msg %cupchan %ctstart $read(Cup\current.txt,w,$2) is: %team %ctstop
}
}
}
on *:TEXT:.prize:%cupchan: {
if (!%antispammeren) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
else {
.msg %cupchan %ctstart The prize is: %Cup.prize %ctstop
}
}
}
on *:TEXT:.setprize*:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .setprize <PRIZE> %ctstop
}
else {
set %Cup.prize $2-
.msg %cupchan %ctstart The prize is: %Cup.prize %ctstop
}
}
}
on *:text:.setadmin*:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .setadmin <ADMIN(s)> %ctstop
}
else {
set %Cup.admin $2-
.msg %cupchan %ctstart Your admin(s): %Cup.admin %ctstop
}
}
}
on *:text:.setslots*:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .setslots <Nr> %ctstop
}
elseif ($2 !isnum) {
.cnotice $nick %cupchan %ctstart ERROR! Argument must be a number! Ex: .setslots 8
}
elseif (!$istok(4 8 16 32,$2,32)) {
.cnotice $nick %cupchan %ctstart ERROR! Only 4 - 8 - 16 - 32 slots are supported! %ctstop
}
elseif ($2 <= $lines(Cup\current.txt)) {
.cnotice $nick %cupchan %ctstart ERROR! Too many teams are added ( $+ $lines(Cup\current.txt) $+ ) %ctstop
}
else {
set %Cup.slots $2
.msg %cupchan %ctstart Slots are: %Cup.slots %ctstop
}
}
}
on *:TEXT:.setmaps*:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .setmaps <MAPS> %ctstop
}
else {
set %Cup.maps $2-
.msg %cupchan %ctstart $maps %ctstop
}
}
}
on *:TEXT:.maps:%cupchan: {
if (!%antispammeren) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
else {
.msg %cupchan %ctstart The maps are: $maps %ctstop
}
}
}
on *:TEXT:.rem*:%cupchan: {
if (!%antispammeren) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (!$2) {
.msg %cupchan %ctstart ERROR! use like this: .remove <TEAM> %ctstop
}
elseif ($lines(Cup\current.txt) >= %Cup.slots) {
.msg %cupchan %ctstart ERROR! The Cup has already startet and you can not remove your team %ctstop
}
elseif (!$read(cup\current.txt,w,$2)) {
.msg %cupchan %ctstart ERROR! $2 is not added %ctstop
}
elseif ($nick isop %cupchan) {
goto remove
}
elseif ($address($nick,1) != $gettok($read(cup\teams\ $+ $2 $+ .txt,1),2,32)) {
.msg %cupchan %ctstart ERROR! Only ' $+ $iif($ial($gettok($read(cup\teams\ $+ $2 $+ .txt,1),2,32),1),12 $+ $ial($gettok($read(cup\teams\ $+ $2 $+ .txt,1),2,32),1).nick $+ 0,02 $+ $gettok($read(cup\teams\ $+ $2 $+ .txt,1),1,32) $+ 00) $+ ' can remove $2 %ctstop
}
else {
:remove
var %x = 1
while (%x <= $lines(cup\teams\ $+ $2 $+ .txt)) {
var %rem = $read(cup\players.txt,w,$gettok($read(cup\teams\ $+ $2 $+ .txt,%x),2,32))
write -dl $+ $readn cup\players.txt
inc %x
}
.remove cup\teams\ $+ $2 $+ .txt
var %rem2 = $read(cup\current.txt,w,$2)
write -dl $+ $readn cup\current.txt
var %x = 1
while (%x <= $lines(Cup\current.txt)) {
var %teams = $addtok(%teams,$read(Cup\current.txt,%x) -,32)
inc %x
}
.msg %cupchan %ctstart Teams assigned are $chr(91) $+ $lines(Cup\current.txt) of %Cup.slots $+ $chr(93) Teams are: $left(%teams $+ $str($chr(160) $+ X -,$calc(%Cup.slots - $numtok($remove(%teams,-),32))),-2) %ctstop
}
}
}
on *:TEXT:.add*:%cupchan: {
if (!%antispammeren) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif ($lines(Cup\current.txt) >= %Cup.slots) {
.cnotice $nick %cupchan %ctstart ERROR! There are no slots left. %ctstop
}
elseif (!$2 || $numtok($1-,32) != $calc(%cup.mod + 1)) {
.cnotice $nick %cupchan %ctstart ERROR! use like this: .add $str(<Player> $+ $chr(160),$calc(%Cup.mod - 1)) $+ <TEAM> %ctstop
}
elseif ($read(Cup\teams\ $+ $2 $+ .txt,w,* $address($nick,1))) {
.cnotice $nick %cupchan %ctstart ERROR! Your team is already added. %ctstop
}
elseif ($read(Cup\players.txt,w,$address($nick,1))) {
.cnotice $nick %cupchan %ctstart ERROR! You are already added on a team! %ctstop
}
elseif ($read(Cup\current.txt,w,$numtok($1-,32))) {
.cnotice $nick %cupchan %ctstart ERROR! A team is added by that name already. %ctstop
}
elseif ($istok($2-,$me,32)) {
.cnotice $nick %cupchan %ctstart ERROR! You cannot add me %ctstop
}
else {
var %txt = $nick $gettok($1-,2- $+ $calc($numtok($1-,32) - 1),32)
var %x = 1
while (%x <= $calc($numtok(%txt,32) + 1)) {
if (%x == $calc($numtok(%txt,32) + 1)) {
if (!%noidle && !%baduser && !%dobbel) {
.cnotice $nick %cupchan %ctstart Your team was added. %ctstop
add $gettok($1-,$numtok($1-,32),32) %txt
}
else {
.cnotice $nick %cupchan %ctstart ERROR! Users not on %cupchan $+ : $iif(%noidle,%noidle,None) %ctmidt Users already on a team: $iif(%baduser,%baduser,None) %ctmidt Users repeated: $iif(%dobbel,%dobbel,None) %ctmidt Bad nicks: %badnicks %ctstop
}
break
}
if ($read(Cup\players.txt,w,$address($gettok(%txt,%x,32),1))) {
var %baduser = $addtok(%baduser,$gettok(%txt,%x,32),32)
}
if ($gettok(%txt,%x,32) !ison %cupchan) {
var %noidle = $addtok(%noidle,$gettok(%txt,%x,32),32)
}
if ($count(%txt,$gettok(%txt,%x,32)) > 1) {
var %dobbel = $addtok(%dobbel,$gettok(%txt,%x,32),32)
}
if ($read(Cup\badnicks.txt,w,$gettok(%txt,%x,32))) {
var %badnicks = $addtok(%badnicks,$gettok(%txt,%x,32),32)
}
inc %x
}
}
}
}
alias teamaward {
if ($istok(+ -,$left($2,1),32)) {
if ($read(cup\teams\ $+ $1 $+ .txt)) {
var %x = 1
while (%x <= $lines(cup\teams\ $+ $1 $+ .txt)) {
if ($gettok($read(cup\teams\ $+ $1 $+ .txt,%x),3,32)) {
award $gettok($read(cup\teams\ $+ $1 $+ .txt,%x),3,32) $2
}
inc %x
}
}
}
}
alias award {
if ($istok(+ -,$left($2,1),32)) {
if ($lines(cup\rank.txt < 1)) {
write cup\rank.txt $1 $right($2,-1)
}
elseif ($read(cup\rank.txt,w,$1 *)) {
var %oldnum = $gettok($read(cup\rank.txt,w,$1 *),2,32)
var %newnum = $right($2,-1)
write -dl $+ $readn cup\rank.txt
if ($calc(%oldnum $left($2,1) %newnum) < 1) {
write cup\rank.txt $1 0
}
else {
var %num = $calc(%oldnum $left($2,1) %newnum)
var %x = 1
while (%x <= $calc($lines(cup\rank.txt) + 1)) {
if (%x == $calc($lines(cup\rank.txt) + 1)) {
write cup\rank.txt $1 %num
break
}
if (%num >= $gettok($read(cup\rank.txt,%x),2,32)) {
write -il $+ %x cup\rank.txt $1 %num
break
}
else {
inc %x
}
}
}
}
else {
if ($left($2,1) == $chr(45)) {
var %num = 0
}
else {
var %num = $right($2,-1)
}
var %x = 1
while (%x <= $calc($lines(cup\rank.txt) + 1)) {
if (%x == $calc($lines(cup\rank.txt) + 1)) {
write cup\rank.txt $1 %num
break
}
if (%num >= $gettok($read(cup\rank.txt,%x),2,32)) {
write -il $+ %x cup\rank.txt $1 %num
break
}
else {
inc %x
}
}
}
}
}
alias add {
var %x = 1
while (%x <= $numtok($2-,32)) {
write Cup\teams\ $+ $1 $+ .txt $gettok($2-,%x,32) $address($gettok($2-,%x,32),1) $iif(%auth. [ $+ [ $gettok($2-,%x,32) ] ],%auth. [ $+ [ $gettok($2-,%x,32) ] ])
write Cup\players.txt $address($gettok($2-,%x,32),1)
inc %x
}
write Cup\current.txt $1
if ($lines(Cup\current.txt) >= %Cup.slots) {
inc %Cup.round
var %x = 1
while (%x <= $lines(cup\current.txt)) {
teamaward $read(cup\current.txt,%x) +1
inc %x
}
.msg %cupchan %ctstart The Cup is FULL and we are ready to begin! %ctstop
randomfile Cup\current.txt
show
}
else {
var %x = 1
while (%x <= $lines(Cup\current.txt)) {
var %teams = $addtok(%teams,$read(Cup\current.txt,%x) -,32)
inc %x
}
.msg %cupchan %ctstart Teams assigned are $chr(91) $+ $lines(Cup\current.txt) of %Cup.slots $+ $chr(93) Teams are: $left(%teams $+ $str($chr(160) $+ X -,$calc(%Cup.slots - $numtok($remove(%teams,-),32))),-2) %ctstop
}
}
on *:TEXT:.show:%cupchan: {
if (!%antispammeren) {
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
else {
show
}
}
}
alias user {
if (!$read(cup\teams\ $+ $1 $+ .txt,1)) {
return 5None0
}
else {
var %x = 1
while (%x <= $calc($lines(Cup\teams\ $+ $1 $+ .txt) + 1)) {
if (%x == $calc($lines(Cup\teams\ $+ $1 $+ .txt) + 1)) {
if (!%user) {
return 2 $+ $gettok($read(Cup\teams\ $+ $1 $+ .txt,1),1,32) $+ 0
}
else {
return 12 $+ %user $+ 0
}
}
else {
if ($ial($gettok($read(cup\teams\ $+ $1 $+ .txt,%x),2,32),1).nick ison %cupchan) {
if (!%user) {
var %user = $ial($gettok($read(cup\teams\ $+ $1 $+ .txt,%x),2,32),1).nick
}
}
}
inc %x
}
}
}
alias show {
if (%Cup.round == 0) {
var %x = 1
while (%x <= $lines(Cup\current.txt)) {
var %teams = $addtok(%teams,$read(Cup\current.txt,%x) -,32)
inc %x
}
.msg %cupchan %ctstart We are Currently in Round: %Cup.round %ctstop
.msg %cupchan %ctstart Teams assigned are $chr(91) $+ $lines(Cup\current.txt) of %Cup.slots $+ $chr(93) Teams are: $left(%teams $+ $str($chr(160) $+ X -,$calc(%Cup.slots - $numtok($remove(%teams,-),32))),-2) %ctstop
}
else {
set -u20 %antispammeren 1
var %x = 1
while (%x <= $lines(Cup\current.txt)) {
var %teams = $addtok(%teams,$read(Cup\current.txt,%x) -,32)
inc %x
}
.msg %cupchan %ctstart We are Currently in Round %Cup.round $+ . With $calc($lines(Cup\current.txt) / 2 - %Cup.nextround) $iif($calc($lines(Cup\current.txt) / 2 - %Cup.nextround) > 1,matches,match) left. %ctstop
.msg %cupchan %ctstart Teams assigned are $chr(91) $+ $lines(Cup\current.txt) of $lines(Cup\current.txt) $+ $chr(93) Teams are: $left(%teams $+ $str($chr(160) $+ X -,$calc($lines(Cup\current.txt) - $numtok($remove(%teams,-),32))),-2) %ctstop
var %y = 1
var %counter = 1
while (%y <= $calc($lines(Cup\current.txt) + 1)) {
if (%y == $calc($lines(Cup\current.txt) + 1)) {
break
}
else {
var %team1 = $read(Cup\current.txt,%y)
var %team2 = $read(Cup\current.txt,$calc(%y + 1))
var %contact1 = $user($read(Cup\current.txt,%y))
var %contact2 = $user($read(Cup\current.txt,$calc(%y + 1)))
var %match1 = $match(%y)
var %match2 = $match($calc(%y + 1))
.timer 1 $calc(2 * %counter) .msg %cupchan %ctstart $chr(91) $+ $chr(35) $+ %Cup.round $+ %counter $+ $chr(93) %team1 ( $+ %contact1 $+ ) ( $+ %match1 $+ ) vs %team2 ( $+ %contact2 $+ ) ( $+ %match2 $+ ) %ctstop
inc %counter
inc %y 2
}
}
}
}
alias match {
if (2 // $1) {
if ($read(cup\next.txt,w,$read(cup\current.txt,$1))) {
return 9Win0
}
else {
if ($read(cup\next.txt,w,$read(cup\current.txt,$calc($1 - 1)))) {
return 4Lose0
}
else {
return 14In Play0
}
}
}
else {
if ($read(cup\next.txt,w,$read(cup\current.txt,$1))) {
return 9Win0
}
else {
if ($read(cup\next.txt,w,$read(cup\current.txt,$calc($1 + 1)))) {
return 4Lose0
}
else {
return 14In Play0
}
}
}
}
on *:TEXT:.rem *:%cupchan: {
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
if (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .rem <TEAM> %ctstop
}
elseif (%Cup.round > 0) {
.cnotice $nick %cupchan %ctstart ERROR! The Cup has already startet. $2 can not be removed. %ctstop
}
elseif ($read(Cup\teams\ $+ $2 $+ .txt,w,$address($nick,1)) || $nick isop %cupchan) {
var %x = 1
while (%x <= $calc($lines(Cup\teams\ $+ $2 $+ .txt) + 1)) {
if (%x == $calc($lines(Cup\teams\ $+ $2 $+ .txt) + 1)) {
$read(Cup\current.txt,w,$2)
write -dl $+ $readn Cup\current.txt
.remove Cup\teams\ $+ $2 $+ .txt
.cnotice $nick %cupchan %ctstart Your team was deleted %ctstop
var %x = 1
while (%x <= $lines(Cup\current.txt)) {
var %teams = $addtok(%teams,$read(Cup\current.txt,%x) -,32)
inc %x
}
.msg %cupchan %ctstart Teams assigned are $chr(91) $+ $lines(Cup\current.txt) of %Cup.slots $+ $chr(93) Teams are: $left(%teams $+ $str($chr(160) $+ X -,$calc(%Cup.slots - $numtok($remove(%teams,-),32))),-2) %ctstop
break
}
$read(Cup\players.txt,w,$read(Cup\teams\ $+ $2 $+ .txt,%x))
write -dl $+ $readn Cup\players.txt
inc %x
}
}
else {
.cnotice $nick %cupchan %ctstart ERROR! That is not your team %ctstop
}
}
on *:TEXT:.win*:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
if (!%Cup.start) {
.msg %cupchan %ctstart There is no Cup running. %ctstop
.msg %cupchan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
if (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! Use like this: .win <TEAM> %ctstop
}
elseif (%Cup.round < 1) {
.cnotice $nick %cupchan %ctstart ERROR! The Cup has not startet yet. %ctstop
}
elseif (!$read(Cup\current.txt,w,$2)) {
.cnotice $nick %cupchan %ctstart ERROR! No team is added by that name. %ctstop
}
else {
$read(Cup\current.txt,w,$2)
set %kk $readn
if (2 // %kk) {
if ($read(Cup\next.txt,w,$2) || $read(Cup\next.txt,w,$read(Cup\current.txt,$calc(%kk - 1)))) {
.cnotice $nick %cupchan %ctstart ERROR! $2 is already noted as a $iif($read(Cup\next.txt,w,$2),winner,loser) %ctstop
}
else {
.msg %cupchan %ctstart $2 was noted as a 9Winner0 %ctstop
write Cup\next.txt $2
inc %Cup.nextround
if (%Cup.nextround == $calc($lines(Cup\current.txt) / 2)) {
if (%Cup.nextround == 1) {
.msg %cupchan %ctstart The Cup has ended and the winner is: $2 %ctstop
teamaward $2 +15
unset %Cup.*
.remove Cup\current.txt
.remove Cup\next.txt
.remove Cup\players.txt
var %x = $findfile($mircdir\Cup\Teams,*.txt,0)
while (%x >= 0) {
.remove $findfile($mircdir\Cup\Teams,*.txt,%x)
dec %x
}
}
else {
.msg %cupchan %ctstart Round %Cup.round has ended and a new will start %ctstop
inc %Cup.round
unset %Cup.nextround
.remove Cup\current.txt
.rename Cup\next.txt Cup\current.txt
var %x = 1
while (%x <= $lines(cup\current.txt)) {
teamaward $read(cup\current.txt,%x) +5
inc %x
}
show
}
}
}
}
else {
if ($read(Cup\next.txt,w,$2) || $read(Cup\next.txt,w,$read(Cup\current.txt,$calc(%kk + 1)))) {
.cnotice $nick %cupchan %ctstart ERROR! $2 is already noted as a $iif($read(Cup\next.txt,w,$2),winner,loser) %ctstop
}
else {
.msg %cupchan %ctstart $2 was noted as a 9Winner0 %ctstop
write Cup\next.txt $2
inc %Cup.nextround
if (%Cup.nextround == $calc($lines(Cup\current.txt) / 2)) {
if (%Cup.nextround == 1) {
.msg %cupchan %ctstart The Cup has ended and the winner is: $2 %ctstop
teamaward $2 +15
unset %Cup.*
.remove Cup\current.txt
.remove Cup\next.txt
.remove Cup\players.txt
var %x = $findfile($mircdir\Cup\Teams,*.txt,0)
while (%x >= 0) {
.remove $findfile($mircdir\Cup\Teams,*.txt,%x)
dec %x
}
}
else {
.msg %cupchan %ctstart Round %Cup.round has ended and a new will start %ctstop
inc %Cup.round
unset %Cup.nextround
.remove Cup\current.txt
.rename Cup\next.txt Cup\current.txt
var %x = 1
while (%x <= $lines(cup\current.txt)) {
teamaward $read(cup\current.txt,%x) +5
inc %x
}
show
}
}
}
}
}
}
}
on *:text:.unwin*:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg $chan %ctstart There is no Cup running. %ctstop
.msg $chan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (!$2) {
.cnotice $nick %cupchan %ctstart ERROR! use like this: .unwin <TEAM> %ctstop
}
elseif (!$read(Cup\current.txt,w,$2)) {
.cnotice $nick %cupchan %ctstart ERROR! No team is added with that name. %ctstop
}
elseif (!$read(Cup\next.txt,w,$2)) {
.cnotice $nick %cupchan %ctstart ERROR! That team is not noted as a winner. %ctstop
}
else {
$read(Cup\next.txt,w,$2)
write -dl $+ $readn Cup\next.txt
.msg %cupchan %ctstart $2 was noted as a 14In Play0 %ctstop
dec %Cup.nextround
}
}
}
on *:TEXT:.top5:%cupchan: {
if (!%antispammeren) {
set -u10 %antispammeren 1
msg %cupchan %ctstart $str($chr(160),5) nick/#auth -- Points $str($chr(160),9) %ctstop
var %x = 1
var %limit = $iif($lines(cup\rank.txt) > 5,5,$lines(cup\rank.txt))
while (%x <= %limit) {
var %nick = $iif($auth($gettok($read(cup\rank.txt,%x),1,32)),$auth($gettok($read(cup\rank.txt,%x),1,32)),$chr(35 ) $+ $gettok($read(cup\rank.txt,%x),1,32))
var %points = $gettok($read(cup\rank.txt,%x),2,32)
.timer 1 %x .msg %cupchan %ctstart $str($chr(160),$calc(15 - $len(%nick))) %nick -- %points $str($chr(160),$calc(15 - $len(%points))) %ctstop
inc %x
}
}
}
alias auth {
var %x = 1
while (%x <= $var(%auth.*,0)) {
if ($var(%auth.*,%x).value == $1) {
return $right($var(%auth.*,%x),-6)
}
else {
inc %x
}
}
}
on *:text:.fill:%cupchan: {
if (!%antispammeren && $nick isop %cupchan) {
set -u5 %antispammeren 1
if (!%Cup.start) {
.msg $chan %ctstart There is no Cup running. %ctstop
.msg $chan %ctstart If you are a Cup admin use .start <SLOTS> <xonx> <PRIZE> , to start a Cup. %ctstop
}
elseif (%cup.round > 0) {
.cnotice $nick $chan %ctstart The Cup has started, .fill can not be used. %ctstop
}
elseif ($lines(cup\current.txt) < 1) {
.cnotice $nick $chan %ctstart No 'real' teams are added, .fill can not be used. %ctstop
}
else {
inc %Cup.round
var %x = 1
while (%x <= $lines(cup\current.txt)) {
teamaward $read(cup\current.txt,%x) +1
inc %x
}
.msg %cupchan %ctstart The Cup is FULL and we are ready to begin! %ctstop
randomfile Cup\current.txt
var %x = 1
var %y = $lines(Cup\current.txt)
while (%x <= $calc(%Cup.slots - %y)) {
write Cup\current.txt WO $+ %x $+ $rand(a,z) $+ $rand(a,z)
inc %x
}
show
}
}
}
on *:text:.cupchan*:%noremovechan: {
if ($owner($nick)) {
if (!$2) {
.cnotice $nick %noremovechan %ctstart ERROR! Use like this: .cupchan #channel %ctstop
}
if ($left($2,1) != $chr(35)) {
.cnotice $nick %noremovechan %ctstart ERROR! Argument must start with $chr(35) %ctstop
}
else {
set %cupchan $2
.cnotice $nick %noremovechan %ctstart Cupchan is now: $2 %ctstop
}
}
}
alias maps {
if (%cup.round == 0) {
var %x = 1
while (%x <= $numtok(%cup.maps,32)) {
var %cup.maps2 = $addtok(%cup.maps2,Round %x $+ : $gettok(%cup.maps,%x,32) -,32)
inc %x
}
return The Cup has not started - Maps are: $left(%cup.maps2,-2)
}
else {
return We are in Round %cup.round - Map is: $gettok(%cup.maps,%cup.round,32) $+
}
}