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.

autorejoin script problem.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
d
darkwingduck
Voice
Posts: 5
Joined: Sat Jun 16, 2007 8:49 am

autorejoin script problem.

Post by darkwingduck »

hello,
i use this script but the script works only with global flags for this option:
# do not ban users with this flag on the bot

i need global or channel flags.
I have test it with
set dontban "Z|Z"

but this dont work :(

can everyone help me?

Code: Select all

# This script bans users which joins a given channel within 5 seconds
# after getting kicked, for 5 minutes. Made for eggdrop v1.1
#
# V1.1c, written by Anders Nordby aka. nickerne (anders@fix.no)
# 
# 1.0a: Small bugfix.
# 1.0b: Included flag-based exception from banning.
# 1.0c: Registering channel-bans was a stupid thing. Speeded things up a
#       little. Also made the flag-based ban-exception host specific (instead
#       of nick specific). And some other changes, like the nick/host flag.
# 1.1:  Several fixes:
#
#       * maximum one kick for autorejoining, if the ban fails.
#       * fixed bug with 10 characters in the username (ban failed)
#       * added multichannel option
#       * bans with the same hostname won't be cleared more than once
# 1.1b: Users with the dontban-flag on the bot got kicked if they had the
#       wrong nick. Fixed.
# 1.1c: Fixed problems with people using nicks having troublesome characters.

# delay before users can join the channel after a kick (in seconds)
set joindelay 5
# the bans will be removed after this delay (in minutes)
set bantime 3
# 0=work on one channel only, 1=multichannel (overrides channel-setting)
set multichannel 1
# the channel you wish this script to work on
set channel ""
# do not ban users with this flag on the bot
set dontban "Z"
# 1=nick&host-specific bans, 0=host-specific bans
set nickban 1

bind kick - * autorejoin_ban
# bind join - * autorejoin_ban
proc autorejoin_ban {nick uhost hand chan knick reason} {
    global joindelay channel multichannel

    if {![expr [lsearch -glob [utimers] "*nada $knick $chan*"] + 1]} {
       if {$multichannel} {
	  utimer $joindelay [subst {kickban_when_autorejoined $knick $chan}]
       } else {
	  if {$chan == $channel} {
	     utimer $joindelay [subst {kickban_when_autorejoined {$knick} $chan}]
	  }
       }
    }
}

proc kickban_when_autorejoined {nick chan} {
    global bantime dontban nickban joindelay



    if {[onchan $nick $chan]} {
	if {[matchattr [nick2hand $nick $chan] $dontban]} {
#	putserv "PRIVMSG $chan :$nick will not be banned, of course, as he has +$dontban."
	} else {

# hostmasking:
	    append userhost $nick "!" [getchanhost $nick $chan]
	    set hostmask [maskhost $userhost]
	    if {[string first @ $hostmask]<12} {
		set hostmask "*!*[string range $hostmask 2 [string length $hostmask]]"
	    }

# insert nick for nickban:
	    if {$nickban} { set hostmask "*$nick$hostmask"}

# performance:
	    putserv "MODE $chan +b $hostmask"
	    utimer [expr 3 * $joindelay] [subst {nada $nick $chan}]
            putserv "KICK $chan $nick :You autorejoined after getting kicked. Not that smart indeed."

if {![expr [lsearch -glob [utimers] "*MODE $chan -b $hostmask*"] + 1]} {
    utimer [expr 60 * $bantime] [subst {putserv "MODE $chan -b $hostmask"}]
}

	    putserv "notice $nick :Somebody kicked you, and you autorejoined. $bantime minutes in the corner! Turn off autorejoin!"
	}
    }
}

proc nada {nick chan} { }

putlog "NO! autorejoin v1.1c by nickerne"
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Replace

Code: Select all

if {[matchattr [nick2hand $nick $chan] $dontban]} {
with

Code: Select all

if {[matchattr [nick2hand $nick $chan] $dontban $chan]} {
Post Reply