Originally Posted By: Krawalli

That is pretty, how can i put in a flood control (different for each !command) in that script?

The same flood control for all commands

Code:
on *:text:*:#: {
  if ($strip($1) == !word1) || ($strip($1) == !word2) || ($strip($1) == !word3) || ($strip($1) == !word4) {
    if ($timer(AntiFlood [ $+ [ $nick ] ]) == $null) { set %lessnums [ $+ [ $nick ] ] 10 | .timerAntiFlood [ $+ [ $nick ] ] 10 1 dec %lessnums [ $+ [ $nick ] ] }
    else { msg # $nick Command is ready to use in %lessnums [ $+ [ $nick ] ] seconds | return }
  }
  if (%lessnums [ $+ [ $nick ] ] != 0) {
    if ($strip($1) == !word1) { do stuff }
    if ($strip($1) == !word2) { do stuff }
    if ($strip($1) == !word3) { do stuff }
    if ($strip($1) == !word4) { do stuff }
  }
}


Time antiflood is set in 10 seconds, to change this, you must modify the numbers in red color.
Quote:
if ($timer(AntiFlood [ $+ [ $nick ] ]) == $null) { set %lessnums [ $+ [ $nick ] ] 10 | .timerAntiFlood [ $+ [ $nick ] ] 10 1 dec %lessnums [ $+ [ $nick ] ]


Flood control (different time for each !command), occurred to me quickly this code, which could be shortened in less lines.
Code:
on *:text:*:#: {
  if ($strip($1) == !word1) { 
    if ($timer(AntiFlood1 [ $+ [ $nick ] ]) == $null) { set %lessnums1 [ $+ [ $nick ] ] 10 | .timerAntiFlood1 [ $+ [ $nick ] ] 10 1 dec %lessnums1 [ $+ [ $nick ] ] }
    else { msg # $nick Command $qt(!word1) is ready to use in %lessnums1 [ $+ [ $nick ] ] seconds | return }
  }    

  if ($strip($1) == !word2) { 
    if ($timer(AntiFlood2 [ $+ [ $nick ] ]) == $null) { set %lessnums2 [ $+ [ $nick ] ] 20 | .timerAntiFlood2 [ $+ [ $nick ] ] 20 1 dec %lessnums2 [ $+ [ $nick ] ] }
    else { msg # $nick Command $qt(!word2) is ready to use in %lessnums2 [ $+ [ $nick ] ] seconds | return }
  }    

  if ($strip($1) == !word3) { 
    if ($timer(AntiFlood3 [ $+ [ $nick ] ]) == $null) { set %lessnums3 [ $+ [ $nick ] ] 30 | .timerAntiFlood3 [ $+ [ $nick ] ] 30 1 dec %lessnums3 [ $+ [ $nick ] ] }
    else { msg # $nick Command $qt(!word3) is ready to use in %lessnums3 [ $+ [ $nick ] ] seconds | return }
  }    

  if ($strip($1) == !word4) { 
    if ($timer(AntiFlood4 [ $+ [ $nick ] ]) == $null) { set %lessnums4 [ $+ [ $nick ] ] 40 | .timerAntiFlood4 [ $+ [ $nick ] ] 40 1 dec %lessnums4 [ $+ [ $nick ] ] }
    else { msg # $nick Command $qt(!word4) is ready to use in %lessnums4 [ $+ [ $nick ] ] seconds | return }
  }    

  if (%lessnums1 [ $+ [ $nick ] ] != 0) {
    if ($strip($1) == !word1) { do stuff }
  }
  if (%lessnums2 [ $+ [ $nick ] ] != 0) {
    if ($strip($1) == !word2) { do stuff }
  }  
  if (%lessnums3 [ $+ [ $nick ] ] != 0) {

    if ($strip($1) == !word3) { do stuff }
  }
  if (%lessnums4 [ $+ [ $nick ] ] != 0) {

    if ($strip($1) == !word4) { do stuff }
  }
}


Time antiflood is set in 10,20,30 and 40 seconds for each different command, to change this, you must modify this numbers in two places timers and variables, corresponding to each command.



Last edited by JuanAm; 14/12/14 09:51 AM.