TestMax.dk Paster
  • Forside
  • Print
  • Bookmark
  • Kontakt
  • SiteMap


infobox infobox
 

Cup bot til 2on2/5on5

08-02-2009 19:25:55
 
 
Muligheder (Anmeld)
Skrevet af Saint
Kliks 778
Kategori mIRC scripting release
Så kommer jeg sQ lige med mit første release.
Havde lige lyst til at lave en cupbot til cs med lidt ekstra features som den gode gamle 2tm mangler.

den har både .unwin til at rette en vinderhold der er tilføjet ved en fejl, og så har admins mulighed for at kunne starte et cup uden at alle slots er fulde ved at fylde den op med Walk Over hold.

På .show viser botten brackets + hvem der har vundet og tabt og en online kontaktpersons fra de enkelte hold.

Der er indbygget sikkerhed der gør at samme bruger ikke kan tilføjes mere end et hold samt man kan tilføje nicks som ikke må addes (fishbot,wowbot,Q,S,osv)
Dette gøres ved at skrive nicks ind i badnicks.txt inde i Cup folderen i dit mIRC dir. Hver nick på hver linie

HUSK! at bruge:
/set %cupchan #dinchannel
på botten når du starter den og giv den op
.commands giver kommandoerne

Spørgsmål og fejl rapporter kan rettes til Saint på Qnet

God fornøjelse

PS:
Den opmærksomme scripter vil se at IAL update scriptet ikke er mit eget.
Og 100% korrekt, det er det heller ikke, så det tager jeg ikke credit for.
Husker faktisk ikke hvis det er men måske wiebe? :)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: SCRIPT ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::

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|.sh ow|.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:.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 The maps are: %Cup.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: %Cup.maps %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 add {
var %x = 1
while (%x <= $numtok($2-,32)) {
write Cup\teams\ $+ $1 $+ .txt $gettok($2-,%x,32) $address($gettok($2-,%x,32),1)
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
.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 (!%antispammeren2) {
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 -u300 %antispammeren2 1
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 = $iif($read(Cup\next.txt,w,$read(Cup\current.txt,%y)),9Win0,$iif($read(Cup\next,w,$read(Cup\current .txt,$calc(%y + 1))),4Lose0,14In Play0))
var %match2 = $iif(%match1 == 9Win0,4Lose0,$iif(%match1 == 4Lose0,9Win0,14In Play0))
.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
}
}
}
}

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
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
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
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
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:.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
.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
}
}
}

::::::::::::::::::::::::::::::::::::::::::::
:: IAL UPDATE ::
::::::::::::::::::::::::::::::::::::::::::::
alias -l max.who {
return 500
}

alias -l delay.who {
return 60
}

alias -l repeat.who {
return 30
}

on *:join:#: {
if (!$.timer($+($cid,.ial-update.update))) {
.timer $+ $cid $+ .ial-update.update 1 $$delay.who ial-update.update
}
}

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
}
}

 
infobox infobox


infobox infobox
 
#1Drax(Anmeld) 08-02-2009 21:38:01
 
 
Hep hey Saint :-)

Rigtigt fedt release!, bliver spændende at se hvor meget go der bliver på det, og folk kommer og benytter det.

Men ville være kanon hvis du lige opdaterede tråden med flg.
- [code] felter omkring koden, læs i nedenstående info box.
- Evt. lidt flere kommentarer per function, også selvom det splitter koden.
- Zip koden i en mrc fil eller der du har det gemt og vedhæft til tråden, sådan folk hurtigt kan hente scriptet, fremfor at de skal kopiere det.

Men udover de par små ting, så rigtigt GJ herfra!
Administrator - TestMax.dk Stifter/Udvikler

Drax's signatur billede
 
infobox infobox

infobox infobox
 
#2Grandjean(Anmeld) 09-02-2009 01:34:37
 
 
Super godt release Saint, fedt script og kan sige at dette script rykker :P
Keep up the good work magnus :=)

EDIT!
Så fandt jeg den første fejl.

09-02 01:55:49 <@Grandjean> .add YouRFaT hej
09-02 01:55:49 Notice from AltMuligBot: Your team was added.
09-02 01:55:56 <@Grandjean> .teams
09-02 01:55:56 <@AltMuligBot> Teams assigned are [0 of 4] Teams are: None
Tjaa, måske Testmax.dk Hjælper? :D
 
infobox infobox

infobox infobox
 
#3Saint(Anmeld) 09-02-2009 17:36:08
 
 
Jah! Beklager for denne bug.

Det var bare mig der selv manuelt oprettede både Cup og Teams mappen da jeg kodede den så glemte alt om at tilføje en 'mkdir'
Det er hermed rettet og alt burde køre.

HF

PS
Drax ønsker ikke at zippe for folk der ikke selv gider have scriptet skal også kunne se det og kommentere :)
Er det dog for træls at have det liggende sådan her skal jeg da nok gøre det.

Funktionerne siger mere eller mindre sig selv og derudover er der både en .commands fucktions og fejlmeddelser på alle commands skulle de skrives med forkert syntax
Er behovet dog stort for at jeg skal skrive lidt mere forklaring til det hele kan jeg da tage mig tid til det også :)
 
infobox infobox

infobox infobox
 
#4Grandjean(Anmeld) 09-02-2009 18:25:40
 
 
Så fandt jeg en fejl mere :P

Jeg havde startet en 2on2 cup, skrev status og fik dette som respons..
09-02 18:23:29 <@Grandjean> .status
09-02 18:23:29 <@AltMuligBot> 7,1::0,1 Cup is 9ON0 with 4 slots available. Your admin is: Grandjean. 7,1::0,1
09-02 18:23:29 <@AltMuligBot> 7,1::0,1 Use: .add <Player> <Player> <Player> <Player> <Team> , to add your team. 7,1::

EDIT:
Endnu en fejl..

havde added med 2 hold, skrev derefter .fill og så .show så fik jeg denne respons i botten.
-
* /if: 'd(Cup\next,w,$read(Cup\current.txt,$calc(%y' unknown operator
-
Tjaa, måske Testmax.dk Hjælper? :D
 
infobox infobox

infobox infobox
 
#5Saint(Anmeld) 09-02-2009 18:46:31
 
 
Tak for det Grandjean :)

RETTET
'$calc(%cup.mod - 1)' i stedet for '4' i $str(<Player> $+ $chr(160),4) selvfølgelig.

Det gamle script var nemlig kun 5on5 :)


EDIT!
Det er fordi den vil fejle hvis du ikke fylder et eneste rigtigt team i, men prøver på at bruge .fill fra start af.. sætter lige en blocker ind i .fill
 
infobox infobox

Påmindelse ved nyt svar

Ved at tilmelde dig automatisk påmindelse, modtager du en email så snart denne tråd bliver besvaret, dog sender vi kun en mail til dig, også selvom der er kommet flere svar, simpelthen for at spare dig for spam i din indbakke.


infobox infobox
  Svar på tråden  
   
 
 
infobox infobox

infobox infobox
  Læs dette før du sender dit indlæg!  
 
Ved tryk på send knappen accepterer du vores regelsæt som kan læses her
Praktiske informationer
Type Eksempel Resultat
Fed [b]din tekst[/b] din tekst
Kursiv [k]din tekst[/k] din tekst
Understreg [u]din tekst[/u] din tekst
Kode felt [code]din tekst[/code]
din tekst
infobox infobox