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.

AMXBans bot

Support & discussion of released scripts, and announcements of new releases.
Post Reply
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

AMXBans bot

Post by anotheregglover »

I found one plugin what has only search function in it, But I realy wanna see a plugin what automaticly say when some1 got banned, like automaticly check db for new entrys I dont realy need that search function in it, only when some1 got ban in server then its says automaticly who banned, why banned, what Ip was banned and reason, nothing more

Code: Select all

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++   __ __     ______              __                  __      ____    
# ++  _\ \\ \__ /\  _  \            /\ \               /'_ `\   /'___\   
# ++ /\__  _  _\\ \ \L\ \    ___    \_\ \  _ __    __ /\ \L\ \ /\ \__/   
# ++ \/_L\ \\ \L_\ \  __ \ /' _ `\  /'_` \/\`'__\/'__`\/_> _ <_\ \  _``\ 
# ++   /\_   _  _\\ \ \/\ \/\ \/\ \/\ \L\ \ \ \//\  __/ /\ \L\ \\ \ \L\ \
# ++   \/_/\_\\_\/ \ \_\ \_\ \_\ \_\ \___,_\ \_\\ \____\\ \____/ \ \____/
# ++      \/_//_/   \/_/\/_/\/_/\/_/\/__,_ /\/_/ \/____/ \/___/   \/___/ 
# ++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++ Release:    | AMXBans
# ++ Author:     | ? 'Andre86' ?
# ++ Version:    | 1.0
# ++ Irc:        | #Andre86
# ++ Web:        | http://www.Andre86.de
# ++ eMail:      | Info@andre86.de
# ++ System:     | Eggdrop v1.6.17 - tcl/tk v8.4.9
# ++
# ++ Find bugs?  | #Andre86 at Quakenet
# ++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++
# ++
# ++ Changelog:
# ++
# ++ [17/09/06] - released
# ++ [17/09/06] - bugs fixed
# ++ [17/09/06] - search changed and splittet to: ban, banhistory
# ++
# ++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++
# ++
# ++ installation (MySQL-TCL | (actually version 3.02)):
# ++
# ++
# ++ [on APT-Systems]
# ++
# ++ apt-get install mysqltcl
# ++
# ++
# ++ [on Other-Systems]
# ++
# ++ cd /opt
# ++ wget http://www.xdobry.de/mysqltcl/mysqltcl-3.02.tar.gz
# ++ gunzip -c mysqltcl-3.02.tar.gz | tar xf -
# ++ cd mysqltcl-3.02
# ++ ./configure
# ++ make
# ++ make install
# ++
# ++ For more information(s) to MySQL-TCL -> visit http://www.xdobry.de/mysqltcl/
# ++
# ++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++
# ++
# ++ Special thanks to:
# ++
# ++ [Helper] - Julian 'PLUGIN' K. (#myplugin @qnet ::: www.myplugin.de)
# ++ [Helper] - ? 'Metzger/Martines' ? (#Sec2 @qnet ::: No Website)
# ++
# ++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++
# ++
# ++ This program is free software; you can redistribute it and/or modify
# ++ it under the terms of the GNU General Public License as published by
# ++ the Free Software Foundation; either version 2 of the License, or
# ++ (at your option) any later version.
# ++
# ++ This program is distributed in the hope that it will be useful,
# ++ but WITHOUT ANY WARRANTY; without even the implied warranty of
# ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# ++ GNU General Public License for more details.
# ++
# ++ You should have received a copy of the GNU General Public License
# ++ along with this program; if not, write to the Free Software
# ++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    
# ++
# ++ Disclaimer:
# ++   This Script is under the GPL LICENCE.
# ++   For more information see the accompanying gpl.txt or (if missing or false)
# ++   http://www.gnu.org/licenses/gpl.txt
# ++
# ++
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


# ++  | Package(s) Required

	package require mysqltcl


# ++  | Configuration

	set amxbans(trigger) "\$"

	set sql(host) "localhost"
	set sql(user) "root"
	set sql(pass) ""
	set sql(db) "xma"

	set amxbans(name) "AMXBans"
	set amxbans(author) "Andre86"
	set amxbans(build) "20060917"
	set amxbans(version) "1.0"
	set amxbans(ident) "(c)2006 by: Andre86 \[www.Andre86.de - #Andre86 at Quakenet\]"


# ++  | Copyright

	putlog "|--> $amxbans(name) - Version: $amxbans(version)/$amxbans(build) - $amxbans(ident) successfully loaded !!!!"




# ++  | Source
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | NOW don't change anything, if you aren't 100% sure what you are doing!
# ++  | Source




	bind pub -|-	 	"$amxbans(trigger)amxversion" 	amxx:version
	bind pub -|-		"$amxbans(trigger)amxhilfe" 	amxx:hilfe
	bind pub -|-		"$amxbans(trigger)amxhelp" 	amxx:help

	bind pub -|-		"$amxbans(trigger)amxban"	amxx:db:ban
	bind pub -|-		"$amxbans(trigger)amxhis"	amxx:db:banhis




	#######################################
	############ Version/Help #############
	#######################################

		proc amxx:version {nick host hand chan arg} {
			putquick "NOTICE $nick :(AMXBans) $::amxbans(name) - Version: $::amxbans(version)/$::amxbans(build) - $::amxbans(ident)"
		}

		proc amxx:hilfe {nick host hand chan arg} {
			puthelp "NOTICE $nick :(AMXBans GERMAN) $::amxbans(trigger)amxban <SteamID> | Um nach einer SteamID in der Ban-Datenbank zu suchen"
			puthelp "NOTICE $nick :(AMXBans GERMAN) $::amxbans(trigger)amxhis <SteamID> | Um nach einer SteamID in der History-Datenbank zu suchen"
		}

		proc amxx:help {nick host hand chan arg} {
			puthelp "NOTICE $nick :(AMXBans ENGLISH) $::amxbans(trigger)amxban <SteamID> | To look for a SteamID in the Ban-Database"
			puthelp "NOTICE $nick :(AMXBans ENGLISH) $::amxbans(trigger)amxhis <SteamID> | To look for a SteamID in the History-Database"
		}


	#######################################
	############# Ban Search ##############
	#######################################

		proc amxx:db:ban {nick host hand chan arg} {
						global sql
					set searchid [lindex $arg 0]
						if {![string match "*STEAM_*" $searchid]} {
			putserv "NOTICE $nick :(AMXBans) Wrong syntax! - Type: $::amxbans(trigger)amxban STEAM_x:x:xxxxxx"
					return
				}
					set sql(handle) [mysqlconnect -host $sql(host) -user $sql(user) -password $sql(pass) -db $sql(db)]
					set sma(qry) [mysqlsel $sql(handle) "SELECT bid,player_ip,player_id,player_nick,ban_reason,ban_length FROM amx_bans WHERE player_id = '$arg' OR player_nick = '$arg'" -flatlist]
					mysqlclose $sql(handle)

						if {$sma(qry) != ""} {
					set gelesen(bid) [lindex $sma(qry) 0]
					set gelesen(player_ip) [lindex $sma(qry) 1]
					set gelesen(player_id) [lindex $sma(qry) 2]
					set gelesen(player_nick) [lindex $sma(qry) 3]
					set gelesen(ban_reason) [lindex $sma(qry) 4]
					set gelesen(ban_length) [lrange $sma(qry) 5 end]
			putserv "PRIVMSG $chan :»» SteamID: $gelesen(player_id) \[Ip: $gelesen(player_ip)\] »»» Nickname: $gelesen(player_nick) »»"
			putserv "PRIVMSG $chan :«« Ban ID: $gelesen(bid) ««« Duration: $gelesen(ban_length) ««« Reason: $gelesen(ban_reason) ««"
					} else {
			putserv "PRIVMSG $chan :$arg not found in Ban-Database ..."
			}
		}


	#######################################
	############ Ban History ##############
	#######################################

		proc amxx:db:banhis {nick host hand chan arg} {
						global sql
					set searchid [lindex $arg 0]
						if {![string match "*STEAM_*" $searchid]} {
			putserv "NOTICE $nick :(AMXBans) Wrong syntax! - Type: $::amxbans(trigger)amxhis STEAM_x:x:xxxxxx"
					return
				}
					set sql(handle) [mysqlconnect -host $sql(host) -user $sql(user) -password $sql(pass) -db $sql(db)]
					set sma(qry) [mysqlsel $sql(handle) "SELECT bhid,player_ip,player_id,player_nick,ban_reason,ban_length FROM amx_banhistory WHERE player_id = '$arg' OR player_nick = '$arg'" -flatlist]
					mysqlclose $sql(handle)

						if {$sma(qry) != ""} {
					set gelesen(bhid) [lindex $sma(qry) 0]
					set gelesen(player_ip) [lindex $sma(qry) 1]
					set gelesen(player_id) [lindex $sma(qry) 2]
					set gelesen(player_nick) [lindex $sma(qry) 3]
					set gelesen(ban_reason) [lindex $sma(qry) 4]
					set gelesen(ban_length) [lrange $sma(qry) 5 end]
			putserv "PRIVMSG $chan :»» SteamID: $gelesen(player_id) \[Ip: $gelesen(player_ip)\] »»» Nickname: $gelesen(player_nick) »»"
			putserv "PRIVMSG $chan :«« History ID: $gelesen(bhid) ««« Duration: $gelesen(ban_length) ««« Reason: $gelesen(ban_reason) ««"
					} else {
			putserv "PRIVMSG $chan :$arg not found in History-Database ..."
			}
		}
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Here's a really wild thought, have you contacted the author of this script?
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

emm no :roll:
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

anotheregglover wrote:emm no :roll:
Then please make the effort. Author's include their contact details in documentation for a reason. ;)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

Ok I contacted the author and got hes premision

(20:11:22) (Andre86) Ok, if I continue as a writer, and you are standing there as a modder :)

maybe some1 can help me whit that script? I only want then when some1 got ban in server then its automaticly say who banned, why banned, who got banned, how long. I dont realy need that search function in there.. only autosay when some1 got banned in server.
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

some1? :(
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

no one isnt willing to help at all? :cry:
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Turn on server notices and wallops in your client. You'll see a lot more if you have an o:line.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

I'm noob in this, can you explain me plz :?
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

some1?
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

no one willing to help me :?
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

Code: Select all

bind pub - !find proc:banlist

proc proc:banlist {nick uhost hand chan text} {
        set text [split $text];#
        set mybans [banlist $chan];set matches ""
        if {$mybans != ""} {
                foreach ban $mybans {
		set expire [lindex $ban 2]
		set remain [expr $expire - [unixtime]]
		set reason [lindex $ban 1]
		if {$remain > 0} {
			set remain "expire in [time_diff $expire 0]."
		} {
			set remain "Perm Ban"
		}
                        if {[lsearch -start -6 $ban $text] != -1} {
                                lappend matches "[lindex $ban 0] [lindex $ban 5]"
                        }
                }
                if {$matches != ""} {
                        set i 0
                        puthelp "NOTICE $nick :12Matching bans found: 4 [llength $matches]"
                        foreach match $matches {
                                incr i
                                puthelp "NOTICE $nick :$i: 6[lindex $match 0] 4Banned By: 1[lindex $match 1] 4Expire: 1$remain 4Reason: 1$reason"
                        }
                } else {
                        puthelp "NOTICE $nick :7No bans matching6 [join $text] 7found on channel 4$chan."
                }
        } else {
                puthelp "NOTICE $nick :7No bans for channel 4$chan."
        }
}
but this require lol.tcl.

try.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

I found one plugin what has only search function in it, But I realy wanna see a plugin what automaticly say when some1 got banned, like automaticly check db for new entrys I dont realy need that search function in it, only when some1 got ban in server then its says automaticly who banned, why banned, what Ip was banned and reason, nothing more
Norton, um.. you didn't read the request, specifically this part "I dont realy need that search function". Basically you scavenge other scripts and kludge together a great big mess that doesn't do what was requested. Wow! :roll:

Code: Select all

set text [split $text]
# get rid of this line above, you can't lsearch a list with another list silly..
if {[lsearch -glob $ban $text] != -1} {
# may as well throw -glob in here, since omitting it, it will be assumed.
# Also what in the hell is -start -6?? It's -start 6, no double hypen..
# why even use this? To skip the first 6 bans? starting at lindex 0
# is required in this case.
Not to mention all that improper use of lindex on strings, and other well... strange behavior.

Code: Select all

      if {$remain > 0} {
         set remain "expire in $expire."
      } { 
# now it doesn't require lol tcl no need to timediff the difference between
# 0 and $expire, because it will be the same as just using $expire..gah
<speechles> /dcc chat mybot
<mybot> Enter your password.
<speechles> mypasswordgoeshere
<mybot> Hey speechles! My name is mybot and I am running eggdrop v1.6.17, on CYGWIN_NT-5.1 1.5.18(0.132/4/2).
<speechles> .bans *aol*
<mybot> Global bans:
<mybot> Channel bans for #mychan: (* = not placed by bot)
<mybot> [ 46] *!*sshot@*aol.com (perm) (sticky)
<mybot> Mybuddy: Bot
<mybot> Created 207 days ago, last used 129 days ago
This is more than likely why the fellow doesn't need a find/search function, eggdrop natively has one.

Also, norton, Don't paste control codes embedding them within code tags. Notice all those colors that you wanted to display, the 12, the 4, see them next to that notice $nick just before the lindex? Notice the /003 in front missing (you embed control chars instead) which makes your script look wrong. You should be aware such mistakes create more hassles for users having to clean up your mess...Instead of thinking, I can help this guy. You need to question, should you, as scavenging others scripts isn't coding. You rip off authors this way without giving credit to anyone (yourself perhaps as you posted it.. gah).. Good going.... NOT!
a
anotheregglover
Voice
Posts: 38
Joined: Thu Jan 13, 2005 12:01 am
Contact:

Post by anotheregglover »

Thanks, something like this?

Code: Select all

# ++  | Package(s) Required

	package require mysqltcl


# ++  | Configuration

	set amxbans(trigger) "\$"

	set sql(host) ""
	set sql(user) ""
	set sql(pass) ""
	set sql(db) ""

	set amxbans(name) "AMXBans"
	set amxbans(author) "Andre86"
	set amxbans(build) "20060917"
	set amxbans(version) "1.0"
	set amxbans(ident) "(c)2006 by: Andre86 \[www.Andre86.de - #Andre86 at Quakenet\]"


# ++  | Copyright

	putlog "|--> $amxbans(name) - Version: $amxbans(version)/$amxbans(build) - $amxbans(ident) successfully loaded !!!!"



	bind pub -|-	 	"$amxbans(trigger)amxversion" 	amxx:version
	bind pub -|-		"$amxbans(trigger)amxhilfe" 	amxx:hilfe
	bind pub -|-		"$amxbans(trigger)amxhelp" 	amxx:help

	bind pub -|-		"$amxbans(trigger)amxban"	amxx:db:ban
	bind pub -|-		"$amxbans(trigger)amxhis"	amxx:db:banhis

///----------

bind pub - !find proc:banlist

proc proc:banlist {nick uhost hand chan text} {
        set text [split $text];#
        set mybans [banlist $chan];set matches ""
        if {$mybans != ""} {
                foreach ban $mybans {
      set expire [lindex $ban 2]
      set remain [expr $expire - [unixtime]]
      set reason [lindex $ban 1]
      if {$remain > 0} { 
         set remain "expire in $expire." 
      } {
         set remain "Perm Ban"
      }
                        if {[lsearch -start 0 $ban $text] != -1} {
                                lappend matches "[lindex $ban 0] [lindex $ban 5]"
                        }
                }
                if {$matches != ""} {
                        set i 0
                        puthelp "NOTICE $nick :12Matching bans found: 4 [llength $matches]"
                        foreach match $matches {
                                incr i
                                puthelp "NOTICE $nick :$i: 6[lindex $match 0] 4Banned By: 1[lindex $match 1] 4Expire: 1$remain 4Reason: 1$reason"
                        }
                } else {
                        puthelp "NOTICE $nick :7No bans matching6 [join $text] 7found on channel 4$chan."
                }
        } else {
                puthelp "NOTICE $nick :7No bans for channel 4$chan."
        }
}
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

bind pub - !find proc:banlist 

proc proc:banlist {nick uhost hand chan text} {
	set text [lindex [split $text] 0]
	set mybans [banlist $chan]
	if {[llength $mybans] > 0} {
		set matches {}
		foreach ban $mybans {
			if {[string match -nocase $text $ban]} {
				set bann [lindex $ban 0]
				set banby [lindex $ban 5]
				set remain [expr [lindex $ban 2] - [unixtime]]
				set reason [lindex $ban 1]
				if {$remain > 0} {
					set remain "in [duration $remain]."
				} {
					set remain "Never."
				}
				lappend matches [list "$bann" "$banby" "$remain" "$reason"]
			}
		}
		if {[llength $matches] > 0} {
			set i 1
			puthelp "NOTICE $nick :\002Matching bans\002: \037[llength $matches]\037 for $text on $chan:"
			foreach match $matches {
				puthelp "NOTICE $nick :\002$i\002\) [lindex $match 0] \002By:\002 [lindex $match 1] \002Expires:\002 [lindex $match 2] \002Reason:\002 [lindex $match 3]"
				incr i
			}
		} else {
			puthelp "NOTICE $nick :There are \002no bans\002 matching \037$text\037 found on $chan."
		}
	} else {
		puthelp "NOTICE $nick :There are \002no bans\002 placed for $chan. I cannot search for \037$text\037."
	}
}
This is the correct code to list all the bans existing on eggdrop using the trigger !find <ban>. Using *!*@* in place of <ban>, will find all of them for that channel of course. Wildcards of any sort are acceptable.

But...This isn't at all what you wanted, but here it is correctly portrayed none the less. Use this as an example of how to search bans, it won't display them as they happen. Hopefully someone can give you proper advice concerning your original issue.

It might involve sometype of cross-talk between the website and the bot (a php script or similar to send bans to the bot, and a similar script on the bot to detect these) to have it report bans immediately. But you can also script a timer, to periodically check for new bans and display that information at regular intervals, similar to how rss scripts display news.
Post Reply