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 

AMXBans bot

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Thu Mar 20, 2008 11:33 am    Post subject: AMXBans bot Reply with quote

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:
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++   __ __     ______              __                  __      ____   
# ++  _\ \\ \__ /\  _  \            /\ \               /'_ `\   /'___\   
# ++ /\__  _  _\\ \ \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 ..."
         }
      }
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Thu Mar 20, 2008 12:12 pm    Post subject: Reply with quote

Here's a really wild thought, have you contacted the author of this script?
Back to top
View user's profile Send private message
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Tue Mar 25, 2008 4:32 am    Post subject: Reply with quote

emm no Rolling Eyes
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Mar 28, 2008 8:29 pm    Post subject: Reply with quote

anotheregglover wrote:
emm no Rolling Eyes

Then please make the effort. Author's include their contact details in documentation for a reason. Wink
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Sun Mar 30, 2008 1:16 pm    Post subject: Reply with quote

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 Smile

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.
Back to top
View user's profile Send private message
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Sun Apr 06, 2008 12:43 pm    Post subject: Reply with quote

some1? Sad
Back to top
View user's profile Send private message
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Thu Apr 24, 2008 3:26 am    Post subject: Reply with quote

no one isnt willing to help at all? Crying or Very sad
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Apr 28, 2008 9:34 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Thu May 22, 2008 4:19 pm    Post subject: Reply with quote

I'm noob in this, can you explain me plz Confused
Back to top
View user's profile Send private message
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Thu Jun 05, 2008 9:09 am    Post subject: Reply with quote

some1?
Back to top
View user's profile Send private message
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Sun Jun 29, 2008 2:06 pm    Post subject: Reply with quote

no one willing to help me Confused
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Mon Jun 30, 2008 10:52 am    Post subject: Reply with quote

Code:

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.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jun 30, 2008 11:00 am    Post subject: Reply with quote

Quote:
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! Rolling Eyes
Code:
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:
      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

Quote:
<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!
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
anotheregglover
Voice


Joined: 13 Jan 2005
Posts: 38

PostPosted: Mon Jul 07, 2008 11:40 am    Post subject: Reply with quote

Thanks, something like this?

Code:

# ++  | 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."
        }
}
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jul 07, 2008 4:37 pm    Post subject: Reply with quote

Code:
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.
_________________
speechles' eggdrop tcl archive
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 -> Script Support & Releases 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