mIRC Home    About    Download    Register    News    Help

Print Thread
#107303 08/01/05 02:24 PM
Joined: May 2004
Posts: 39
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: May 2004
Posts: 39
I'd like a script that kicks a certian nick evertime the join the channel it doesn't matter even if the changed the nick, is that possible?


Do the monkey!
#107304 08/01/05 03:34 PM
Joined: Jun 2004
Posts: 133
S
Vogon poet
Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
some one will show you a better way, but you could use

alias kicklist { guser kicklist $$1 }
on kicklist:join:#test:{
If ($UList($WildSite,kicklist,1).info != $Nick) {
raw -q kick # $nick Poney
}
}
then add in popups

Kicklist:/kicklist $$1

#107305 08/01/05 04:23 PM
Joined: Oct 2004
Posts: 31
B
Ameglian cow
Offline
Ameglian cow
B
Joined: Oct 2004
Posts: 31
Mine might not be better, but its simpler
put this in your remote:

on *join:#channel: {
if ($nick isin %blacklist) {
/ban -ku10 $nick $chan Blacklisted!
}
}

Then put this in aliases:

/blacklist /set %blacklist %blcklist $1
/removeblacklist /set %blacklist$remove(%blacklist,$1)



When you want to add someone, type /blacklist person'sname
When you want to remove someone, type /removeblacklist person'sname


Replace #channel with your channel

I try to explain how it works when I post script:

When they join, if their name is in the variable blacklist, they are kicked/banned (combo)
whne you type /blacklist, it takes %blacklist, and makes it the old blacklist, plus the persons name
when you remove, it takes their name out

Any other ?'s, PM me


Bear

#107306 08/01/05 06:08 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

  • isin is a really bad way to check if a nickname is in a string.

    Example: %blacklist Drone Theone Gooney

    Suppose a person with the nick "one" joins your channel.
    Your script will perform: if (one isin %blacklist) { do things }

    Needless to say this poor fella "one" will get kicked just because there are nicknames in %blacklist that contain his nick in their own nick.

    It would be far better to use $istok(%blacklist,$nick,32) as that will look for space delimited nicknames, so "one" can never match "Drone" etc. $istok will return $true if a match was found, and $false if no match was found.
  • For the same reason, it is very bad to use $remove(%blacklist,$1) because as stated, people can have parts of their nick in other people's nick.

    Let's say the person with nick "en" is on your blacklist, and your blacklist contains the following names:

    %blacklist greeny men semen english ten len benz en

    set %blacklist $remove(%blacklist,en) would have the following result:

    %blacklist greny m sem glish t l bz

    I don't think we want that.


  • What would be better is to use $remtok and $addtok.

    $addtok will add a token to a list, though if the item is already in there it won't, so there will never be double nicks in it.

    $remtok allows you to remove the Nth nick from a string, based on a delimiter, which is far better.

    Examples:

    %blacklist = $addtok(%blacklist,en,32) --> will add "en" to space delimited string %blacklist, but only if it doensn't already exist

    %blacklist = $remtok(%blacklist,en,1,32) --> will remove the 1st "en" from the space delimited string %blacklist. And since no doubles are in the list, it will be entirely removed.

  • One final thing: variables are very limited (around 935-940) chars depending on the length of the variable name. So you are going to run in problems if there are too many nicks to keep in your blacklist.

    Also, kicking based on nick isn't such a great idea either, you should keep their addresses stored instead, as those give better matching the right people. Since anyone can just change their nicknames.

    This is a very simple script, for now it'll certainly do, but after a while you might want to consider using hash tables to store addresses + nicks. Hash tables will be unlimited for something as a blacklist, and the retrieving of nicks will also be very fast.

Greets


Gone.

Link Copied to Clipboard