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.

question

Help for those learning Tcl or writing their own scripts.
Post Reply
l
l.kleijn
Voice
Posts: 33
Joined: Sun May 18, 2014 10:02 am

question

Post by l.kleijn »

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

Code: Select all

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 ?
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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

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

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
Post Reply