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.

How to msg a $list ?

Old posts that have not been replied to for several years.
Locked
R
Real
Voice
Posts: 24
Joined: Mon Mar 08, 2004 11:27 am

How to msg a $list ?

Post by Real »

Code: Select all

proc pub_admin {nick host hand chan arg} { 
    foreach user [chanlist $chan] { 
      if {[isop $user $chan]} { 
        if {[info exists list]} { 
          append list " $user" 
        } else { 
          set list "$user" 
        } 
        
      } 
    } 
    putserv "PRIVMSG $chan : $list, $nick called for an admin!" 
  } 
Hi, this is the current code I have.
This lets anyone use !admin, so that everybody with op will get higlighted in the channel. (every op-nick is stored in $list )

But my problem is, is there also a way to send everyone a pm, instead of a channel higlight?
So everyone who is in $list, should receive a privmsg, is this possible? :)

Lots of thanks if you can help me here :)
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Code: Select all

foreach admin $list { 
  putserv "PRIVMSG $admin : $nick called for an admin!"
}
You might have to split up the list using 'split' (doh) :o
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Also, you should check The Manual for the difference between append and lappend.
Once the game is over, the king and the pawn go back in the same box.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

or instead, after your "isop" test, put the line:

Code: Select all

puthelp "PRIVMSG $user :$nick is requesting an admin"
Would be more efficient than looping twice...
d
dollar
Op
Posts: 178
Joined: Tue Oct 28, 2003 3:47 pm
Location: Netherlands

Post by dollar »

gb wrote:

Code: Select all

foreach admin $list { 
  putserv "PRIVMSG $admin : $nick called for an admin!"
}
You might have to split up the list using 'split' (doh) :o
Split a list? Split is for making lists out of strings...

[edit]typo, if => is[/edit]
Last edited by dollar on Thu Jun 03, 2004 9:38 am, edited 1 time in total.
dollar (or something similar) at:
#eggdrop / #tcl - undernet
#egghelp / #tcl / #eggtcl - efnet
#eggdrop.support / #tcl - quakenet
#eggdrop - ircnet
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

you still have to split it up somehow , or it will just spit out the entire list on the first time in that foreach
p
puffi
Voice
Posts: 25
Joined: Tue Jun 01, 2004 10:09 am

Post by puffi »

Further on $list is a string, as he uses append and not lappend :P So splitting a string is quite ok with me :wink:
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

either way, redundant to loop twice...
Locked