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 

Flood Protection for trigger

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
tuShai
Voice


Joined: 18 Feb 2005
Posts: 9

PostPosted: Wed Aug 27, 2008 7:04 am    Post subject: Flood Protection for trigger Reply with quote

Hi.
I have a little Script here that needs a Spamtrigger but i am not shure where to insert it. Hopefully you can help me with this.
Well, first the Script

Code:
namespace eval rules {
   namespace eval variable {

      variable trigger ".rules"
      variable channel "#channel"
      variable filename "scripts/rules.txt"
      variable method "privmsg"
   }
   bind PUBM - "$::rules::variable::channel $::rules::variable::trigger*" [namespace current]::public
   proc public {nickname hostname handle channel arg} {
      set file [open $::rules::variable::filename r]
      while {![eof $file]} {
         switch $::rules::variable::method {
            privmsg {
               putmsg $nickname [gets $file]
            }
            notice {
               putnotc $nickname [gets $file]   
            }
         }
      }
      close $file
   }
}


and here is an example of an Spamcheck Trigger i would like to use
Maybe you have a better one...
Code:
set inuse 0

proc pub:info {nick host hand chan arg} {
    global inuse

    if { $inuse == 1 } {
    putquick "PRIVMSG $nick :Pls wait 20 Secs. Function is in use"
    return


Thanks to all for helping me
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Wed Aug 27, 2008 8:50 am    Post subject: Reply with quote

Code:
namespace eval rules {
   namespace eval variable {

      variable trigger ".rules"
      variable channel "#channel"
      variable filename "scripts/rules.txt"
      variable method "privmsg"

      variable use "0"
      
      if {![info exists timer]} {
          variable timer ""
      } elseif {$timer != ""} {
          catch {killutimer $timer}
         variable timer ""
      }
      
      variable timeout "20"; # in seconds
      
   }

   bind PUBM - "$::rules::variable::channel $::rules::variable::trigger*" [namespace current]::public

   proc public {nickname hostname handle channel arg} {
      if {$rules::variable::use} {
         putserv "$rules::variable::method $nickname :Function in use, please try again in around 20 seconds."
      } else {
         set rules::variable::use "1"
         set rules::variable::timer [utimer $rules::variable::timeout [list set rules::variable::use "0"]]
         set file [open $rules::variable::filename r]
         set data [read -nonewline $file]
         close $file
         if {[llength $data] < 1} {
            putserv "$rules::variable::method $nickname :There are no rules..."
         } else {
            foreach line [split $data \n] {
               if {$line == ""} { continue }
               putserv "$rules::variable::method $nickname :$line"
            }
         }
      }
   }
   
}


Untested
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Fraud
Op


Joined: 19 May 2008
Posts: 101

PostPosted: Thu Aug 28, 2008 7:24 am    Post subject: Reply with quote

Works good for me.

One more change if its possible. Can u change this

putserv "$rules::variable::method $nickname :Function in use, please try again in around 20 seconds."

in a notice message?
Thanks
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Thu Aug 28, 2008 10:27 am    Post subject: Reply with quote

change:

Code:
variable method "privmsg"


to

Code:
variable method "notice"

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Fraud
Op


Joined: 19 May 2008
Posts: 101

PostPosted: Thu Aug 28, 2008 5:51 pm    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message
tuShai
Voice


Joined: 18 Feb 2005
Posts: 9

PostPosted: Sat Aug 30, 2008 7:49 am    Post subject: Reply with quote

Japp all can write too

Thanks a lot
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 Requests 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