|
ozyvent
|
ozyvent
|
I need a script to kill anyone with a nick beginning with Guest.
I have a feeling it has to have something to do with while loops and /names (the raw numeric is 353 on this particular server)
If anyone can help pronto, that'd be great
|
|
|
|
Joined: Jan 2003
Posts: 148
Vogon poet
|
Vogon poet
Joined: Jan 2003
Posts: 148 |
ok... You can`t kill anyone if youre not an IRCop...
If you are u can use: if (Guest* iswm $nick) { kill $nick ... }
|
|
|
|
ozyvent
|
ozyvent
|
So that will kill anyone and EVERYone with a nick beginning with Guest based on the output of /names simultaneously?
|
|
|
|
Tsunami
|
Tsunami
|
so you want to do a /names on a channel, and then kill every nick that starts with Guest?
|
|
|
|
ozyvent
|
ozyvent
|
What I want is to when i type e.g. /killguests it does /names (of the entire network) and kills anyone and everyone with a nick beginning with Guest.
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
Or you could just perm-ban Guest*!*@* and be done with it.
|
|
|
|
ozyvent
|
ozyvent
|
Not helpful when Nickserv changes unidentified persons to Guest####
|
|
|
|
Tsunami
|
Tsunami
|
well, this responds to the normal /names (I don't know if there's any difference between a global /names, or a /names on a channel):
alias killguests { SET %kg 0 | .NAMES $1 }
raw 353:*: {
IF (%kg == 0) {
WHILE (%kg != $gettok($4-,0,32)) {
INC %kg
VAR %nick = $remove($gettok($4-,%kg,32),+,%,@,!,&,*,~)
IF (Guest* iswm %nick) { KILL %nick }
}
}
UNSET %kg
}
|
|
|
|
ozyvent
|
ozyvent
|
Ok, will see how I go, thanks
|
|
|
|
Joined: Dec 2002
Posts: 1,518
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,518 |
wouldnt increaseing the variable before u do anything miss the very first person in your while loop?
alias killguests { SET %kg 0 | .NAMES $1 }
raw 353:*: {
IF (%kg == 0) {
WHILE (%kg != $gettok($4-,0,32)) {
VAR %nick = $remove($gettok($4-,%kg,32),+,%,@,!,&,*,~)
IF (Guest* iswm %nick) { KILL %nick }
INC %kg
}
}
UNSET %kg
}
that would be the way id change yours to make it work alil more in order. its not the method id use exactly but thats no big deal either
|
|
|
|
Joined: Dec 2002
Posts: 3,015
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,015 |
No, since the variable is set at 0 to start with, not 1.
|
|
|
|
Joined: Dec 2002
Posts: 1,518
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,518 |
ok i didnt look closely enough to read that. btw is there any particular reason to adding the variable at zero instead of actually starting at 1? i would think it would speed up the code alil quicker.
|
|
|
|
ozyvent
|
ozyvent
|
Didn't work, any other suggestions. Had a suggestion from someone else to force change everyone who's using a Guest* nick to the same nick, and thus causing a nick collision and automatic kill. How would/could that work? the command is /operserv user nickname nick newnickname
|
|
|
|
Joined: Feb 2003
Posts: 806
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 806 |
i would think it would speed up the code alil quicker With such small differences, starting with 0 has proven to have the same speed as starting with 1 when benchmarked here. I think it's understandable in this case, since both methods are only different in their order (with 0 you /inc first and use </similar, with 1 you /inc last and use <=/similar), but always execute the same number of calls.. When I benchmarked a lot of loop "styles" involving various situations some time ago, using $0 as the max value for example (actually, whatever the max value was like), the faster one was var %i = $0, (%i), { command | dec %i }. Edit: In cases that %i's value should be shown increasing itself, either var %i = 0, (%i < $0), { inc %i | command } or var %i = 1, (%i <= $0), { command | inc %i } were the faster ones (when $0 was other more complex identifier, it was faster if set as a variable to use in the condition, or, in some cases, using ($identifier(%i)) as the condition). Anyone who benchmarked many loop styles too so we can see the results? Unfortunately I don't have my related notes anymore.. (Sorry it's off-topic :tongue:)
Last edited by cold; 18/10/03 03:55 AM.
|
|
|
|
|