mIRC Home    About    Download    Register    News    Help

Print Thread
K
keyeslol
keyeslol
K
I am trying to figure out why flood protection for the following code isn't working. Essentially, reading lines from a file and using a part of the line to add a delay for triggering a response.

Here's the code:
Code:
on $*:TEXT:m/\!.*/iS:#:{
  var %commands = commands.ini
  var %cmd = $mid($1,2)

  var %networkchan = $+($networkchan,-,$chan)
  var %commandout = $readini(%commands,n,%networkchan,%cmd)
  var %user = $mid($2,0,25)

  if ($len(%commandout)) { 
    if ((%floodcom. +$ %cmd. [ $+ [ $chan ] ]) || ($($+(%,floodcom. +$ %cmd. [ $+ [ $chan ] ] $+ .,$nick),2))) { return }
    set -u10 %floodcom. +$ %cmd. [ $+ [ $chan ] ] On
    set -u20 %floodcom. +$ %cmd. [ $+ [ $chan ] ] $+ . $+ $nick On
    msg # %user %commandout
  }
}


Thanks!

Last edited by keyeslol; 18/05/16 07:37 PM.
F
Fonic_Artes
Fonic_Artes
F
I think it may be this here.

Code:
if ((%floodcom. +$ %cmd. [ $+ [ $chan ] ]) || ($($+(%,floodcom. +$ %cmd. [ $+ [ $chan ] ] $+ .,$nick),2))) { return }


You have some +$ instead of $+.

It should be this instead.

Code:
if ((%floodcom. $+ %cmd. [ $+ [ $chan ] ]) || ($($+(%,floodcom. $+ %cmd. [ $+ [ $chan ] ] $+ .,$nick),2))) { return }

K
keyeslol
keyeslol
K
Thanks for pointing it out, I ended up fixing all the code with trail and error and now need someone to explain what the 2 does in the following code (which was not in the original post and was preventing from executing)

Code:
if ($($+(%,floodcom. $+ [ %cmd ] $+ . [ $+ [ $chan ] ] $+ ),2) { return }

Last edited by keyeslol; 19/05/16 06:33 PM.

Link Copied to Clipboard