This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Takeover Protection.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Takeover Protection.

Post by samhain »

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.
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

I suppose you could take advantage of the old tried and true "throttle" proc with some tweaks:

Code: Select all

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.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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: Select all

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: Select all

    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: Select all

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.
Post Reply