mIRC Homepage
Posted By: AaronL hash table - 08/10/06 10:46 AM
Good afternoon to all.

When writing a shitlist i learned i can do that best with hash tables, so with the helpfile i made this

/hmake shitlist 10
/hadd shitlist $address($$1,2) $chan

so in the list i have an IP, a name and channelname

What do i need to do to have IP kick/ban from channelname as mention in the shitlist. They need to be kick/ban only from the channelname where i put him/her on the shitlist.
P.s. I'm in several cnhannels.

Thanxs in advange.
Aaron
Posted By: RusselB Re: hash table - 08/10/06 03:32 PM
Code:
 /ban -k $hget(shitlist,$address($1,2)) $1 2 

Now for an explanation:
/ban is the actual ban command
-k tells mIRC that there needs to be a kick as well
$hget(shitlist,$address($1,2)) looks up the address in the shitlist hash table and returns the data stored (in this case the channel)
$1 is the person's nick
2 is the address mask for the ban
Posted By: AaronL Re: hash table - 08/10/06 07:02 PM
Hi RusselB

Thanxs for your reply.
i tested it, but i got this error
/ban: no such user 2

in the table should be a line like this:
*!*@123456.123456.nl nickname

since i'm in several channels where a person is allowed except in one channel, i would like to see if that person joins the other channels, nothing happens, but when that person joins #nl-irc he/she is going to be banned and kicked out of #nl-irc
Perhaps its best to have a line like this: IP name channel.
not sure ofcourse since i'm a noob with hash tables. smile

greetz
Aaron
Posted By: RusselB Re: hash table - 08/10/06 07:49 PM
Post your entire code, so that I can go over it and figure out just where the problems are. Based on the little bit that you did give, the hash table entries would be in the format of *!*@123456.123456.nl #channel

The person's nick would not be stored in the hash table.
Posted By: AaronL Re: hash table - 08/10/06 08:24 PM
Code:
menu nicklist { 
  -
  • Auto Manager
  .• Shitlist 
  ..Add $$1 : { /hadd shitlist $address($$1,2) $chan | .echo 4      =[ you added $$1 ]= }
  ..Remove $$1 : { /hdel shitlist $address($$1,2) | .echo 3      =[ you removed $$1 ]= }
}


in the table should be: *!*@123456.123456.nl #room
Posted By: RusselB Re: hash table - 08/10/06 09:36 PM
The only thing I can think of, is that the * that are being generated in the $address($$1,2) section of the /hdel command aren't being interpreted correctly. Try using the -w switch so that mIRC does a wilcard match.
Since there's only going to be one entry (maximum), then even a wildcard match will only return one match.
Posted By: AaronL Re: hash table - 09/10/06 05:40 AM
point is, that, with using the Add command, there will be a line in the hash table that looks like *!*@123456.123456.nl #room.

As soon someone with that IP joins the channel as mentioned in the hash table, he/she will be ban/kicked in only that channel.
The ..Remove will be changed in a window with all the IP's in it so its easyer to remove them if needed.

the reason i use the *!*@ is that a ident can be changed and thus the person won't be kicked.. (not sure of that tho)

Greetz
Aaron
Posted By: RusselB Re: hash table - 09/10/06 06:37 AM
With the -w switch, mIRC will delete any items that match the non-wilcarded part of the supplied informationi

If $address($nick,2) returned *!*@ServerAdmin.Maximum-IRC.com
using /hdel -w $address($nick,2) will search for a wildcard match on *!*@ServerAdmin.Maximum-IRC.com

The fact that the two happen to match exactly is irrelevant.

If you wanted, you could add to the hash table using $address($nick,5) and the same /hdel command would still work.

Regarding changing ident, yes, that definetely can be done, almost as easily as changing a person's nick. So using that format is a good idea, especially since the /ban command will work with a specified address (even one containing wildcards)
Posted By: AaronL Re: hash table - 09/10/06 07:50 AM
RusselB

i made the changings like the -w and its working now..
thank you very much for your help.

Greetz
Aaron
© mIRC Discussion Forums