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 

timed unset of a channel mode and kill timer if running

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Sep 28, 2020 2:27 pm    Post subject: timed unset of a channel mode and kill timer if running Reply with quote

hey there,
i was curious how this code that was checking for ban +b m:*!*@* could be modified we actually wanted to check for channel mode +U and -U
if +U is set we wanted to have a timer remove it after 20 min
and if some chanops unsets it #channel -U before the timer has expired to kill the timer



Code:

bind mode - "#% +b" runban
bind mode - "#% -b" stopban

proc runban {nick uhost handle chan mode target} {
   if {[string match -nocase m:*!*@* $target]} {
      set ::btimer($chan) [list [timer 20 [list rmban $chan]]]
   }
}

proc stopban {nick uhost handle chan mode target} {
   if {[string match -nocase m:*!*@* $target]} {
      rmban $chan
   }
}

proc rmban {chan} {
   if { [array exists ::btimer] && [info exists ::btimer($chan)] } {
      if { [lsearch -index 2 [timers] $::btimer($chan)] != -1} {
         killtimer $::btimer($chan)
      }
      unset ::btimer($chan)
   }
   if { [ischanban m:*!*@* $chan] } {
      pushmode $chan -b m:*!*@*
   }
}



and instead of pushmode we wanted to use a regular mode used
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Sep 28, 2020 5:25 pm    Post subject: Reply with quote

so basically if channel mode +U has been set to have a timer unset it in 20 minutes but if a chanop or anything else unsets it manually -U to halt the timer as its no longer needed
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Sep 28, 2020 5:42 pm    Post subject: Reply with quote

i tried this but it didnt react as it prob doesnt recognize the channel mode +U
-U


Code:

bind mode - "#% +U" runbanX5
bind mode - "#% -U" stopbanX5

proc runbanX5 {nick uhost handle chan mode target} {
      if {[string first U [getchanmode $target]] ne "-1"} {   
      set ::btimer($chan) [list [timer 20 [list rmbanX5 $chan]]]
   }
}

proc stopbanX5 {nick uhost handle chan mode target} {
      if {[string first U [getchanmode $target]] ne "-1"} {   
      rmbanX5 $chan
   }
}

 

proc rmbanX5 {chan} {
   if { [array exists ::btimer] && [info exists ::btimer($chan)] } {
      if { [lsearch -index 2 [timers] $::btimer($chan)] != -1} {
         killtimer $::btimer($chan)
      }
      unset ::btimer($chan)
   }
      if {[string first U [getchanmode $chan]] ne "-1"} {   
     putnow "mode $chan -U" 
     }
}
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Oct 05, 2020 9:08 am    Post subject: Reply with quote

Is there any way to achieve this?
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