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 

a users dysplay script

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
K
Voice


Joined: 28 Jan 2004
Posts: 34
Location: Romania @sibiu

PostPosted: Sat May 01, 2004 8:24 am    Post subject: a users dysplay script Reply with quote

i got this script! that dysplays masters and owners! but it is a a little dificult and i chan change it to dysplay onlu owners and voices if somebody could give me a hint
Code:
# do you want the bot to make a differance between owners & masters?
set display_owners 1

# set here the trigger for flood
set masters_flood 1:20

bind pub - !masters pub_masters

# -- don't edit below unless you know what you are doing --

proc pub_masters {nick uhost hand channel args} {

   # detect flood
   if {[masters_detectflood]} {
      putcmdlog "<$nick@$channel> !$hand! masters (flood... not answering!)"
      putserv "NOTICE $nick :don't flood the bots"
      return 0
   }

   # Initializing variables
   global botnick display_owners
   set count_owners 0
   set count_owners_on 0
   set count_masters 0
   set count_masters_on 0
   set owners ""
   set owners_on ""
   set masters ""
   set masters_on ""

   # finding all owners in userlist if 'display_owners' setting is set to 1
   if { $display_owners } {
      foreach user [userlist] {
         if [matchattr $user n $channel] {
            set owners [string trim "$owners, $user" ", "]
            incr count_owners 1
         }
      }
      if {[string length $owners] > 0} {
         putchan $channel "$count_owners owner(s) of the bots: $owners."
      }
   }

   # finding all masters in userlist
   foreach user [userlist] {
      if [matchattr $user m|m $channel] {
         if { (![matchattr $user n]) || ($display_owners == 0) } {
            set masters [string trim "$masters, $user" ", "]
            incr count_masters 1
         }
      }
   }
   if {[string length $masters] > 0} {
      putchan $channel "$count_masters master(s) defined for $channel: $masters."
   } else {
      putchan $channel "There are currently no masters defined for $channel."
   }

   # displaying owners that are on if 'display_owners' setting is set to 1
   if { $display_owners } {
      foreach owner_on [chanlist $channel n] {
         set owners_on [string trim "$owners_on, $owner_on" ", "]
         incr count_owners_on 1
      }
      if {[string length $owners_on] > 0} {
         putchan $channel "Wohoo, $count_owners_on owner(s) of the bots currently on: $owners_on."
      }
   }

   # displaying masters that are on
   foreach master_on [chanlist $channel m] {
      if { (![matchattr $master_on n]) || ($display_owners == 0) } {
         set masters_on [string trim "$masters_on, $master_on" ", "]
         incr count_masters_on 1
      }
   }
   if {[string length $masters_on] > 0} {
      putchan $channel "$count_masters_on master(s) currently on: $masters_on."
   } else {
      putchan $channel "There are currently no masters on $channel."
   }
}

# Avoids flooding
proc masters_detectflood { } {
        global masters_flood
        global masters_floodtrigger
        set thr [lindex [split $masters_flood ":"] 0]
        set lapse [lindex [split $masters_flood ":"] 1]
        if {$thr == "" || $thr == 0} { return 0 }
        if {![info exist masters_floodtrigger]} {
                # First time called
                set masters_floodtrigger [list [unixtime] 1]
                return 0
        }
        if {[expr [lindex $masters_floodtrigger 0] + $lapse] <= [unixtime]} {
                # Trigger time has passed, reset counter
                set masters_floodtrigger [list [unixtime] 1]
                return 0
        }
        set lasttime [lindex $masters_floodtrigger 0]
        set times [lindex $masters_floodtrigger 1]
        if {$times >= $thr} {
                # Flood!
                return 1
        }
        set masters_floodtrigger [list $lasttime [expr $times + 1]]
        return 0
}




thx
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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