|
Joined: Dec 2002
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Dec 2002
Posts: 51 |
i'm helping a friend with a script. the script is designed to stop the channel from being flooded with identical Idents. When the allowed number of identical idents join the channel, the ident is banned and they're all kicked. the script also compares the time between 2 nicks joining on the channel with the same ident, and if the time is less then one minute, the nick is banned.
on 1:JOIN:%IJSchannel: {
set %IJSrawswitch on
who $nick
set %IJSrawswitch off
if ( $ialchan(*!* $+ %IJSaddy $+ @*,%IJSchannel,0) == %IJScount ) {
msg x ban %IJSchannel *!* $+ %IJSaddy $+ @* %IJStime %IJSlevel %IJSreason
%Bident IJSaddy
%bident.Time $ctime
}
if ( $ialchan(*!* $+ %IJSaddy $+ @*,%IJSchannel,0) == %Bident ) {
%Nident.Time $ctime
if ( $calc(%Nident-%Bident) <= 1 minute ) { ban $nick }
else halt
}
}
i just got tired of it and thought i would see if i can get some help while i sleep Thanks all
|
|
|
|
Joined: Dec 2002
Posts: 774
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 774 |
1. ... %Bident IJSaddy %bident.Time $ctime ... %Nident.Time $ctime ...
Those will execute the contents of the variables as commands
2. Something else, but I'm too tired atm
//if ( khaled isgod ) echo yes | else echo no
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
Make sure that %IJSchannel and %Bident are properly set. Also, create %Sident for the number of seconds, currently 60 seconds; might as well make that consistent with %Bident
[color:#006600]; When I'm the one joining, WHO the channel to fill its IAL.
;[/color]
on me:*:JOIN:#:{
set -u600 $+(%,me.JOIN.,$chan) 1
who $chan
}
raw 352:*:{
if ($eval($+(%,me.JOIN.,$2),2)) {
[color:#006600]; Initialize everyone's ident $ctime to 0 since I didn't see them join.[/color]
hadd -m $2 $remove($3,~) 0
halt
}
}
raw 315:*:{
if ($eval($+(%,me.JOIN.,$2),2)) {
unset $+(%,me.JOIN.,$2)
halt
}
}
[color:#006600];
; If someone else is joining, process by the rules given in the previous post.
;[/color]
on !*:JOIN:[color:red]%IJSchannel[/color]:{
var %ctime = $ctime, %ident = $gettok($remove($address,~),1,64), %mask = $+(*!*,$right(%ident,9),@*)
if ($calc(%ctime - $hget($chan,%ident)) < [color:red]%Sident[/color]) KB-Ops %mask Too fast!
elseif ($ialchan(%mask,$chan,0) > [color:red]%Bident[/color]) KB-Ops %mask Too many!
hadd -m $chan %ident %ctime
}
[color:#006600]; (KickBan minus Ops) Don't kick any ops that might have this ident.
;[/color]
alias -l KB-Ops {
if ($me !isop $chan) return
var %-o, %i = 1
[color:#006600]; Check to see if there are any non-ops to ban.[/color]
while ($ialchan($1,$chan,%i).nick)) {
if ($ifmatch !isop $chan) {
mode $chan +b $1
%-o = 1
break
}
inc %i
}
[color:#006600]; If we found any non-ops, kick them.[/color]
while ($ialchan($1,$chan,%-o).nick)) {
var %nick = $ifmatch
if (%nick !isop $chan) kick $chan %nick $2-
inc %-o
}
}
[color:#006600];
; Handle cleanup of the tables we no longer need.
;[/color]
on me:*:PART:%IJSchannel: hfree $chan
on me:*:QUIT: hfree -w #*
Or something like that - should be fairly close - close enough to get you on the right track. Too tired to test it, though I don't see anything wrong with it.
Last edited by Hammer; 06/01/03 05:32 AM.
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Dec 2002
Posts: 51 |
i can only do a /who #channel once, after that, nothing is returned by raw 352, and raw 315 produces the following error (every time /who is used) * /if: invalid format (line 47, script2.INI)
raw 352:*:{
if ($eval($+(%,me.JOIN.,$2),2)) {
; Initialize everyone's ident $ctime to 0 since I didn't see them join.
hadd -m $2 $remove($3,~) 0
halt
}
}
raw 315:*:{
if ($eval($+(%,me.JOIN.,$2),2) {
unset $+(%,me.JOIN.,$2)
halt
}
}
after a bit of checking, i found that /who wouldn't work if this was set in the variables tab: %me.JOIN.#beginner 1 its set when i join the channel: on me:*:JOIN:#:{ set -u600 $+(%,me.JOIN.,$chan) 1 who $chan }
Last edited by Dingo; 06/01/03 05:21 AM.
|
|
|
|
Joined: Dec 2002
Posts: 1,321
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,321 |
When the variable is set, it is set to unset itself in 10 minutes. If you are getting more than 10 minutes lag from a /who reply, you probably need to switch servers or reconnect anyway since any kick/bans you do will also be that lagged. The raw 315 is supposed to unset it explicitly when the /who for that channel completes, thus clearing that little problem. The problem is that I typed this up too quickly and didn't proofread it enough. I missed a single ) .. noted in red below. This caused the 315 to halt processing and not unset the variable as it should. You should have been able to /who the channel after 10 minutes (when the variable expired by itself).
raw 315:*:{
if ($eval($+(%,me.JOIN.,$2),2)[color:red])[/color] { I'm curious to know if the rest of the script worked, though. As I said, I just typed it up in here - I didn't test it. :tongue: I went to sleep instead.
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
|
|
|
|
Joined: Dec 2002
Posts: 51
Babel fish
|
OP
Babel fish
Joined: Dec 2002
Posts: 51 |
missing )'s was something I checked for but I missed it too . good find and the rest of the script hasn;t caused any errors, but I havn't seen multiple idents yet. so when I do, I'll let you know. good idea going to sleep. i ended up going right to sleep after i sent the post too.
|
|
|
|
|