mIRC Home    About    Download    Register    News    Help

Print Thread
#207932 07/01/09 05:37 PM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
Hi,

I made this anti-swear that kicks for racism but i dunno how to make it so it only works on certain channels. I'v tried looking and that but havn't found anything that will help me.

Code:
on *:text:*nigger*:#:{
  msg $nick NO Racism.
  { kick $chan $nick NO Racism }
}
on *:text:*nigga*:#:{
  msg $nick NO Racism.
  { kick $chan $nick NO Racism }
}
on *:text:*s4ad45d4ad45as*:#:{
  msg $nick NO Racism.
  { kick $chan $nick NO Racism }
}
on *:text:*882xms44ad4a545sad5as*:#:{
  msg $nick 4M3e4r3r4y 3C4h3r4i3s4t3m4a3s 1from 4Us.1.
  { $chan $nick 4M3e4r3r4y 3C4h3r4i3s4t3m4a3s 1from 4Us.1. }
}
on *:text:*gypsy*:#:{
  msg $nick NO Racism.
  { kick $chan $nick NO Racism }
}
on *:text:s445da4sa56d5s4sd5646a5sd46s4d6as4:#:{
  msg $nick NO Racism.
  { kick $chan $nick NO Racism }
}

Thats what i have but its confusing me. I'v been trying to do it for the last few days.

Also to go along with this anti-kick for racism i have this aut-ban that unbans after 2 minutes. But the problem is, is that people with +h,+o etc can set mode +e which means they can join straight after being banned. Was wondering if theres a way round it?

Code:
on @*:TEXT:*nigger*:#: { msg $chan 2 minute temporary ban.
ban -ku120 $chan $nick }

on @*:TEXT:*nigga*:#: { msg $chan 2 minute temporary ban.
ban -ku120 $chan $nick }

on @*:TEXT:*gypsy*:#: { msg $chan 2 minute temporary ban.
ban -ku120 $chan $nick }

on @*:TEXT:*s445da4sa56d5s4sd5646a5sd46s4d6as4*:#: { msg $chan 2 minute temporary ban.
ban -ku120 $chan $nick }


Thanks grin

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Ok for starters the brackets here are pointless.
msg $nick NO Racism.
{ kick $chan $nick NO Racism }

Originally Posted By: mIRC help file
Basic format
if (v1 operator v2) { commands }
elseif (v1 operator v2) { commands }
else { commands }

So you would say:

on *:text:*nigger*:#:{ msg $nick NO Racism. | kick $chan $nick NO Racism }


As for channel specific protections. I name a hash table entry, or variable or ini entry, after the protection, then add the channel to it if I want it to be on for that channel.

%swearkick #chan1,#chan2,#chan3

Then I check:

if ($chan !isin %swearkick) { return }

Code:
on *:text:*nigger*:#:{
if ($chan !isin %swearkick) { return }
msg $nick NO Racism. | kick $chan $nick NO Racism
}


You could say:

Code:
on *:text:*nigger*:#:{
if ($chan isin %swearkick) { msg $nick NO Racism. | kick $chan $nick NO Racism }
}


But I was taught that the first example is more stable.

Joined: Jul 2006
Posts: 4,153
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,153
Using isin here is wrong, if i have the variable like this :
%var #channel,#channel1...
if $chan is for exemple #chann, it will match whereas it should not, $istock would be the right way, but here, the best way would be :

Code:
on *:text:*nigger*:$(%swearkick):msg $nick NO Racism. | kick $chan $nick NO Racism


And your first example isn't more stable, the two code are doing exactly the same thing.It's just that in that case, you can avoid one line.

For the OP, you could check if the user have the +e mode before banning, and you might want to remove his protection, but he could then put it again...
Also, why do you use two different on text for the same match, just use /ban -ku in one event.

Last edited by Wims; 07/01/09 07:08 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I'd like you to go through the channel list of any server you are on and see if that is an issue. It hasn't been an issue for me for the past 7 years. I chose isin as it has proven to be the fastest comparison.

As for /return vs. not, it IS less likely to produce errors than the second example, therefore more stable. Also, I used $istok until I tested it and found it is the slowest way to check.

Joined: Jul 2006
Posts: 4,153
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,153
I'm on epiknet, there is for example #quizz and #quizzland, and :
%var is #channel,#quizzland

if (#quizz isin %var) will match.

I'm not sure why you're thinking that the first example will not produce error whereas the second will, they are equal, none of them will produce any error.Error means that the code is incorrect and it's not the case here.
Of course $istok is slower than isin, but imo, exact result is better than faster result smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Razor, you can greatly condense your script with regular expressions:

Code:
on $*:TEXT:/(nigger|nigga|s4ad45d4ad45as|882xms44ad4a545sad5as|gypsy|s445da4sa56d5s4sd5646a5sd46s4d6as4)/iS:#: {
  var %c = channel1|channel2|channel3|channel4|channel5|channel6|channel7|channel8|
  if ($regex($chan,%c)) { msg $chan $nick NO Racism - 2 minute temporary ban. | ban -ku120 $chan $nick NO Racism }
}


Now, all you have to do is replace channel1, channel2, channel3, etc...with the actual channel names you want the above script to work in, along with a pipe between them shown above. You don't even have to make separate events for kick/ban.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Interesting Wims. Thanks, I've never had that issue. I'd feel bad for the poor op who happened to host both #quizz and #quizzland but only wanted his protections on in one of those!


Link Copied to Clipboard