| View previous topic :: View next topic |
| Author |
Message |
samhain Halfop
Joined: 03 Jan 2007 Posts: 77
|
Posted: Tue Sep 06, 2011 3:57 am Post subject: Takeover Protection. |
|
|
| Hi I am looking for a script that If a person who is op on the channel and if his nick or host is not added in the bot, and kicks more than 3 people, in X seconds, The bot should issue this command: Chanserv Aop #channel-name Del NameoFtheperson and Also blacklist that person out of the channel. Thanks. |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Wed Sep 07, 2011 3:59 pm Post subject: |
|
|
I suppose you could take advantage of the old tried and true "throttle" proc with some tweaks:
| Code: |
bind kick * * unaop
proc throttled {id time} {
global throttled
if {[info exists throttled($id)]} {
return 1
} {
set throttled($id) [clock seconds]
utimer $time [list unset throttled($id)]
return 0
}
}
proc unaop {nick host hand chan target reason} {
set ktime "3"
if {[throttled $host,$chan $ktime] && [isop $nick $chan] && ![validuser [nick2hand $nick $chan]]} {
putserv "PRIVMSG chanserv :aop $chan del $nick"
}
}
|
This doesn't solve the second part of your question though, since I don't know what you mean by "blacklist them from the channel". I'm not sure how well this works though... let me know, heh. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Sep 08, 2011 1:57 pm Post subject: |
|
|
You don't need [nick2hand $nick $chan] since you already have that info in $hand, also you don't need [isop $nick $chan] as one can't kick without having 'operator' (@) on the channel (except some server operator or whatever).
I would go for something like:
| Code: |
if {[validuser $hand]} return
if {[throttled $chan,$host]} {
putserv "PRIVMSG chanserv :aop $chan del $nick"
}
|
Anyway, following the logic of the 'throttled' proc I see a major failure at this part:
| Code: |
if {[info exists throttled($id)]} {
return 1
}
|
A user just issued his first kick so the throttled proc kicks in and checks if there's an id with that $host,$chan and since there isn't any (since is his first kick) the proc will return 1, then 'isop' check will also return 1 and 'validuser' check will (let's say he isn't a known user) will also return 1 thus the if statement is validated and the user 'aop' removed from the first kick.
| Code: |
proc throttled {id} {
global throttled
if {[info exists throttled($id)]} {
if {$throttled($id) >= 3} {
list unset throttled($id)
return 1
} else {
incr $throttled($id)
}
} else {
set throttled($id) 1
}
utimer 3 [list unset throttled($id)]
}
|
I haven't tested this but should work as intended. To make stuff easier you could add a part and sign proc to purge them from the list. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|