mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2015
Posts: 133
K
Vogon poet
OP Offline
Vogon poet
K
Joined: May 2015
Posts: 133
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.

twitter @keyeslol
Joined: Jun 2015
Posts: 84
F
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
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 }

Joined: May 2015
Posts: 133
K
Vogon poet
OP Offline
Vogon poet
K
Joined: May 2015
Posts: 133
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.

twitter @keyeslol

Link Copied to Clipboard