on *:text:cutwire*:#:{
if (%_timebomb == $nick $chan $scid($cid).server) {
if ($2 !isin %_timebomb_pick) return
if ($2 == %_timebomb_wire) {
msg $chan $nick cut the %_timebomb_wire wire. This has defused the bomb!
}
else {
if ($me isop $chan) kick $chan $nick snip...*BOOM!*
else msg $chan snip...*BOOM!* Type timebomb to start a new round
}
unset %_timebomb*
.timerbomb off
}
}
on *:text:timebomb*:#: {
if ((!$2) || ((!$nick($2,$chan)) && ($nick !isin %timebomb_admins))) tokenize 32 timebomb $nick
if (%timebomb_chan != $chan $scid($cid).server) { msg $chan I don't have a single bomb to spare. :-( | return }
if (%_timebomb) { describe $chan points at the bulge in the back of $gettok(%_timebomb,1,32) $+ 's pants. | return }
if ($nick isin %timebomb_admins) {
var %_timebomb_return = $_timebomb_plant($chan, $2, $nick, $scid($cid).server)
if ($2 != $nick) notice $nick $nick initiated timebomb for $2 in channel $chan on $scid($cid).server (Winning colour: %_timebomb_return $+ )
}
elseif ($2 != $nick) return
else _timebomb_plant $chan $nick $nick $scid($cid).server
}
alias _timebomb_setenv {
.timerbomb off
unset %_timebomb*
unset %timebomb*
set %timebomb_color Red Orange Yellow Green Blue Indigo Violet Black White Grey Brown Pink Mauve Beige Aquamarine Chartreuse Bisque Crimson Fuchsia Gold Ivory Khaki Lavender Lime Magenta Maroon Navy Olive Plum Silver Tan Teal Turquoise
set %timebomb_chan $$chan $$scid($cid).server
set %timebomb_maxr 60
set %timebomb_minw 1
set %timebomb_maxw 12
echo -atc info2 * Enviroment set successfully (Timebomb channel: $chan on $scid($cid).server $+ )
}
alias _timebomb_engcount { return $replace($1,10,ten,11,eleven,12,twelve,1,one,2,two,3,three,4,four,5,five,6,six,7,seven,8,eight,9,nine) }
alias _timebomb_englist { var %x, %y = 1
while (%y < $gettok($1-,0,32)) {
%x = %x $gettok($1-,%y,32) $+ ,
inc %y
}
return %x and $gettok($1-,%y,32))
}
alias _timebomb_explode {
if (($me isop $1) && ($1)) kick $1 $2 *BOOM!*
if (($me !isop $1) || (!$1)) msg $1 *BOOM!* Type timebomb to start a new round
.timerbomb off
unset %_timebomb*
}
alias _timebomb_plant {
unset %_timebomb*
.timerbomb off
var %_timebomb_twire = 1
while (%_timebomb_twire <= $rand(%timebomb_minw,%timebomb_maxw)) {
var %y $gettok(%timebomb_color,$rand(1,$gettok(%timebomb_color,0,32)),32)
if ((%y !isin %_timebomb_pick) && (%timebomb_minw <= $gettok(%timebomb_color,0,32))) {
set %_timebomb_pick %_timebomb_pick %y
inc %_timebomb_twire
}
}
var %_timebomb_countdown = $rand(%timebomb_minr,%timebomb_maxr)
describe $1 stuffs the bomb into $2 $+ 's pants. The display reads [ $+ %_timebomb_countdown $+ ] seconds.
if ($gettok(%_timebomb_pick,0,32) == 1) msg $1 Diffuse the bomb by cutting the correct wire. There is one wire. It is %_timebomb_pick $+ .
elseif ($gettok(%_timebomb_pick,0,32) <= 12) msg $1 Diffuse the bomb by cutting the correct wire. There are $_timebomb_engcount($gettok(%_timebomb_pick,0,32)) wires. They are $_timebomb_englist(%_timebomb_pick) $+ .
else msg $1 Diffuse the bomb by cutting the correct wire. There are $gettok(%_timebomb_pick,0,32) wires. They are $_timebomb_englist(%_timebomb_pick) $+ .
set %_timebomb_wire $gettok(%_timebomb_pick,$rand(1,$gettok(%_timebomb_pick,0,32)),32)
.timerbomb 1 %_timebomb_countdown _timebomb_explode $1 $2
set %_timebomb $2 $1 $iif($4,$4,$scid($cid).server)
echo -atc info2 * $3 initiated timebomb for $2 in channel $1 on $4 (Winning colour: %_timebomb_wire $+ )
return %_timebomb_wire
}