This should work:

Code:
on *:text:!5050:[color:red]#yourchan[/color]: {
  [color:green]; Create the table for scores and set it to load/save automatically so no data loss will occur.[/color]
  if ($hget(Game) == $null) {
    hmake Game 50
    hload Game 5050.txt
    .timerGame -o 0 10 hsave Game 5050.txt
  }
  [color:green]; Check the random number 1 or 2.  If it's a 1, devoice or devoice/kick them.[/color]
  if ($rand(1,2) == 1) {
    [color:green]; Count the number of devoices and add them to the hash table.[/color]
    hadd Game $+($nick,.devoices) $calc($hget(Game,$+($nick,.devoices)) + 1)
    [color:green]; If the number of devoices is divisible by 5, kick the person.[/color]
    if ($calc($hget(Game,$+($nick,.devoices)) % 5) == 0 && $me isop $chan) {
      kick $chan $nick You have lost the 50/50 and suffer a kick.
    }
    [color:green]; If the number of devoices isn't divisible by 5, just devoice the person for 30 seconds.[/color]
    else {
      msg You have lost the 50/50.
      if ($me isop $chan) {
        mode $chan -v $nick
        .timer $+ $+($nick,.devoice) 1 30 mode $chan +v $nick
      }
    }
  }
  [color:green]; If the random number is 2, give points.[/color]
  else {
    [color:green]; Add points to the hash table.[/color]
    hadd Game $+($nick,.points) $calc($hget(Game,$+($nick,.points)) + 1)
    msg $chan You have won the 50/50 and received 1 point for a total of $hget(Game,$+($nick,.points)) points.
  }
}

[color:green]; Allow viewing scores with !won (to see your own) or !won nick (to see a nick's points).[/color]
on *:text:!won*:[color:red]#yourchan[/color]: {
  if ($2 != $null) {
    if ($hget(Game,$+($2,.points)) != $null) {
      msg $chan $2 has won $hget(Game,$+($2,.points)) points in the 50/50.
    }
    else {
      msg $chan $2 has not won any points in the 50/50.
    }
  }
  else {
    if ($hget(Game,$+($nick,.points)) != $null) {
      msg $chan You have won $hget(Game,$+($nick,.points)) points in the 50/50.
    }
    else {
      msg $chan You have not won any points in the 50/50.
    }
  }
}


Note that after the person is kicked, they won't automatically be voiced when joining the channel again. You will need to include that if you don't already voice users when they join the channel. Also, note that a person devoiced could rejoin and be voiced again in less time. We could do some to avoid that if you want... just ask if it's important. And, remember that your channel needs to be +m to prevent users from talking when not voiced or this isn't much use.

Also, the bot/person running the script needs to be an op for this to work for the voice/devoice.

Personally, I think the ban way was nicer. It makes using !5050 more of a challenge. Users need to weigh the risks of getting banned. smile


Invision Support
#Invision on irc.irchighway.net