mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2015
Posts: 15
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2015
Posts: 15
So I have a quote bot for my stream, it will spew a quote from the list with the !saywhat command. However, I wish to have this on a cooldown so people can't spam quotes and get the bot banned. I can't for the life of me figure out how to add a cooldown to the !saywhat command detection.

I do not however want that cooldown on the !addquote command which will add quotes as long as they are a mod.

Here is my code so far
Code:
on *:LOGON:*:{
  raw CAP REQ :twitch.tv/membership
}

on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($2 == $null) { msg $chan $read(Quotes.txt, n) }
    ELSE {
      var %i 1
      while (%i <= $lines(Quotes.txt)) {
        if ($2 isin $read(Quotes.txt, %i)) {
          write tempfile.tmp $read(Quotes.txt, %i)
        }
        inc %i
      }
      msg $chan $read(tempfile.tmp)
      .remove tempfile.tmp
    }
  } 
  %nicks = spyker_z_ex computerwiz160 missabirose
  var %check = $istok(%nicks,$nick,32)
  if ($1 == !addquote) { 
    if ($nick isop $chan) || (%check == $true) { 
      write Quotes.txt $+($2-)  
      msg $chan Quote Added : $+($2-) 
    }
  }
}


Joined: Nov 2015
Posts: 14
N
Pikka bird
Offline
Pikka bird
N
Joined: Nov 2015
Posts: 14
This is for just 1 user making the flood.
Code:
on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($($+(%,flood.,$nick),2)) { return }
    set -u30 %flood. $+ $nick On


this is for the entire channel

Code:
on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($($+(%,flood.,$nick),2)) { return }
    set -u10 %flood On


You can combine both

Code:
on *:TEXT:*:#: {
  if ($1 == !saywhat) {
    if ($($+(%,flood.,$nick),2)) { return }
    set -u10 %flood On
    set -u30 %flood. $+ $nick On


u10 = 10 seconds
u30 = 30 seconds

I use this post to make that script.

Last edited by nanito; 23/12/15 05:02 AM.
Joined: Apr 2015
Posts: 15
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2015
Posts: 15
So where exactly would I insert this in my code?

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Code:
if ($($+(%,flood.,$nick),2)) { return }
set -u10 %flood On

This part is wrong:
if user <SomeNick1> will write something, you will create %flood for 10 secs with "On" in it, but your IF is checking for %flood.SomeNick1. You need to check for %flood or %flood.#channelname if more then 1.


Dont give a fish - teach to fish!
Joined: Nov 2015
Posts: 14
N
Pikka bird
Offline
Pikka bird
N
Joined: Nov 2015
Posts: 14
@splinny, yep, you are right.

@Computerwiz160

this is another example of text flood protection script:
http://www.mirc.org/mishbox/protection/textflood.htm

Last edited by nanito; 23/12/15 05:45 PM.
Joined: Apr 2015
Posts: 15
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2015
Posts: 15
Okay I see what you mean, but i dont know where to insert this into my code so it doesnt mess with anything else. Do i do it at the bottom or somewhere in the middle? Noob here :P

Joined: Nov 2015
Posts: 14
N
Pikka bird
Offline
Pikka bird
N
Joined: Nov 2015
Posts: 14
below the event:

Code:
on *:TEXT:*:#: {

Joined: Apr 2015
Posts: 15
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Apr 2015
Posts: 15
So what would the fix look like for this bit?


Link Copied to Clipboard