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 

auto +M -M

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


Joined: 16 Nov 2005
Posts: 71

PostPosted: Wed Nov 16, 2005 2:05 pm    Post subject: auto +M -M Reply with quote

i would need a script to put the mode +m on a chan when the channel is "x" time idle and remove it when noone talks in "x" time if the channel have just a certain number of ops, ou with a opcion on not detecting some flags like other bots so it doesnt put +M or -M when theres ops around
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Nov 16, 2005 5:05 pm    Post subject: Reply with quote

Code:
# What channel?
set lIdle(chan) "#yourchan"

# Lock after how many idle minutes?
set lIdle(itime) 30

# Unlock afte how many idle minutes?
set lIdle(iultime) 30

# Unlock only if the number of ops is less than: (including bot)
set lIdle(nops) 4

# Check for idle every x minutes.
set lIdle(citime) 10

if {[timerexists check:idle]==""} {
 timer $lIdle(citime) "check:idle"
}

set lIdle(rtime) [unixtime]

bind pubm - "$lIdle(chan) *" idle:rec

proc idle:rec {nick uhost hand chan arg} {
 global lIdle
 if {![matchattr $hand f|f $chan]} {
  set lIdle(rtime) [unixtime]
 }
}

proc check:idle {} {
 global lIdle
 if {([unixtime]-$lIdle(rtime))/60 >= $lIdle(itime) && ![string match *m* [lindex [split [getchanmode $lIdle(chan)]] 0]]} {
  pushmode $lIdle(chan) +m
  set lIdle(lchan) 1
 } elseif {([unixtime]-$lIdle(rtime))/60 >= $lIdle(iultime) && [string match *m* [lindex [split [getchanmode $lIdle(chan)]] 0]] && [getopnum] < $lIdle(nops)} {
  pushmode $lIdle(chan) -m
 }
 timer $lIdle(citime) "check:idle"
}

proc getopnum {} {
 global lIdle
 set i 0
 foreach user [chanlist $lIdle(chan)] {
  if {[isop $user $lIdle(chan)]} {
   incr i
  }
 }
 set i
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Wed Nov 16, 2005 8:01 pm    Post subject: tks Reply with quote

thank u very much Wink
Back to top
View user's profile Send private message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Wed Nov 16, 2005 9:24 pm    Post subject: one more thing Reply with quote

sorry but one more thing if i wanted to put a random number between two number to unlock what should i change, sorry to bother so much
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Wed Nov 16, 2005 11:41 pm    Post subject: Reply with quote

Sir_Fz, your responsiveness to requests for completely useless scripts never cease to amaze me Wink
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Nov 17, 2005 6:49 pm    Post subject: Re: one more thing Reply with quote

.pt wrote:
sorry but one more thing if i wanted to put a random number between two number to unlock what should i change, sorry to bother so much

Didn't understand.
demon wrote:
Sir_Fz, your responsiveness to requests for completely useless scripts never cease to amaze me Wink

I was in the mood Razz
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Thu Nov 17, 2005 7:57 pm    Post subject: random Reply with quote

like this

set bla (10,25)

or

set bla1 10
set bla2 25


instead of the 30 timer for unlock, it will choose a random name between those two
Back to top
View user's profile Send private message
Alchera
Revered One


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

PostPosted: Thu Nov 17, 2005 11:03 pm    Post subject: Reply with quote

demond wrote:
Sir_Fz, your responsiveness to requests for completely useless scripts never cease to amaze me Wink

Seems this "useless" script is getting more complicated. Razz
_________________
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
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Nov 18, 2005 1:53 am    Post subject: Reply with quote

well, maybe for that guy for some weird reason it's useful, but setting +m on idle channel sounds completely pointless to me; +m is supposed to be used for flood protection and moderating
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Alchera
Revered One


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

PostPosted: Fri Nov 18, 2005 2:48 am    Post subject: Reply with quote

demond wrote:
well, maybe for that guy for some weird reason it's useful, but setting +m on idle channel sounds completely pointless to me; +m is supposed to be used for flood protection and moderating

I couldn't agree more. Smile Could it be he wants to block timed "away" messages?
_________________
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
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