mIRC Home    About    Download    Register    News    Help

Print Thread
#273393 03/05/25 07:39 AM
Joined: Dec 2024
Posts: 12
M
Mairel Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Dec 2024
Posts: 12
I found this piece of code here on the forum:


alias checknicks {
var %x = 1
while (%x <= $lines($mircdirbadnicks.txt)) {
var %i = 1
while (%i <= $nick($chan,%i)) {
if ($read(badnicks.txt,%x) iswm $nick($chan,%i)) {
ban $chan $nick($chan,%i)
}
inc %i
}
inc %x
}
}


I'm using it in the badnicks script I have, to force bans on command, and it works perfectly, I just want to change the ban:


ban $chan $nick($chan,%i)


Since it comes out like this: nick1!*aRRZLOvFG@ThisNet-3v8s98.xyz.system.com

I wish it were like this: *nick1*!*@*

Every time I try to make a change I get the message "insufficient parameters" and the ban doesn't work anymore. What would be the correct code?

Joined: Jan 2012
Posts: 333
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 333
Whenever you want to use/add any command to script code, it is recommended to first study the syntax and also look at the examples to understand how this command works and what it does in order to use it correctly or perhaps you need to choose another command that is suitable for implementing your idea.

The provided code uses these commands: "var", "while", "if", "ban", "inc". You can find all the information about these and other commands in the help documentation.

The full list of available built-in mIRC commands is here: https://en.wikichip.org/wiki/mirc/commands


So, to set a ban only on a nick, by the specified mask, try replacing ban $chan $nick($chan,%i) with mode $chan +b $+(*,$nick($chan,%i),*!*@*)


Leave a comment if this helped solve problem or not.


🌐 https://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Dec 2024
Posts: 12
M
Mairel Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Dec 2024
Posts: 12
Yes, I usually always try for simple things, sometimes I succeed and sometimes I don't, actually I realized that I'm not good at it, but that's okay.

In any case your change works, but I noticed that there is another line of code, always about the ban, that also needs to be fixed. I would have written it in the first post if I had noticed it before.


alias BNicks {
var %cNicks = 1
while (%cNicks <= $lines(badnicks.txt)) {
if ($read(badnicks.txt,%cNicks) isin $1) || ($read(badnicks.txt,%cNicks) iswm $1) {
var %cExceptions = 1
while (%cExceptions <= $lines(badnicksexc.txt)) {
if ($read(badnicksexc.txt,%cExceptions) isin $1) || ($read(badnicksexc.txt,%cExceptions) iswm $1) {
halt
}
inc %cExceptions
}
ban $2 $1 $+ !*@*
halt
}
inc %cNicks
}
}


If you could fix this -> ban $2 $1 $+ !*@*

To get this out too: *nick1*!*@*

I noticed that I could still "catch" any nick in the ban since I can wildcard nicks in the .txt file, but I think it's technically correct, and better, to output it like this: *nick1*!*@* instead of leaving it as it currently is: nick1*!*@* right?

Joined: Jan 2012
Posts: 333
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 333
If the command with arguments passed to the alias looks like this "/BNicks nick #channel", then inside the code the first parameter $1 = nick, and the second $2 = #channel.


In that case, try replacing ban $2 $1 $+ !*@* to mode $2 +b $+(*,$1,*!*@*)


🌐 https://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Dec 2024
Posts: 12
M
Mairel Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Dec 2024
Posts: 12
It works. Thanks for your help Epic, I really appreciate it.


Link Copied to Clipboard