Short but fun copy of my chance script. It bans no matter what but unbans after 25 seconds. Have fun :).
[01:03:06am] !choice
[01:03:06am] Weasand sets mode: +vho Cados Cados Cados
[01:03:09am] <&Weasand> I just feel like banning you though...
[01:03:11am] Cados was kicked by Weasand (Felt like it. :))
[01:03:12am] * Cados (~Dark@Fighting.For.Nothing) has joined #Wolverines
on *:TEXT:!choice:#:{
set %choice $rand(1,2)
if (%choice == 1) { ban -ku25 # $nick 2 You lose. :P }
if (%choice == 2) { mode # +vho $str($nick $chr(32),3) | .timer 1 3 msg $chan I just feel like banning you though... | .timer 1 5 ban -ku25 # $nick 2 You lose. :P }
}
You can actually use an else since there are only two chances. If one of them doesn't equal to 1, it has to be the 2nd chance:
on @*:text:$($strip(!choice)):#: {
var %choice = $rand(1,2)
if (%choice == 1) { ban -ku25 # $nick 2 You lose. :P }
else { mode # +vho $str($nick $chr(32),3) | .timerban1 1 3 .msg # I just feel like banning you though... | .timerban2 1 5 ban -ku25 # $nick 2 You lose. :P }
}
Here is my version:
on @*:text:$($strip(!choice)):#: {
if ($left($regsubex($1,/./,$r(1,2)),1) = 1) ban -ku26 # $nick 2 You lose. :P
else mode # +vho $str($nick $chr(32),3)) | .timerban1 1 3 .msg # I just $&
feel like banning you though... | .timerban2 1 5 ban -ku25 # $nick 2 You lose. :P
}
You should name your timers as napa suggested...in case there is another same timer conflicts with each other. @ prefix should be included next to the text event, making sure the client running the code is opped in channel before kicking and banning.
Note: maybe regsubex is totally unnecessary, but I use it for experimentation purposes.