[SOLVED] Public Command List Channel Members

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Locked
g
gamer12
Voice
Posts: 10
Joined: Tue Aug 14, 2012 6:58 pm

[SOLVED] Public Command List Channel Members

Post by gamer12 »

aaa

Edit: Original request for a script which lists members of a channel on public command. This thread is now locked. Sir_FZ
Last edited by gamer12 on Mon Sep 17, 2012 1:36 pm, edited 2 times in total.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Someone wrote this script for me a while ago:

Code: Select all

bind pub o|o .call call:proc 

proc call:proc {nick uhost hand chan arg} {
  global botnick
# check if user has access to bot or not
  set nicklist [chanlist $chan]
# removing botnick from list
  set notbot [lsearch $nicklist $botnick]
  set nicklist [lreplace $nicklist $notbot $notbot]
# removing nickname that triggered event
  set notnick [lsearch $nicklist $nick]
  set nicklist [lreplace $nicklist $notnick $notnick]
  puthelp "PRIVMSG $chan :$nicklist"
  puthelp "PRIVMSG $chan :>>>>> \0030,4$arg\003"
}
Idling at #Football, Quakenet.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Here's a better version, one that the bot won't flood itself off while trying to paste the entire list of channel members.

Code: Select all

bind pub o|o !call pub:call

proc pub:call {nick uhost hand chan text} {
	# create the list with channel users (not bot's user's)
	set chanList [chanlist $chan]
	
	# remove botnick from list 
	set pos [lsearch -nocase $chanList $::botnick]
	set chanList [lreplace $chanList $pos $pos] 
	
	# paste 25 (or how many you wish) nicks per line
	while {[llength $chanList] != 0} {
		puthelp "PRIVMSG $chan :[join [lrange $chanList 0 25]]"
		set chanList [lrange $chanList 25 end]
	}
}
Once the game is over, the king and the pawn go back in the same box.
g
gamer12
Voice
Posts: 10
Joined: Tue Aug 14, 2012 6:58 pm

Post by gamer12 »

thanks alot both of you!
Locked