Funny Quotes System

By StaticX__ on Aug 18, 2008

I've been working on a funny-quotes system the last days and I managed to create it..
Firstly, from var %masters = master1 master2 you change master1 master2 to the system masters. You can add as many masters as you want.
Example: var %masters = nick george john
You open a dcc chat with the bot and you can type the following commands:

[b].addr (Adds a funny quote in the bot) - Syntax: .addr
.delr (Deletes a funny quote) - Syntax: .delr
.listr (Lists all funny quotes)
.clrr (Clears funny quotes)
[/b]
You can add a funny quote every 10 seconds.
Have fun.

on *:CHAT:*:{
  var %masters = master1 master2
  if ($1 == .addr) && ( $istok(%masters,$nick,32) ) {
    if ($3 != $null) {
      if (!%funnyquotesfloodpro) { set %funnyquotesfloodpro off }
      if (%funnyquotesfloodpro == on) { msg = $+ $nick Funny Quotes flood protection is on. Please wait to be off. | halt } 
      if ( $read(funnyquotes.txt, $2-) != $null ) { msg = $+ $nick The Funny Quote You Entered Already Exists. | halt }
      if (%funnyquotesfloodpro == off) {  
        set %funnyquotes.id [[ $+ $rand(1,6553555) $+ ]
        /inc %added.funnyquotes
        /write funnyquotes.txt %funnyquotes.id - < $+ $2 $+ > $3-
        /msg = $+ $nick Funny Quote Added. ID: %funnyquotes.id  
        /set -u10 %funnyquotesfloodpro on
        .timer 1 10.5 /set %funnyquotesfloodpro off
      }
    }
    else { msg = $+ $nick Wrong Syntax - .addr nick funny-quote }
  }
  if ($1 == .delr) && ( $istok(%masters,$nick,32) ) {
    if ($2 != $null) {
      var %i = 1
      var %finding = $2
      while (%i <= %added.funnyquotes) {
        if (%finding == $remove($gettok($read(funnyquotes.txt,%i),1,32),[,])) {
          /msg = $+ $nick Funny Quote Deleted. `ID: $gettok($read(funnyquotes.txt,%i),1,32)
          /write -dl $+ %i funnyquotes.txt
          /dec %added.funnyquotes
        }
        inc %i
      }
    }
  }
  if ($1 == .listr) {
    var %x = 1
    while (%x <= %added.funnyquotes) {
      /msg = $+ $nick Funny Quote ID: $read(funnyquotes.txt, %x)
      /inc %x
    }
    if (%added.funnyquotes == 0) { msg = $+ $nick There are no funny quotes in the system. | halt }
  }
  if ($1 == .clrr) && ( $istok(%masters,$nick,32) ) {
    if ($exists(funnyquotes.txt) == $true) { 
      write -c funnyquotes.txt
      msg = $+ $nick Funny Quotes are cleared
      set %added.funnyquotes 0
    }
  }
}

Comments

Sign in to comment.
Soulkeeper   -  Aug 21, 2008

Not perfect, but it does what it needs to. 4/10

 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.