egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Takeover Protection.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Tue Sep 06, 2011 3:57 am    Post subject: Takeover Protection. Reply with quote

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
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Wed Sep 07, 2011 3:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Sep 08, 2011 1:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber