############################
### NoAccess.tcl         ###
### Version 1.0          ###
### By Wcc               ###
### wcc@techmonkeys.org  ###
### http://dawg.dynu.com ###
### EFnet #|DAWG|Tcl     ###
############################

############################################################################
### Copyright © 2000 - 2001 |DAWG| Scripting Group. All rights reserved. ###
############################################################################

############################################################################
## This script allows only users with a specified flag to access the bot. ##
############################################################################

##########################################################
## Just load the script, edit the settings, and rehash. ##
##########################################################

#################################################
# Set the flag required to access the bot here. #
#################################################

set noaccess_setting(flag) "+Z"

##############################
# Set the boot message here. #
##############################

set noaccess_setting(bootmsg) "No access."

###############################################
# Broadcast a message when an attempt occurs? #
###############################################

set noaccess_setting(cast) 1

##########################################################################
# Set the message to broadcast (if applicable) here. %hand is the user's #
# handle.                                                                #
##########################################################################

set noaccess_setting(msg) "%hand attempted to connect without access."

####################
# Code begins here #
####################

if {![string match 1.6.* $version]} { putlog "\002NOACCESS:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.x or later." }
if {[info tclversion] < 8.2} { putlog "\002NOACCESS:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." }

bind chjn - * noaccess_chjn

proc noaccess_chjn {bot hand chan flag idx uhost} {
	global noaccess_setting botnet-nick
	if {[matchattr $hand $noaccess_setting(flag)] || $chan != 0 || ![string match [string tolower $bot] [string tolower ${botnet-nick}]]} { return }
	if {$noaccess_setting(cast)} {
		regsub -all -- "%hand" $noaccess_setting(msg) $hand msg
		dccbroadcast $msg
	}
	boot $hand $noaccess_setting(bootmsg)
}
putlog "\002NOACCESS:\002 NoAccess.tcl Version 1.0 by Wcc is loaded."