mIRC Home    About    Download    Register    News    Help

Print Thread
#205370 21/10/08 04:23 AM
Joined: May 2008
Posts: 127
J
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2008
Posts: 127
Hi guys I know you're tired of all these INI questions. :P

I have an INI with hundreds of IP's listed inside which are the value of an item. The item is the username of the IP holder. Depending on whether they have dynamic or static, some usernames only have 1 IP listed as a value and some have 20+ IP's listed. Example:

Quote:

[userips]
name1=1.2.3.4
name2=5.6.7.8
name3=9.10.11.12
name4=13.14.15.16,17.18.19.20,21.22.23.24
etc.


I have the script built to return the holder's name of the given IP (like an IP search script). But I want to be able to show which IP is matching the wildcard search if the user has multiple IP's listed next to their name.

So for example, using the quote above:
Quote:
Joe: !searchip 17
Bot: Match found. 'name4' (17.18.19.20)


Like I said I have the entire script written, I just need to find out how to snag the matched IP and display what the IP is that is being matched. Every attempt I've made just returned everything after the name (the entire value, including every IP listed next to the name).

Any help is appreciated. Thanks.

Joe_Dean #205371 21/10/08 05:03 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I realize that the variable lines in this code could be combined, but thought it looked cleaner this way, especially since you're probablly going to have to do som modifications to get it to fit in with the code you already have.
Code:
on *:text:!searchip*:*:{
  var %a = 1, %b = $ini(IP.INI,userips,0)
  while %a <= %b {
    var %item = $ini(IP.INI,userips,%a)
    var %ips = $readini(IP.INI,n,userips,%item)
    var %ip = $wildtok(%ips,$+(*,$2,*),1,44)
    .msg $iif($chan,$v1,$nick) %item %ip
    inc %a
  }
}



Link Copied to Clipboard