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.

random kick

Help for those learning Tcl or writing their own scripts.
Post Reply
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

random kick

Post by sdays »

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

Code: Select all

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!"
}
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Something like this (not tested):

Code: Select all

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"?
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

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.
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

why don't you just bind the public command to a flag, such as +f. That way only your friends can use it.
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

Nvm, i got it. :P
s
sdays
Halfop
Posts: 98
Joined: Sat Oct 21, 2006 4:46 am

Post by sdays »

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

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"]
  }
}
Post Reply