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.

auto +M -M

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

auto +M -M

Post by .pt »

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
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

# 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
}
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

tks

Post by .pt »

thank u very much ;)
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

one more thing

Post by .pt »

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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Sir_Fz, your responsiveness to requests for completely useless scripts never cease to amaze me ;)
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Re: one more thing

Post by Sir_Fz »

.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 :P
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

random

Post by .pt »

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
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

demond wrote:Sir_Fz, your responsiveness to requests for completely useless scripts never cease to amaze me ;)
Seems this "useless" script is getting more complicated. :P
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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: Select all

 tag when posting logs, code
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

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. :) Could it be he wants to block timed "away" messages?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply