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 

random kick

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Thu Aug 09, 2007 8:25 am    Post subject: random kick Reply with quote

How can i fix it so it won't kick owners or bots?

Code:

bind pub - !random text:attack

proc text:attack {nick uhost hand chan text} {
  set nicks [chanlist $chan]
  set randnick [lindex $nicks [rand [llength $nicks]]]
   putserv "KICK $chan $randnick :Bitchowned by $nick!"
}
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Aug 09, 2007 8:38 am    Post subject: Reply with quote

Something like this (not tested):
Code:
proc text:attack {nick uhost hand chan text} {
   # 1) generate list of nicks than can be kicked
   set victims [list]
   foreach possibleVictim [chanlist $chan] {
      if {![isbotnick $possibleVictim]&&![matchattr [nick2hand $possibleVictim] bfmno|bfmno $chan]} {
         lappend victims $possibleVictim
      }
   }
   # 2) kick (unless the list is empty)
   if {[llength $victims]} {
      set victim [lindex $victims [rand [llength $victims]]]
      putserv "KICK $chan $victim :Bitchowned by $nick!"
   } else {
      putserv "PRIVMSG $chan :No suitable victims at the moment."
   }
}

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Thu Aug 09, 2007 7:04 pm    Post subject: Reply with quote

Okay people flooding my bot, how can i set it to ignore it for 30mins and if any one does !random with in that time they will get banned for 2 3 mins.
Back to top
View user's profile Send private message
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Thu Aug 09, 2007 8:05 pm    Post subject: Reply with quote

why don't you just bind the public command to a flag, such as +f. That way only your friends can use it.
_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Sun Aug 12, 2007 10:27 am    Post subject: Reply with quote

Nvm, i got it. Razz
Back to top
View user's profile Send private message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Mon Aug 13, 2007 8:52 am    Post subject: Reply with quote

How can i add a counter for this, i want it o look like this when i type: !randtstats

<eggdrop> [Total] all [Lost] lost [Bitchowns] allowned [Success] % of winning
<eggdrop> [Last Own] Nick bitchowned Randnick.

Code:

set norand off

bind pub - !random random:kick

proc random:kick {nick uhost hand chan text} {
  global norand
  set banmask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
  set victims [list]
  foreach possibleVictim [chanlist $chan] {
    if {![isbotnick $possibleVictim]&&![matchattr [nick2hand $possibleVictim] bn|nb $chan]} {
      lappend victims $possibleVictim
    }
  }
  if {[llength $victims] && ($norand == off)} {
    set victim [lindex $victims [rand [llength $victims]]]
    putserv "KICK $chan $victim :Bitchowned by $nick!"
    set norand on
    timer 30 "set norand off"
    } else {
    putserv "MODE $chan +b :$banmask"
    putserv "KICK $chan $nick :You lost!"
    utimer 30 [list putserv "MODE $chan -b $banmask"]
  }
}
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 -> Scripting Help 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