BETS Status v1.0

By ^WeSt on Apr 13, 2012

This snippet has been created for a user, also you can use it by your self!

Loading commands:

/set %bet_chan #chan
/auser 40 NICK

; ####### CODED ON 13/04/2012 19:25   #######
; #######      BET STATUS - v1.0      #######
; ####### CREATED BY ^WeSt (westor)   #######
; ####### --------------------------- #######
; ####### BUGS ON (westor7@gmail.com)  #######

ON 40:TEXT:*:?: { 
  if ($1 == !bethelp) { .msg $nick [ $+ $nick $+ ]: All BET commands are: !addbet <bet> - !delbet <num> - !delallbets - !dellallmybets - !mybets . }
  if ($1 == !addbet) {
    if (!$2-) { .msg $nick [4Error]: Not enouph parameters, Please try again and insert the BET details for addition! (e.g:  $+ $1 test) - 4FAILED | halt }
    set %bet_nicks $addtok(%bet_nicks,$nick,44)
    inc %bet_ [ $+ [ $nick ] ] $+ _total
    var %tmp =  $+ $rand(1,5) $+ , $+ $rand(6,15) $+ $chr(35) $+ %bet_ [ $+ [ $nick ] $+ ] _total $2- $+ 
    set %bet_ [ $+ [ $nick ] ] $+ _ $+ %bet_ [ $+ [ $nick ] $+ ] _total %tmp
    .msg $nick [ $+ $nick $+ ]: Your BET has been added. - 3SUCCESSFULLY
  }
  if ($1 == !delbet) {
    if (!$2-) { .msg $nick [4Error]: Not enouph parameters, Please try again and insert the BET details for deletion! (e.g:  $+ $1 test) - 4FAILED | halt }
    if ($2 !isnum) { .msg $nick [4Error]: Incorrect parameters, Please try again and insert ONLY numbers! (e.g:  $+ $1 1) - 4FAILED | halt }
    if (!%bet_ [ $+ [ $nick ] $+ ] _total) { .msg $nick [4Error]: Cannot proceed, You have NOT any BET(s) added since now. - 4FAILED | halt }
    var %z = %bet_ [ $+ [ $nick ] $+ ] _ [ $+ [ $2 ] ]
    if (!%z) { .msg $nick [4Error]: Cannot find, The #10 $+ $2 $+  BET number is NOT exist into the database! - 4FAILED | halt }
    if (%bet_ [ $+ [ $nick ] ] $+ _total == $null) { unset %bet_ [ $+ [ $nick ] $+ ] _total }
    elseif (%bet_ [ $+ [ $nick ] ] $+ _total !== $null) {
      set %bet_nicks $remtok(%bet_nicks,$nick,44)
      unset %bet_ [ $+ [ $nick ] ] $+ _ [ $+ [ $2 ] ]
      dec %bet_ [ $+ [ $nick ] ] $+ _total
      .msg $nick [ $+ $nick $+ ]: Your BET # $+ $2 $+  has been deleted. - 3SUCCESSFULLY
    }
  }
  if ($1 == !delallmybets) {
    if (!%bet_ [ $+ [ $nick ] $+ ] _total) { .msg $nick [4Error]: Cannot proceed, You have NOT any BET(s) added since now. - 4FAILED | halt }
    set %bet_nicks $remtok(%bet_nicks,$nick,44)
    var %t = %bet_ [ $+ [ $nick ] $+ ] _total
    unset %bet_ [ $+ [ $nick ] $+ ] _total
    unset %bet_ [ $+ [ $nick ] $+ ] _*
    .msg $nick [ $+ $nick $+ ]: All of your BET(s) has been deleted. TOTAL: 10 $+ %t $+  - 3SUCCESSFULLY
  }
  if ($1 == !delallbets) { delallbets }
  if ($1 == !mybets) || ($1 == !listmybets) { listmybets $nick }
}

alias -l delallbets {
  if (!%bet_nicks) { .msg $nick [4Error]: Cannot proceed, The BET(s) database is empty since now. - 4FAILED | halt }
  var %t = $numtok(%bet_nicks,44)
  var %i = 1
  while (%i <= %t) {
    var %ii = %i
    var %n = $gettok(%bet_nicks,%i,44)
    unset %bet_ [ $+ [ %n ] $+ ] _*
    ; set %bet_nicks $remtok(%bet_nicks,%i,44)
    ; echo are: %n - %bet_nicks - %i
    inc %i
  }
  if (%ii == %t) { .msg $nick [ $+ $nick $+ ]: All user(s) BET(s) have been deleted, - TOTAL NICKS: 10 $+  %t $+  - 3SUCCESSFULLY | unset %bet_nicks | halt }
  inc %i
}

alias -l listmybets {
  if (!%bet_ [ $+ [ $nick ] $+ ] _total) { .msg $1 [4Error]: Cannot proceed, You have NOT any BET(s) added since now. - 4FAILED | halt }
  var %t = %bet_ [ $+ [ $nick ] $+ ] _total
  var %i = 1
  while (%i <= %t) {
    .msg $1 [ $+ $nick $+ ]: %bet_ [ $+ [ $nick ] $+ ] _ [ $+ [ %i ] ]
    if (%i == %t) { .msg $1 [ $+ $nick $+ ]: List BET(s) has been finished. - TOTAL BETS: 10 $+ %t $+  - 3SUCCESSFULLY }
    inc %i
  }
  inc %i
}

alias -l viewbets {
  if (!%bet_ [ $+ [ $1 ] $+ ] _total) { .msg $chan [4Error]: Cannot proceed, You have NOT any BET(s) added since now. - 4FAILED | halt }
  var %t = %bet_ [ $+ [ $1 ] $+ ] _total
  var %i = 1
  while (%i <= %t) {
    .msg $chan [ $+ $1 $+ ]: %bet_ [ $+ [ $1 ] $+ ] _ [ $+ [ %i ] ]
    if (%i == %t) { .msg $chan [ $+ $1 $+ ]: List BET(s) has been finished. - TOTAL BETS: 10 $+ %t $+  - 3SUCCESSFULLY }
    inc %i
  }
  inc %i
}

alias -l allbets {
  if (!%bet_nicks) { .msg $chan [4Error]: Cannot proceed, The BET(s) database is empty since now. - 4FAILED | halt }
  var %nick = $nick
  var %i = 1
  var %total = $numtok(%bet_nicks,44)
  while (%i <= %total) {
    var %ii = %i
    var %n = $gettok(%bet_nicks,%i,44)
    var %t = %bet_ [ $+ [ %n ] $+ ] _total
    var %z = 1
    while (%z <= %t) { 
      .msg $chan [ $+ %n $+ ]: %bet_ [ $+ [ %n ] $+ ] _ [ $+ [ %z ] ]
      if (%z == %t) { .msg $chan [ $+ %n $+ ]: List BET(s) has been finished. - TOTAL BETS: 10 $+ %t $+  - 3SUCCESSFULLY }
      inc %z
    }
    inc %i
  }
  if (%ii == %total) { .msg $chan [ $+ %nick $+ ]: All the BET(s) nickname list has been finished. - TOTAL NICKS: 10 $+ $numtok(%bet_nicks,44) $+  - 3SUCCESSFULLY | halt }
  inc %i
}

ON *:TEXT:*:%bet_chan: {
  if ($me !isop %bet_chan) { .msg $chan [4Error]: Cannot proceed, The bot is NOT an channel operator (@) into the 7 $+ %bet_chan $+  channel! - 4FAILED | halt }
  if ($1 == !bethelp) { .msg $chan [ $+ $nick $+ ]: All channel BET commands are: !mybets - !bets - !viewbets <nickname> . }
  if ($1 == !mybets) { listmybets $chan }
  if ($1 == !viewbets) || ($1 == !viewbet) {
    if ($2 == $nick) { .msg $chan [Error]: Incorerct target, You cannot use this command to your self, try use the !mybets command! - 4FAILED | halt }
    if (!$2) { .msg $chan [4Error]: Not enouph parameters, Please try again and enter the nickname to view the BETS! (e.g:  $+ $1 $nick $+ ) - 4FAILED | halt }
    if (!%bet_ [ $+ [ $2 ] $+ ] _total) { .msg $chan [4Error]: Cannot find, The 12 $+ $2 $+  nickname has NOT any BET since now added. | halt }
    viewbets $2
  }
  if ($1 == !bets) || ($1 == !allbets) { allbets }
}

Comments

Sign in to comment.
Drarqua   -  Apr 13, 2012

What this script does ? Pm me in greek if you want ;)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.