Simple Soccer Game
Platform: mIRC
Published May 04, 2006
Updated May 04, 2006
Put the script in your remotes tab then type /set %soccerchan (channels you want it to work in) if you want more than one, type #soccer,#mirc,#etc
Use !soccer to begin the game, !play to start playing, !kick to kick the ball, !goal to go for a goal, !endgame to finish and !scores to view the current scores.
on *:TEXT:!soccer:%soccerchan:{
if (%soccer != on) {
msg $chan $nick has started the soccer game.
set %soccer on
}
elseif (%soccer == on) {
msg $chan There is a game in progress $nick $+ .
}
}
on *:TEXT:!play:%soccerchan:{
if ((%soccer == on) && (%playing != on)) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan $nick kicks the soccer ball to %soccerisin
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
set %playing on
}
}
on *:TEXT:!kick:%soccerchan:{
if ($nick == %soccerisin) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan $nick kicks the soccer ball to %soccerisin
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
elseif ($nick != %soccerisin) {
notice $nick You don't have the ball!! Sshh
}
}
on *:TEXT:!goal:%soccerchan:{
if ($nick == %soccerisin) {
if (%distance >= 40) {
inc %cpu 1
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
elseif ((%distance <= 40) && (%distance >= 10)) {
set %rands $rand(1,10)
if (%rands == 10) {
msg $chan The ball is in!!
inc %players 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%rands != 4) {
inc %cpu 1
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
}
elseif (%distance <= 10) {
set %rands $rand(1,5)
if (%rands == 5) {
msg $chan The ball is in!!!
inc %players 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%rands != 5) {
inc %cpu 1
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
}
elseif (%distance <= 5) {
set %rands $rand(1,2)
if (%rands == 2) {
msg $chan The ball is in!!!
inc %players 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%rands != 2) {
inc %cpu 1
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
}
}
}
on *:TEXT:!scores:%soccerchan:{
if (%soccer == on) {
msg $chan The scores are: CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%soccer != on) {
msg $chan No game is in progress.
}
}
on *:TEXT:!steal:%soccerchan:{
if ((%soccerisin != $null) && (%soccerisin != $nick) && (%steal != on)) {
set %rand $rand(1,5)
set %steal on
timer9 1 30 { set %steal off }
if (%rand == 5) {
msg $chan The ball is stolen from %soccerisin by $nick $+ !!
set %soccerisin $nick
}
elseif (%rand != 5) {
msg $chan The attempt to steal from %soccerisin failed.
}
}
}
on *:TEXT:!endgame:%soccerchan:{
if (%soccer == on) {
msg $chan Soccer is now over.
if (%cpu >= %players) {
msg $chan The winner was13 CPU, too bad, better luck next time.
}
elseif (%players >= %cpu) {
msg $chan The winner was13 Players, you won!!
msg $chan Congratulations!!
}
set %soccer off
set %soccer2 off
set %soccerisin .
set %cpu 0
set %players 0
set %playing off
}
}
on *:JOIN:%soccerchan:{
msg $nick Soccer is enabled in this channel, type !soccercommands to learn more.
}
on *:TEXT:!soccercommands:%soccerchan:{
msg $nick Type !soccer to begin, !play to start the game, !kick to kick the ball once you get it;
msg $nick !scores shows the current scores
msg $nick !goal to try for a goal, once your in 40m of the goal.
msg $nick Everytime you try for a goal, and miss, the CPU team gets a point.
msg $nick !endgame ends the game.
msg $nick !steal lets you steal the ball from another player.
msg $nick Soccer is much more fun with more than one player ;)
if (%soccer == on) {
msg $nick There is a game on at the moment.
}
elseif (%soccer != on) {
msg $nick There is no game on at the moment.
}
msg $nick Thankyou for playing HamSoccer BETA v1
}
on *:PART:%soccerchan:{
if (%soccer == on) && ($nick($chan,0) == 1) {
msg $chan Soccer is now over.
if (%cpu >= %players) {
msg $chan The winner was 13 CPU, too bad, better luck next time.
}
elseif (%players >= %cpu) {
msg $chan The winner was 13 Players, you won!!
msg $chan Congratulations!!
}
set %soccer off
set %soccer2 off
set %soccerisin .
set %cpu 0
set %players 0
set %playing off
}
}