This is a cupbot Im working on. Its not finished however, I'm going to post it and just keep updating it. Put it in a bot and for the commands type !help and I apologize to anyone who feels this is sloppy coding. I would appreciate any suggestions on what else a cup bot is supposed to do. The prize doesnt really do anything yet, as I have no idea what it should do. Also, someone had requested a cupbot that allows you to add clans. I will not implement that since then it would need a whole seperate set of coding to keep track of clans, and another section to just get the max allowed people out of the clan to add to the team.
on *:Text:*:#channel: {
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; I will not be including error messages as I'm just simply to lazy to care that much. ;;;;;
;;;;; For help type !help. This is made to run on a bot. Not your client. ;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;starts cup;
if ( $1 == !startcup ) && ( $2 != $null ) && ( $3 != $null ) && ( %cup.running == $null ) {
.set %cup.running 1
.set %cup.teams $3
.set %cup.players $gettok($2,1,111)
msg $chan New Cup has been started! $+($(%cup.players,2),on,$(%cup.players,2)) Teams: $(%cup.teams,2)
}
;stops cup, cleans up vars/files;
if ( $1 == !stopcup ) && ( %cup.running != $null ) {
.unset %cup.*
.remove teams.ini
.remove rounds.ini
.remove rounds.txt
msg $chan Cup has Been Stopped.
}
;sets map and says which map is set.;
if ( $1 == !map ) {
if ( $2 != $null ) && ( $nick isop $chan ) && ( %cup.running != $null ) {
.set %cup.map $2
}
elseif ( $2 == $null ) && ( %cup.map != $null ) {
msg $chan Current map is $(%cup.map,2)
}
}
;sets prize and says which prize is set.;
if ( $1 == !prize ) {
if ( $2 != !null ) && ( %cup.running != $null ) && ( $nick isop $chan ) {
.set %cup.prize $2
}
elseif ( %cup.prize != $null ) {
msg $chan Prize for current cup is $(%cup.prize,2)
}
}
;adds players and builds rounds/ladder once all player slots are filled.;
if ( $1 == !add ) && ( $2 isnum $+(1-,$(%cup.teams,2)) ) && ( %cup.running != $null ) {
if ( $istok($(%cup.players.list,2),$nick,44) ) { halt }
if ( $numtok($readini(teams.ini,$2,players),44) < $(%cup.players,2) ) {
.writeini teams.ini $2 players $addtok($readini(teams.ini,$2,players),$nick,44)
.set %cup.players.list $addtok($(%cup.players.list,2),$nick,44)
msg $chan $nick added to team $2
}
inc %cup.current
if ( $(%cup.current,2) == $calc($(%cup.players,2) * $(%cup.teams,2)) ) {
msg $chan All the teams are filled and the game is ready to begin. Use !rounds to get players for each competition.
.set %cup.totalmet 1
.makeround
}
}
;lists teams;
if ( $1 == !team ) && ( $2 isnum $+(1-,$(%cup.teams,2)) ) && ( %cup.running != $null ) && ( $ini(teams.ini,0) != $null ) {
msg $chan $readini(teams.ini, $2, players)
}
;lists matches for current tier;
if ( $1 == !rounds ) && ( %cup.totalmet != $null ) {
.play $chan rounds.txt
}
;sets a winner for the specified round.;
if ( $1 == !lost ) && ( %cup.totalmet != $null ) && ( $2 isnum $+(1-,$ini(rounds.ini,0)) ) && ( $3 isnum ) {
remini teams.ini $3
inc %cup.rounds
if ( $ini(rounds.ini,0) > 1 ) {
if ( $(%cup.rounds,2) == $ini(rounds.ini,0) ) {
.inc %cup.tier
msg $chan Tier has been completed. Building Matchups for the next tier. Current Tier: $(%cup.tier,2)
.remove rounds.ini
.remove rounds.txt
makeround
.unset %cup.rounds
}
}
else {
msg $chan Cup is completed $readini(teams.ini,$ini(teams.ini,1),players) have one the cup.
}
}
;lists commands;
if ( $1 == !help ) {
notice $nick the commands are: * !startcup $+($chr(35),on,$chr(35)) rounds * !stopcup * !prize (prize) * !map (map) * !add $+(Team,$chr(35)) * !teams * !rounds * !lost team *
}
}
;alias used to build the rounds for each tier based on the teams in teams.ini.;
alias makeround {
var %x 1
var %z 1
.write rounds.txt Rounds Are as Follows
while ( %z <= $calc( $ini(teams.ini,0) / 2 ) ) {
.write rounds.txt Round $+($(%z,2),:) Team $ini(teams.ini,%x) vs Team $ini(teams.ini,$calc( %x +1 ))
.writeini rounds.ini %z $ini(teams.ini,%x) $readini(teams.ini,$ini(teams.ini,%x),players)
inc %x
.writeini rounds.ini %z $ini(teams.ini,%x) $readini(teams.ini,$ini(teams.ini,%x),players)
inc %x
inc %z
}
.write rounds.txt Rounds will be updated once the current Tier is completely won.
}
Can you make that you dont have to add team but you type !add and it adds yourself? Like 1x1 support.. and also for Melee or CSDM.. that when adds like 4 or 8 peoples you have to play CSDM (deathmatch) - everybody plays together - Free FOr all, its like Counter - Terrorists can kill Counter -Terrorirs and Terrorists, and Terrorists can kill Terrorists and Counter - Terrorists.. and then when mach is done you type !losers nick and nick (2 peoples go out)