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 

question

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
l.kleijn
Voice


Joined: 18 May 2014
Posts: 33

PostPosted: Sat May 28, 2022 3:20 am    Post subject: question Reply with quote

Hi i have a little script and need some help with it.

Code:
proc pub:global {nick host hand chan arg} {
  global botnick opchan
  if {[matchattr $hand G] == 1} {
     if {$chan == "#IRCop"} {
        return 0
     }
     foreach chan [channels] { putserv "PRIVMSG $chan :\002AANKONDIGING:\002 $nick: $arg" }
     return 0
  } else { putserv "NOTICE $nick :U hebt geen toegang." }
}


I want some help with it, if the channel is #IRCop it must say nothing.
Except other channels how do i change that ?
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Sat May 28, 2022 10:59 am    Post subject: Reply with quote

The simplest way imho is to add a flag to the channels to enable/disable the feature.

Now, I'm not sure to understand the query: do you want to disallow the usage of the pub command in channels or do you want to forbid the display of the message in channels ?

To block the command on channels:
Code:
setudef flag nopub
proc pub:global {nick uhost handle chan text} {
   if {[matchattr $hand G]} {
      if {[channel get $chan nopub]} { return }
      foreach c [channels] {
         putserv "PRIVMSG $c :\002AANKONDIGING:\002 $nick: $text"
      }
   } else {
      putserv "NOTICE $nick :U hebt geen toegang."
   }
}


To block the display of the message in channels:
Code:
setudef flag nopub
proc pub:global {nick uhost handle chan text} {
   if {[matchattr $hand G]} {
      if {[string tolower $chan] eq "#ircop"} { return }
      foreach c [channels] {
         if {[channel get $c nopub]} { continue }
         putserv "PRIVMSG $c :\002AANKONDIGING:\002 $nick: $text"
      }
   } else {
      putserv "NOTICE $nick :U hebt geen toegang."
   }
}


And in the two case, you have to do .chanset #channel +nopub to forbid the usage or the display on #channel.
Note that the second script disallow the command in #ircop in any case
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
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 -> Scripting Help 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