|
Joined: Apr 2003
Posts: 426
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 426 |
Howdy. I'm an intermediate level mIRC scripter, and have finished making a user based blacklister that bans a joining nick (if it's in the list), or ignore's a nick, depending on if the user is a Channel OP or not. However, I would like to turn this into a hash table based method. One that preferably allows me to set the ban mask, and the reason all within the one hash table. I had attempted one previously by making a hash table, and just running a quick on JOIN statement:
on @*:join:%bh.chan:{
var %bl.taddress = $address($nick,5)
if $hmatch(blacklist, %bl.taddress, 1) {
echo -a $nick is bl.
}
}
However, for unknown reasons, it didn't work. I am wondering if anyone would be able to point me into the right direction, or even provide a sample file. Cheers.
-------- mIRC - fun for all the family (except grandma and grandpa)
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
This may help you. The hash table is used for a different purpose there, but it demonstrates the 'reverse wildcard' feature of hash tables. Note that $hmatch isn't listed anymore in the help file (although it still works), so you'd better use $hfind(<name>,<fulladdress>,1,[color:red]W)[/color] (uppercase W).
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Apr 2003
Posts: 426
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 426 |
on @*:JOIN:#:{
var %bl.taddress $address($nick,9)
if $hfind(blacklist,%bl.taddress,1,W) {
echo -s $nick is blacklisted
}
}
It is fairly simple code (I won't be adding the "good" stuff in until I can get this to work), however, I have been using it to no luck. The statement is not being echoed. This is the htable. /hmake -s blacklist 100 /hadd -s blacklist nickname $address(nickname,9) I am also saving this atm. /hsave -s blacklist hash_tables\blacklist.txt *EDIT*on @*:JOIN:#: { if ( $hget(blacklist,$nick) ) { mode $chan +b $mask($fulladdress,3) kick $chan $nick blacklisted nick } } The $hget(blacklist,$nick) works. However, I would like to know if it is possible to use a single hash table to store the banmask and a reason for the ban, and retrieve that information along with the nickname? Cheers.
Last edited by neophyte; 23/04/03 11:27 AM.
-------- mIRC - fun for all the family (except grandma and grandpa)
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
It seems that you want to do different things than I thought. You want to check if the exact string returned by $address(nick,9) is an item in the hash table. If it's that, you can also include the reason by modifying your hash table to store $address(nick,9) as the ITEM and the blacklist reason as the DATA. Example: /hadd blacklist $address(nick,9) I don't like youYou don't need to add the nickname anywhere because it is already contained in $address(nick,9). Your on JOIN event should be modified like this: on @*:JOIN:#: {
if ( [color:red]$hget(blacklist,$mask($fulladdress,9))[/color] != $null ) {
mode $chan +b $mask($fulladdress,3)
kick $chan $nick [color:red]$ifmatch[/color]
}
} $ifmatch holds the $hget() value, which is the data of the item "$mask($fulladdress,9)", ie the blacklist reason. (The != $null addition is there so that the script won't fail if the reason is "0". Yeah, you'd be weird if you have such reasons but I'm not prejudiced :tongue:)
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Apr 2003
Posts: 426
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 426 |
ok... cheers. Thank you for your input ![smile smile](/images/graemlins/mirc/smile.gif) ! *EDIT*I also want it so that it will kick/ban any joining user no matter what mask is used in the blacklister (only the standard masks will be used, ie, 0-9). I guess a while loop would work, but surely there is a more effecient manner?
Last edited by neophyte; 23/04/03 12:10 PM.
-------- mIRC - fun for all the family (except grandma and grandpa)
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
Well, that's what $hfind() with W does. Read the link I pasted in my first post carefully, there's no way I could explain it better than Pasmal in that article. In short, your code should be modified like this: on @*:JOIN:#: {
if ( [color:red]$hfind(blacklist,$fulladdress,1,W)[/color] ) {
mode $chan +b $mask($fulladdress,3)
kick $chan $nick $hget(blacklist,[color:red]$ifmatch[/color])
}
}
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Apr 2003
Posts: 426
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 426 |
*smacks head*
silly me!
clean forgot all about W !
-------- mIRC - fun for all the family (except grandma and grandpa)
|
|
|
|
Joined: Feb 2003
Posts: 67
Babel fish
|
Babel fish
Joined: Feb 2003
Posts: 67 |
Your code looks amazingnly like my code, no wait.... It is my code.
Why don't you try creating something original. You didn't even have sense enough to change the variable names and are apparently botching what you did rip. LAME
My script is posted on mircscripts.org called BlackHash for anyone else that would like to verify this.
Last edited by Naz; 05/05/03 09:50 AM.
Those who live by the sword get shot by those who don't.
|
|
|
|
Joined: Dec 2002
Posts: 1,237
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,237 |
How can you be so sure? Do you have any concrete proof that it is "yours"? Have you ever thought of the possiblility of a coincidental similar code? Maybe there were others similar to yours with different variables...Who knows...
I figured I would ask these questions because of the fact that you are attacking someone over it...Who knows maybe your coding is a ripoff of this one...Of course this is only a hypothetical perspective...If it is in fact your code, the person in question may have a reasonable explanation...
Don't get upset with this post I am just merely suggesting a few possibilities.
|
|
|
|
Joined: Dec 2002
Posts: 1,527
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,527 |
it looks amazingly enough like the code was not ripped but that qwerty actualy madeit for neophyte ..... i mean if hes talking about neophytes code that DOESNT work that he submitted then id not be bragging about that one lil thing ... ironically enough if your code is simple and basic enough to say use variables that are called what the code does ... dont be surprised if someone else comes up with the same code
D3m0nnet.com
|
|
|
|
Joined: Feb 2003
Posts: 67
Babel fish
|
Babel fish
Joined: Feb 2003
Posts: 67 |
No offense taken in that regard.
1. The code in question was posted here on the same date that my script was re-posted on mircscripts.org.(so it was submitted there atleast by then) In fact it has been there since January but do to a server glitch fell out of their list.
2. The variable names and syntax are exactly the same (with one exception) from an earlier version though woefully incomplete. The variable names are not something that would be common.
I would have no problem at all if somebody wanted to learn by looking at my script to see how I've done something. That is how I learned much of what I did, by seeing how somebody else does it. However, I have never copied/pasted code and implied that it was my own, as he seems to have in his initial post. Quote "I had attempted one previously by making a hash table, and just running a quick on JOIN statement:"
Like most scripters, I too have put a lot of time and effort into making my script and offering it to others to use. I also realize that being a text based scripting language, ripping will no doubt occur. Pointing out those that do it ? I dunno.
If I am wrong here I'll certainly throw up a white flag and apologize but, I don't think so.
Those who live by the sword get shot by those who don't.
|
|
|
|
Joined: Feb 2003
Posts: 67
Babel fish
|
Babel fish
Joined: Feb 2003
Posts: 67 |
It does work, had he pasted the rest of the text in that section, part of which is similar to what Qwerty came up with. The variable names are not common. %bh.chan or %bl.taddress ?
What I'm getting at is that if that small portion was going to be copied verbatim why not the whole 800+ line script?
Those who live by the sword get shot by those who don't.
|
|
|
|
Joined: Dec 2002
Posts: 1,527
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,527 |
maybe he used yours as a working model?
D3m0nnet.com
|
|
|
|
Joined: Dec 2002
Posts: 1,237
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,237 |
Maybe I should have worded my last post a little better. I was only implying hypothetical questions regarding that code. I understand that you are concerned with "rippers" stealing your coding. What I intended for the post to lead to was (and I think it was mentioned in another post) that someone can easily state that it was of their own when it really wasn't. There honestly isn't any concrete proof to tell who wrote what.
Generally, it is common for this to occur but, i'm pretty sure that alot of people have learned from someone elses coding even if they did rip it off. I wasn't trying to point fingers intentionally so I apologize if it seemed that I pointed you out.
Now if you want to make it clear that someones coding is a ripoff of possibly your coding, you should next time direct your concerns to that person about it. There is a private message option provided by this message board probably for that purpose. I dunno maybe it was the way you singled out someone about it...who knows its no big deal anymore.
I was trying to post in a hypothetical direction maybe it took a slight detour along the way LOL ah well no big deal anymore right?
|
|
|
|
Joined: Feb 2003
Posts: 67
Babel fish
|
Babel fish
Joined: Feb 2003
Posts: 67 |
It's not a major concern, I had expected that it may happen at some point. I didn't take anything you said personally. My reply was intended to demonstrate that I was not making a rash or baseless accusation. Others can decide for themselves what's what. It was probably an overreaction on my part, especially given the small amount of code posted. That was in part due to lack of sleep but more so that I know how hard I had to work at the script to get it to do what it does. Could be better I'm sure but it's original. I don't care for recognition of my limited scripting ability but I wouldn't expect somebody to seek recognition on the shoulders of others either. Why else would they rip rather than just use the scripts they download. At any rate, I'll drop this thread. I said my peace on it, appropriately so or not. No big deal
Those who live by the sword get shot by those who don't.
|
|
|
|
|