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.

lol.tcl help

Support & discussion of released scripts, and announcements of new releases.
Post Reply
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

lol.tcl help

Post by eXtremer »

Hi all.
I'm using lol.tcl, please don't tell me to find and ask the Author, I already contacted him once when I had another problem, but he is busy with other things now, he does not offer support anymore.

When I use the ban command, I want the script to add the local time and date to the reason.

I already added the "by $nick" in the reason, now I need the date and time.

Example of what I want:

Code: Select all

<eXtremer> !ban tester
*** Bot sets mode: +b *!*@host.com
*** [Banned]: tester
*** tester was kicked by Bot (Requested, (16:50/22.08.08) by eXtremer)
The CODE:

Code: Select all

### !BAN <nick|mask> [time] [reason]

proc pub_lol_ban {nick host hand chan arg} {
	set arg [charfilter $arg]
	global lol botnick
	if {![check $hand $nick $host]} {
		if {$lol(silent) == 1 || [checksilent $hand]} {return 0}
            puthelp "NOTICE $nick :You need to be identified to use this function. Type .identhelp in the partyline for more info. : \002/msg $botnick id <password>\002 or \002/msg $botnick silent <password>\002 to no more receive this warning."
		return 0
	}
	if {[llength $arg] < 1} {
		puthelp "NOTICE $nick :\002Usage:\002 [string trim $lol(cmdchar)]ban <nick|mask> \[time\] \[reason\]"
		return 0
	}
	set who [lindex $arg 0]
	if {[strlwr $who] == [strlwr $botnick]} {
		puthelp "NOTICE $nick :Yeah right, like I'm going to let you ban ME!"
		return 0
	}
	
	set ti [lindex $arg 1]
	if {[isnumber $ti]} {
		set reason [lrange $arg, 2 end]
	} {
		set ti ""
		set reason [lrange $arg, 1 end]
	}

	if {$reason == ""} { set reason "Requested," }
	
	if {[onchan $who $chan]} {
		if { $lol(bantype) == 0 } { 
			set ipmask [lindex [split [maskhost $who![getchanhost $who $chan]] "@"] 1]
			set usermask [lindex [split [getchanhost $who $chan] "@"] 0]		
			set banmask *!*$usermask@$ipmask
		} else { 
			set banmask [getchanhost $who $chan]
     	      	set banmask "*!*[string range $banmask [string first @ $banmask] e]" 
		}	
	} else {  		
		set banmask [lindex $arg 0]
		if {[string first "!" $banmask] == -1 && [string first "@" $banmask] == -1} {
			if {[isnumber [string index $banmask 0]]} { 
				set banmask *!*@$banmask 
			} else {
				 set banmask $banmask*!*@* 
			}
		}
		if {[string first "!" $banmask] == -1} { set banmask *!*$banmask }
		if {[string first "@" $banmask] == -1} { set banmask $banmask*@* }
	}
			   		
	if {![botisop $chan]} { return 0 }
	putserv "MODE $chan +b $banmask"

  	foreach chanuser [chanlist $chan] {
      	if {[string match [strlwr $banmask] [strlwr "$chanuser![getchanhost $chanuser $chan]"]] && $chanuser != $botnick } { 
			if {[nick2hand $chanuser $chan] != "*"} {
				if {$hand != [nick2hand $chanuser $chan]} {
					if {[matchattr [nick2hand $chanuser $chan] o|o $chan] && ![matchattr $hand o|o $chan]} {
                  	            puthelp "NOTICE $nick :Sorry, you must be an operator to ban an operator."
						return 0
					}
					if {([matchattr [nick2hand $chanuser $chan] m|m $chan] || [matchattr [nick2hand $who $chan] b]) && ![matchattr $hand m|m $chan]} {
            	                  puthelp "NOTICE $nick :Sorry, you must be a master to ban a master or a bot."
						return 0
					}
				}
			}
	    	   	putkick $chan $chanuser [join [lappend reason "by $nick"]]
		}
       }	 

	switch $ti {
		""
		{
			newchanban $chan $banmask $nick [join [lappend reason ""]]
			puthelp "NOTICE $nick :New mask added : $banmask"
		}
		0
		{
			newchanban $chan $banmask $nick [join [lappend reason ""]] $ti
			puthelp "NOTICE $nick :New mask added permanently : $banmask"
		}
		default
		{
			newchanban $chan $banmask $nick [join [lappend reason ""]] $ti
			puthelp "NOTICE $nick :New mask added for $ti minutes : $banmask"
		}
	}
	return 0
}
User avatar
MenzAgitat
Op
Posts: 118
Joined: Tue Jul 04, 2006 12:35 pm
Location: France
Contact:

Post by MenzAgitat »

 

Code: Select all

strftime "%H:%M/%d.%m.%Y" [unixtime]
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Post by eXtremer »

MenzAgitat wrote:

Code: Select all

strftime "%H:%M/%d.%m.%Y" [unixtime]
Hey MenzAgitat thanks, but if you could tell me where to add this line I'll apreciate.
User avatar
MenzAgitat
Op
Posts: 118
Joined: Tue Jul 04, 2006 12:35 pm
Location: France
Contact:

Post by MenzAgitat »

 
In each occurence of newchanban :

replace

Code: Select all

lappend reason " "
by

Code: Select all

lappend reason "Requested, ([strftime "%H:%M/%d.%m.%Y" [unixtime]]) by $nick"
 
 
e
eXtremer
Op
Posts: 138
Joined: Wed May 07, 2008 5:33 am

Post by eXtremer »

MenzAgitat wrote:
In each occurence of newchanban :

replace

Code: Select all

lappend reason " "
by

Code: Select all

lappend reason "Requested, ([strftime "%H:%M/%d.%m.%Y" [unixtime]]) by $nick"
thanks a lot, it works ;)
Post Reply