Originally Posted By: Riamus2
Code:
on *:text:!dd *:#yourchannel: {
  ; You can remove the first two IF lines if you don't care about checking if the nicks are on the channel.
  if ($2 !ison $chan) { msg $chan $2 is not a valid nick. | halt }
  if ($3 !ison $chan) { msg $chan $3 is not a valid nick. | halt }
  if (!$4) { msg $chan Invalid format.  Use: !dd nick1 nick2 reward | halt }
  set %dd $2 $3 $4
  msg $chan Dice duel between $2 and $3 has begun.
  .timerDD 1 300 EndDD
}
on *:text:!roll:#yourchannel: {
  if (!%dd) { msg $chan No duel in progress. | halt }
  if (!$istok(%dd,$nick,32)) { msg $chan You are not one of the duelists. | halt }
  if ($($+(%,ddr.,$nick),2)) { msg $chan You have already rolled. | halt }
  var %r = $rand(1,6), %d1 = $gettok(%dd,1,32), %d2 = $gettok(%dd,2,32), %p = $gettok(%dd,3,32)
  set %ddr. $+ $nick %r
  msg $chan $nick rolled a %r $+ .
  var %r1 = $($+(%,ddr.,$gettok(%dd,1,32)),2), %r2 = $($+(%,ddr.,$gettok(%dd,2,32)),2)
  if (%r1 && %r2) {
    if (%r1 > %r2) { msg $chan %d1 won the %p pot with a %r1 $+ - $+ %r2 $+ . }
    elseif (%r2 > %r1) { msg $chan %d2 won the %p pot with a %r2 $+ - $+ %r1 $+ . }
    else { msg $chan %d1 and %d2 tied with a %r1 $+ - $+ %r2 $+ . }
    unset %dd
    unset %ddr.*
    .timerDD off
  }
}
alias EndDD {
  msg $chan The duel ran out of time and has been ended.
  unset %dd
  unset %ddr.*
}


Ok, this should do what you asked. It will also automatically end the duel after 5 minutes (300 seconds) in case one person never rolls. If you want to adjust that time, change the 300 in the timer to something else.

what will happen when they tie? can you do it so they have to re roll? and can you make it avaible for multiple duels? and Halfop+? i might pay you for this if you want. i really need this.

Last edited by gamblebills; 09/12/11 04:17 PM.