mIRC Homepage
Posted By: Tarekhere need help with $read - 13/04/14 10:04 PM
Hello guys I need your help.

This code is repeating the same message for some reason which I dont know why !!

Code:
on admin:TEXT:.fn*:#:{
  var %a = 0, %b = 0, %c = $ticks
  msg # 1User List Scan Started..
  while (%a < $nick(#,0)) {
    inc %a
    if ($read(users.txt,w,$+(*,$2-,*))) {
      msg # 1found 0›1 $gettok($address($2-(#,%a),5),1,33) $+ 0*1 $+ $gettok($ifmatch,1,32) 0›1 $remove($ial($gettok($address($2-(#,%a),5),1,33)).addr,gatekeeperpassport,@) 0›1 $gettok($ifmatch,2-,32)
      inc %b
    }
  }
  msg # 1 %b $iif(%b = 1,user found,users found) 0›1 $calc(($ticks - %c) / 1000) Secs.
}



and this is how it responds

[23:41] « @ » • « Leb-Bot » User List Scan Started..
[23:41] « @ » • « Leb-Bot » found › **!*Somebody@D66EC4.292DF2.6E2CFE.9E7530 › › Somebody
[23:41] « @ » • « Leb-Bot » found › **!*Somebody@D66EC4.292DF2.6E2CFE.9E7530 › › Somebody
[23:41] « @ » • « Leb-Bot » found › **!*Somebody@D66EC4.292DF2.6E2CFE.9E7530 › › Somebody
[23:41] « @ » • « Leb-Bot » found › **!*Somebody@D66EC4.292DF2.6E2CFE.9E7530 › › Somebody
[23:41] « @ » • « Leb-Bot » found › **!*Somebody@D66EC4.292DF2.6E2CFE.9E7530 › › Somebody
[23:41] « @ » • « Leb-Bot » 5 users found › 0.094 Secs.

I have no idea where the error is !! and im not expert too so if someone can please edit it for me ?? thank u.
I dont want it to repeat i want it to find all ips for this nickname which is registered in users.txt
i want it also to find all entries if i type a part of the ip like that .fn @D66EC4.*
Posted By: Nillen Re: need help with $read - 13/04/14 10:16 PM
What it sounds like you want to do is to add the initial response to a storage somewhere, if the response you receive is in that storage then ignore that response and keep searching.

And of course, at the end of the loop delete that storage.
Posted By: blessing Re: need help with $read - 14/04/14 03:00 AM
The error is on while loop. It loops all users in the channel, so if the channel has 100 users then it will repeats 100 times as well.

Code:
on admin:TEXT:.fn*:#:{
  var %a = 1, %b = 0, %c = $ticks
  msg # 1User List Scan Started..
  while ($read(users.txt,w,$+(*,$2-,*),%a)) {
    msg # $v1
    var %a $calc($readn + 1)
    inc %b
  }
  msg # 1 %b $iif(%b = 1,user found,users found) 0›1 $calc(($ticks - %c) / 1000) Secs.
}

I dont know what is inside your users.txt files, so the code just msg plain output.
- Not tested.

Posted By: Tarekhere Re: need help with $read - 14/04/14 05:13 AM
Thanks a lot blessing that solved the problem, really appreciate your help.
© mIRC Discussion Forums