mIRC Home    About    Download    Register    News    Help

Print Thread
My Quote script. need spam protect. #192804 11/01/08 01:03 AM
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
Code:

;--------------------------------------------------------------------------------------------------------:

;
; - !Quotescript...
;





on *:text:!quote*:*: {
  if ($level($address($nick,8)) == Quote.Ban) { return }
  else var %who = $nick
  if ($chan) {
    if (!$istok(#narkotika #paranormal #mensa #sirstargazer #quote #quotes #freethought #spiritual #4threich #normal #spirit! #asylum #‚ô• #astral #br1 #TheSpot #philosophy #philosophy! #Invision #ddayhome #shroomery #spiritualmaterialism #coders #TheTruth #immortal-technique #felles #tv.no #chemistry #filosofi #NanoTechnology #Śndelig #ganja #Le∑g∑ion! #innvikling #Truth #Gudene #shamanism #christian #innsikt #2012 #utvikling #sms.no #tao #rytmeboksen #dreamt #3d_life #archangels #spiritual #ascension #ugdulf #dreaming #spirituality #buddhism #shrooms #psychedelics #spiritual #narkotika #filosofisk #filosofi #Śndelighet,$chan,32)) { return }
    var %who = $chan
    if (%quote.delay) {
      .notice $nick Please try again after random delay of: $duration(%quote.delay) - Or use !"commands" in a PM.
      return
    }
    else {
      var %delay = $rand(5,25)
      set -u [ $+ [ %delay ] ] %quote.delay %delay
    }
  }
  if ($2) {
    if ($2 !isnum) {
      window -h @quote.search
      loadbuf -r @quote.search quotes.txt
      var %quote.temp $fline(@quote.search,$+(*,$2-,*),0)
      if (%quote.temp isnum 1-20) {
        var %i = 1,%quote.match
        while ($fline(@quote.search,$+(*,$2-,*),%i)) {
          %quote.match = $addtok(%quote.match,$v1,44)
          inc %i
        }
        msg $chan Matches for $2 --> %quote.match
        window -c @quote.search
      }
      elseif (%quote.temp == 0) { msg $chan No match found. }
      else { msg $chan More than 20 matches found, please narrow your search down }
    }
    else {
      if ($lines(quotes.txt) < $2) { msg %who Quote $chr(35) $+ $2 doesn't exist. | return }
      msg %who $read(quotes.txt,$2)
    }
  }
  elseif ($1 == !quotes) { msg %who Total quotes: $lines(quotes.txt) }
  else msg %who $read(quotes.txt)
}

on *:text:!addquote*:*: {
  if ($2 == $null) { .notice $nick You need to include a quote to add. }
  else write quotes.txt $2-
}

menu nicklist {
  !Quote Ban: auser Quote.Ban $address($snick($chan,1),8)
}

on *:input:*: {
  if ($1 == !quote) {
    var %who = $iif($chan,$chan,$me)
    if ($chan) {
      if (!$istok(#narkotika #paranormal #sirstargazer #‚ô• #freethought #quote #quotes #spiritual #mensa #asylum #4threich #spirit! #normal #astral #br1 #TheSpot #philosophy #philosophy! #Invision #ddayhome #shroomery #spiritualmaterialism #coders #TheTruth #felles #immortal-technique #felles #tv.no #chemistry #filosofi #NanoTechnology #Śndelig #ganja #Le∑g∑ion! #innvikling #Truth #Gudene #shamanism #christian #innsikt #2012 #utvikling #sms.no #tao #rytmeboksen #dreamt #3d_life #archangels #spiritual #ascension #ugdulf #dreaming #spirituality #buddhism #shrooms #psychedelics #spiritual #narkotika #filosofisk #filosofi #Śndelighet,$chan,32)) { return }
      if (%quote.delay) {
        echo -a Please try again after $duration(%quote.delay) or use !quote in a PM.
        return
      }
      else {
        var %delay = $rand(3,5)
        set -u [ $+ [ %delay ] ] %quote.delay %delay
      }
    }
    if ($2) {
      if ($2 !isnum) {
        window -h @quote.search
        loadbuf -r @quote.search quotes.txt
        var %quote.temp $fline(@quote.search,$+(*,$2-,*),0)
        if (%quote.temp isnum 1-20) {
          var %i = 1,%quote.match
          while ($fline(@quote.search,$+(*,$2-,*),%i)) {
            %quote.match = $addtok(%quote.match,$v1,44)
            inc %i
          }
          msg $chan Matches for $2 --> %quote.match
          window -c @quote.search
        }
        elseif (%quote.temp == 0) { msg $chan No match found. }
        else { msg $chan More than 20 matches found, please narrow your search down }
      }
      else {
        if ($lines(quotes.txt) < $2) { msg %who Quote $chr(35) $+ $2 doesn't exist. | return }
        msg %who $read(quotes.txt,$2)
      }
    }
    else msg %who $read(quotes.txt)
  }
  elseif ($1 == !quotes) { msg %who Total quotes: $lines(quotes.txt) }
  elseif ($1 == !addquote) {
    if ($2 == $null) { echo -a You need to include a quote to add. }
    else write quotes.txt $2-
  }
}


on *:text:!help:#: { 
  msg $nick Available commands: !quote, !quotes, !quote "number", and !addquote "quote" - Author. And: !quote "word" to search...
}
:----------------------------------





So, that is the script. Made by you nice people. And edited by me. It works perfectly.

But, recently some dude has started spamming me in the /msg with so many bot's and ident's, that I loos connection. I do not even know who it is, but it should be an easy fixs?

How would I make it so that one can get 1 quote, and then have to wait for 5 minutes for the next quote, with a message saying; "please wait 5 minutes for the next quote due to bandwidth" or something.. ..and then just like the ban function, have an 'allow' function, so that people I trust can use it as much as they like, with out no limit if I 'allow' them just like I can ban now.

The ban seems to work when I test it on my self, but this person might have found a loop hole.

Anywas, thank you for even reading this mess, I hope I managed to make sense. And I am very gratefull for any help/advice. smile


I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Re: My Quote script. need spam protect. [Re: gomp] #192853 11/01/08 07:47 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
You should create a flood protection in your addquote command.

For example:
Code:
on *:text:!addquote*:*: {
  if ($2 == $null) { .notice $nick You need to include a quote to add. }
  elseif (%addquote.flood.prot) { .notice $nick Please wait 5 minutes for the next quote due to bandwidth. }
  else { set -u300 %addquote.flood.prot | write quotes.txt $2- }
}


Edit: I see this doesn't do everything you want, with that 'allow' part. But at least you will stop that spammer.
Maybe someone else can help you expanding it for all your needs.

Re: My Quote script. need spam protect. [Re: OrionsBelt] #193319 18/01/08 06:58 AM
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
How would I use that?

Woke up to a spammed of net again..

It is the !quote and !quote text and !quote number they use..


I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.
Re: My Quote script. need spam protect. [Re: gomp] #193320 18/01/08 07:10 AM
Joined: Jun 2004
Posts: 243
G
gomp Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Jun 2004
Posts: 243
I got it working for the !addquote command:

Code:
on *:text:!addquote*:*: {
  if ($2 == $null) { .notice $nick You need to include a quote to add. }
  if (%quote.delay) {
    .notice $nick Please try again after random delay of: $duration(%quote.delay)
    return 
  }
  else {
    var %delay = $rand(5,25)
    set -u [ $+ [ %delay ] ] %quote.delay %delay
  }
  write quotes.txt $2-
}



But, the !quote cammnnd can still be used to spam.. Anyone see what I do wrong?

Here is the script as it is now:

Code:



;--------------------------------------------------------------------------------------------------------:

;
; - !Quotescript...
;





on *:text:!quote*:*: {

  if (%quote.delay) {
    .notice $nick Please try again after random delay of: $duration(%quote.delay)
    return 
  }
  else {
    var %delay = $rand(25,55)
    set -u [ $+ [ %delay ] ] %quote.delay %delay
  }

  if ($level($address($nick,8)) == Quote.Ban) { return }
  else var %who = $nick
  if ($chan) {
    if (!$istok(#narkotika #paranormal #mensa #sirstargazer #quote #quotes #freethought #spiritual #4threich #normal #spirit! #asylum #‚ô• #astral #br1 #TheSpot #philosophy #philosophy! #Invision #ddayhome #shroomery #spiritualmaterialism #coders #TheTruth #immortal-technique #felles #tv.no #chemistry #filosofi #NanoTechnology #Śndelig #ganja #Le∑g∑ion! #innvikling #Truth #Gudene #shamanism #christian #innsikt #2012 #utvikling #sms.no #tao #rytmeboksen #dreamt #3d_life #archangels #spiritual #ascension #ugdulf #dreaming #spirituality #buddhism #shrooms #psychedelics #spiritual #narkotika #filosofisk #filosofi #Śndelighet,$chan,32)) { return }
    var %who = $chan
    if (%quote.delay) {
      .notice $nick Please try again after random delay of: $duration(%quote.delay) - Or use !"commands" in a PM.
      return
    }
    else {
      var %delay = $rand(5,25)
      set -u [ $+ [ %delay ] ] %quote.delay %delay
    }
  }
  if ($2) {
    if ($2 !isnum) {
      window -h @quote.search
      loadbuf -r @quote.search quotes.txt
      var %quote.temp $fline(@quote.search,$+(*,$2-,*),0)
      if (%quote.temp isnum 1-20) {
        var %i = 1,%quote.match
        while ($fline(@quote.search,$+(*,$2-,*),%i)) {
          %quote.match = $addtok(%quote.match,$v1,44)
          inc %i
        }
        msg $chan Matches for $2 --> %quote.match
        window -c @quote.search
      }
      elseif (%quote.temp == 0) { msg $chan No match found. }
      else { msg $chan More than 20 matches found, please narrow your search down }
    }
    else {
      if ($lines(quotes.txt) < $2) { msg %who Quote $chr(35) $+ $2 doesn't exist. | return }
      msg %who $read(quotes.txt,$2)
    }
  }
  elseif ($1 == !quotes) { msg %who Total quotes: $lines(quotes.txt) }
  else msg %who $read(quotes.txt)
}

on *:text:!addquote*:*: {
  if ($2 == $null) { .notice $nick You need to include a quote to add. }
  if (%quote.delay) {
    .notice $nick Please try again after random delay of: $duration(%quote.delay)
    return 
  }
  else {
    var %delay = $rand(5,25)
    set -u [ $+ [ %delay ] ] %quote.delay %delay
  }
  write quotes.txt $2-
}

menu nicklist {
  !Quote Ban: auser Quote.Ban $address($snick($chan,1),8)
}

on *:input:*: {
  if ($1 == !quote) {
    var %who = $iif($chan,$chan,$me)
    if ($chan) {
      if (!$istok(#narkotika #paranormal #sirstargazer #‚ô• #freethought #quote #quotes #spiritual #mensa #asylum #4threich #spirit! #normal #astral #br1 #TheSpot #philosophy #philosophy! #Invision #ddayhome #shroomery #spiritualmaterialism #coders #TheTruth #felles #immortal-technique #felles #tv.no #chemistry #filosofi #NanoTechnology #Śndelig #ganja #Le∑g∑ion! #innvikling #Truth #Gudene #shamanism #christian #innsikt #2012 #utvikling #sms.no #tao #rytmeboksen #dreamt #3d_life #archangels #spiritual #ascension #ugdulf #dreaming #spirituality #buddhism #shrooms #psychedelics #spiritual #narkotika #filosofisk #filosofi #Śndelighet,$chan,32)) { return }
      if (%quote.delay) {
        echo -a Please try again after $duration(%quote.delay) or use !quote in a PM.
        return
      }
      else {
        var %delay = $rand(3,5)
        set -u [ $+ [ %delay ] ] %quote.delay %delay
      }
    }
    if ($2) {
      if ($2 !isnum) {
        window -h @quote.search
        loadbuf -r @quote.search quotes.txt
        var %quote.temp $fline(@quote.search,$+(*,$2-,*),0)
        if (%quote.temp isnum 1-20) {
          var %i = 1,%quote.match
          while ($fline(@quote.search,$+(*,$2-,*),%i)) {
            %quote.match = $addtok(%quote.match,$v1,44)
            inc %i
          }
          msg $chan Matches for $2 --> %quote.match
          window -c @quote.search
        }
        elseif (%quote.temp == 0) { msg $chan No match found. }
        else { msg $chan More than 20 matches found, please narrow your search down }
      }
      else {
        if ($lines(quotes.txt) < $2) { msg %who Quote $chr(35) $+ $2 doesn't exist. | return }
        msg %who $read(quotes.txt,$2)
      }
    }
    else msg %who $read(quotes.txt)
  }
  elseif ($1 == !quotes) { msg %who Total quotes: $lines(quotes.txt) }
  elseif ($1 == !addquote) {
    if ($2 == $null) { echo -a You need to include a quote to add. }
    else write quotes.txt $2-
  }
}


on *:text:!help:#: { 
  msg $nick Available commands: !quote, !quotes, !quote "number", and !addquote "quote" - Author. And: !quote "word" to search...
}
:-----------------





Seems I got it working, but I bet there is plenty uneeded code there now..

Seems I wish.. Now if just say it cannot be used.. What to do?

Last edited by gomp; 18/01/08 08:27 AM.

I do not speak English. I speak Norwegian. So please bear with my poor English spelling and grammar.