mIRC Home    About    Download    Register    News    Help

Print Thread
need help with $read #245220 13/04/14 10:04 PM
Joined: Apr 2014
Posts: 13
T
Tarekhere Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Apr 2014
Posts: 13
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 01 $gettok($address($2-(#,%a),5),1,33) $+ 0*1 $+ $gettok($ifmatch,1,32) 01 $remove($ial($gettok($address($2-(#,%a),5),1,33)).addr,gatekeeperpassport,@) 01 $gettok($ifmatch,2-,32)
      inc %b
    }
  }
  msg # 1 %b $iif(%b = 1,user found,users found) 01 $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.*

Last edited by Tarekhere; 13/04/14 10:05 PM.
Re: need help with $read [Re: Tarekhere] #245221 13/04/14 10:16 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: need help with $read [Re: Tarekhere] #245232 14/04/14 03:00 AM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
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) 01 $calc(($ticks - %c) / 1000) Secs.
}

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


Re: need help with $read [Re: blessing] #245240 14/04/14 05:13 AM
Joined: Apr 2014
Posts: 13
T
Tarekhere Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Apr 2014
Posts: 13
Thanks a lot blessing that solved the problem, really appreciate your help.