Bar Script v0.5

By Dramakus on Jul 12, 2008

Here is a quick bar script I made. I know its sloppy feel free to clean it up. I just made this on a whim when some1 started handing out pretend beers in the channel.

Theres still a few more functions I want to add in I will post them later when they are finished.

No credit is necessary feel free to change it however u want.

on *:text:*:#: {
  if ($1 == !ld) {
    if (%ld == off || %ld == $null) {
      if ($nick isop $chan) {
        set %ld on
        msg $chan The bar is on lock down till further notice.
        halt
      }
    }
    if (%ld == on) {
      if ($nick isop $chan) {
        set %ld off
        msg $chan The bar is off lock down.
        halt
      }
    }
  }
  if ($1 == !bar) {
    if (%ld == on) {
      /notice $nick We're sorry the bar script is currently on lock down please contact an op to get it off lock down.
      halt
    }
    else {
      if ($2 == open) {
        if ($readini(bar.ini, owner, is) == closed || $readini(bar.ini, owner, is) == $null) {
          writeini bar.ini owner is $nick
          /msg $chan $nick has opened the bar and is now taking orders.
        }
        else {
          /notice $nick $readini(bar.ini, owner, is) has already opened the bar please wait untill he has finished.
        }
      }
      elseif ($2 == close) {
        if ($nick == $readini(bar.ini, owner, is) || $nick isop $chan) {
          writeini bar.ini owner is closed
          /msg $chan $nick has closed the bar.
        }
        if ($readini(bar.ini, owner, is) == $null) {
          /notice $nick The bar isn't currently opened.  If you wish to open the bar please type in main chat !bar open .
        }
      }
      else {
        /notice $nick Usage:  !bar open, !bar close
      }
    }
  }
  if ($1 == !order) {
    if (%ld == on) {
      /notice $nick We're sorry the bar script is currently on lock down please contact an op to get it off lock down.
    }
    else {
      if ($2 == drink) {
        if ($nick == $readini(bar.ini, owner, is)) {
          if ($readini(bar.ini, $readini(bar.ini, owner, is), drinks) >= 1 || $readini(bar.ini, $readini(bar.ini, owner, is), drinks) == $null) {
            msg $chan Pours a $3 for theirself.
            writeini bar.ini $nick drinks 4
            writeini bar.ini $nick drink $3
          }
          elseif ($readini(bar.ini, $readini(bar.ini, owner, is), drinks) == 0) {
            /notice $readini(bar.ini, owner, is) Your mug is empty.  Order a new drink.
          }
        }
        elseif ($nick != $readini(bar.ini, owner, is)) {
          if ($readini(bar.ini, $nick, drinks) >= 1 || $readini(bar.ini, $nick, drinks) == $null) {
            writeini bar.ini $nick drink $3
            /msg $chan $readini(bar.ini, owner, is) pours $nick a $readini(bar.ini, $nick, drink) $+ .
            if ($readini(bar.ini, $nick, first) == $null) {
              writeini bar.ini $nick first no
              writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) + 60)
              writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) - 1)
              writeini bar.ini $readini(bar.ini, owner, is) cash $calc($readini(bar.ini, $readini(bar.ini, owner, is), cash) + 1)
              msg $chan Here is your $3 that will be $char(24) $+ 1 please.
              /notice $nick You have $char(24) $+ $readini(bar.ini, $nick, cash) left.
              writeini bar.ini $nick drinks 4
            }
            else {
              writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) - 1)
              msg $chan Here is your $3 that will be $chr(36) $+ 1 please.
              /notice $nick You have $chr(36) $+ $readini(bar.ini, $nick, cash) left.
              writeini bar.ini $nick drinks 4
            }
          }
          elseif ($readini(bar.ini, $nick, drinks) == 0) {
            /notice $nick Your mug is empty.  Order a new drink.
          }
        }
      }
      if ($2 == food) {
        if ($3 == pretzels || $3 == peanuts) {
          /msg $chan $readini(bar.ini, owner, is) takes out a basket of $3 $+ .
        }
        if ($3 == pizza) {
          if ($4 == $null) {
            if ($readini(bar.ini, $nick, pizza) <= 0 || $readini(bar.ini, $nick, pizza) == $null) {
              writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) - 5)
              msg $chan Here is your $3 that will be $chr(36) $+ 5 please.
              /notice $nick You have $chr(36) $+ $readini(bar.ini, $nick, cash) left.
              writeini bar.ini $nick pizza 8
            }
            else {
              if ($readini(bar.ini, $nick, pizza) > 1) {
                notice $nick You still have $readini(bar.ini, $nick, pizza) slices left.
              }
              else {
                notice $nick You still have a slice left.
              }
            }
          }
          if ($4 == slice) {
            writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) - 1)
            msg $chan Here is your $3 $4 that will be $chr(36) $+ 1 please.
            /notice $nick You have $chr(36) $+ $readini(bar.ini, $nick, cash) left.
            writeini bar.ini $nick pizza 1          
          }
        }
      }
      if ($2 == $null) {
        /notice $nick Usage:  !order drink RollingRock, !order food Nachos
      }
    }
  }
  if ($1 == !drink) {
    if (%ld == on) {
      /notice $nick We're sorry the bar script is currently on lock down please contact an op to get it off lock down.
      halt
    }
    else {
      if ($readini(bar.ini, $nick, drinks) == 0) {
        /notice $nick Your mug is empty.  Order a new drink.
        halt
      }
      if ($readini(bar.ini, $nick, drinks) == $null) {
        /notice $nick Your mug is empty.  Order a new drink.
        halt
      }
      else {
        /notice $nick You take a drink of your $readini(bar.ini, $nick, drink) $+ .
        writeini bar.ini $nick drinks $calc($readini(bar.ini, $nick, drinks) - 1)
        /notice $nick You have $readini(bar.ini, $nick, drinks) drinks left.
      }
    }
  }
  if ($1 == !eat) {
    if (%ld == on) {
      /notice $nick We're sorry the bar script is currently on lock down please contact an op to get it off lock down.
      halt
    }
    else {
      if ($2 == pizza) {
        if ($readini(bar.ini, $nick, pizza) <= 0) {
          /notice $nick You are out of pizza.
          halt
        }
        if ($readini(bar.ini, $nick, pizza) == $null) {
          /notice $nick You are out of pizza.
          halt
        }
        else {
          /notice $nick You eat a slice of your pizza.
          writeini bar.ini $nick pizza $calc($readini(bar.ini, $nick, pizza) - 1)
          /notice $nick You have $readini(bar.ini, $nick, pizza) slices left.
        }
      }
      if ($2 == $null) {
        msg $chan $nick eats their full of pretzels and peanuts.
      }
    }
  }
  if ($1 == !cash) {
    if (%ld == on) {
      /notice $nick We're sorry the bar script is currently on lock down please contact an op to get it off lock down.
      halt
    }
    else {
      if ($readini(bar.ini, $nick, cash) == $null) {
        writeini bar.ini $nick first no
        writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) + 60)
        /notice $nick You have $chr(36) $+ $readini(bar.ini, $nick, cash) left.
      }
      else {
        /notice $nick You have $chr(36) $+ $readini(bar.ini, $nick, cash) left.
      }
    }
  }
  if ($1 == !drinksonme) {
    if (%ld == on) {
      /notice $nick We're sorry the bar script is currently on lock down please contact an op to get it off lock down.
      halt
    }
    else {
      if ($readini(bar.ini, $nick, cash <= $nick($chan,0)) {
        writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) -  $nick($chan,0) + 1)
        msg $chan $nick has bought a drink for everyone.
        notice $nick You have $chr(36) $+ $readini(bar.ini, $nick, cash) left.

        %i = 0
        :nextnick
        inc %i
        if (%i <= $nick($chan,0)) {
          writeini bar.ini $nick($chan, %i) cash $calc($readini(bar.ini, $nick($chan, %i), cash) + 1)
          goto nextnick
        }
      }
      else {
        notice $nick You don't have enough cash to buy drinks for everyone.
      }
    }
  }
  if ($1 == !onhouse) {
    if (%ld == on) {
      /notice $nick We're sorry the bar script is currently on lock down please contact an op to get it off lock down.
      halt
    }
    else {
      if ($nick == $readini(bar.ini, owner, is)) {
        msg $chan $nick says a round on the house!

        %i = 0
        :nextnick
        inc %i
        if (%i <= $nick($chan,0)) {
          writeini bar.ini $nick($chan, %i) cash $calc($readini(bar.ini, $nick($chan, %i), cash) + 1)
          writeini bar.ini $nick cash $calc($readini(bar.ini, $nick, cash) - 1)
          goto nextnick
        }
      }
      else {
        notice $nick You aren't the bar keep!
      }
    }
  }
}

Comments

Sign in to comment.
Jamiie   -  Jul 13, 2008

Maybe use /auser that way only certain people can open the bar instead of everyone being able to.

 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.