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.

generate a list of users with certain flag.

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

generate a list of users with certain flag.

Post by Nor7on »

hi a lot.

have a script that put chattr +T $chan.

so, can helpme with a code for generate a list only with flags +T in my channel. (can be added an accountant of minutes?)

maybe add other proc more with this functions.

ex:
if have 3 users with flag with +T. (user1, testuser, usertest)
!list
eggdrop say via notice: there are in the chan 3 users with +T, are: User1 (20min) - testuser (2hours 7min) - usertest (45seg).

the times are for knowing how long has user with flag +T in the channel.

here paste my code.

Code: Select all

proc pub:flags {nick uhost hand chan text} { 
	global simtemop
   	if {![channel get $chan simtemop]} { return }
	set cnick [lindex [split $text] 0]
		set bnick [nick2hand $cnick]
          if {([string length $text]) > 0} {
			if {([matchattr $bnick "*" $chan])} { 
				if {([onchan $cnick $chan])} {
		  			chattr $cnick |+T $chan
					puthelp "privmsg $chan :Enhorabuena $cnick!! ahora eres Op-Temporal."
				if {([botisop $chan])} {
					putserv "MODE $chan +v $cnick"
					puthelp "notice $cnick :Ahora eres Op-Temporal, porfavor para que veas tus comandos, escribe: !comandos."
			} else {  putserv "privmsg X :voice $chan $cnick" }
			} else {  puthelp "NOTICE $nick :$cnick no se encuentra dentro de $chan." }
			} else {  puthelp "NOTICE $nick :$cnick Ya está como Op-Temporal, quizás no tenga voice, es necesário que lo tenga." }
			} else {  puthelp "NOTICE $nick :Usa !+optemp <nick>" }
}
thanks in advance. :wink:
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Re: generate a list of users with certain flag.

Post by eXtremer »

Nor7on wrote:hi a lot.

have a script that put chattr +T $chan.

so, can helpme with a code for generate a list only with flags +T in my channel. (can be added an accountant of minutes?)

maybe add other proc more with this functions.

ex:
if have 3 users with flag with +T. (user1, testuser, usertest)
!list
eggdrop say via notice: there are in the chan 3 users with +T, are: User1 (20min) - testuser (2hours 7min) - usertest (45seg).

the times are for knowing how long has user with flag +T in the channel.

here paste my code.

Code: Select all

proc pub:flags {nick uhost hand chan text} { 
	global simtemop
   	if {![channel get $chan simtemop]} { return }
	set cnick [lindex [split $text] 0]
		set bnick [nick2hand $cnick]
          if {([string length $text]) > 0} {
			if {([matchattr $bnick "*" $chan])} { 
				if {([onchan $cnick $chan])} {
		  			chattr $cnick |+T $chan
					puthelp "privmsg $chan :Enhorabuena $cnick!! ahora eres Op-Temporal."
				if {([botisop $chan])} {
					putserv "MODE $chan +v $cnick"
					puthelp "notice $cnick :Ahora eres Op-Temporal, porfavor para que veas tus comandos, escribe: !comandos."
			} else {  putserv "privmsg X :voice $chan $cnick" }
			} else {  puthelp "NOTICE $nick :$cnick no se encuentra dentro de $chan." }
			} else {  puthelp "NOTICE $nick :$cnick Ya está como Op-Temporal, quizás no tenga voice, es necesário que lo tenga." }
			} else {  puthelp "NOTICE $nick :Usa !+optemp <nick>" }
}
thanks in advance. :wink:
Usage : .userlist flags <#chan>
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Nor7ton:
First off, you'd have to store a timestamp with the user record whenever T is set... I'd suggest using some XTRA-field for this ("setuser handle XTRA Ttime [clock seconds]" should do the trick). This would make it trivial retrieving the timestamp later on.

For your user listing, create a list of handles using the userlist command (userlist &+T channel) and iterate through this using foreach. To generate the time, retrieve the stored timestamp (getuser handle XTRA Ttime), gather the time delta from now, and use the duration command to convert it to human readable form.
NML_375
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

thanks nml375.

but can make the code pls.?


thanks again.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

This is "Scripting Help", not "Script Request"...
NML_375
Post Reply