Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue Aug 06, 2013 7:18 am Post subject: |
|
|
Modifyed this version of mine to look only on channels where +timespent is set and the users have +C channel flag
| Code: |
#### ++++ Author: MadaliN <madalinmen28@yahoo.com>
### +++ Website: www.Ascenture.ro
## +++ TCL Name: TimeSpent
# +++ Version: 2.0
#
# Commands:
# /msg BOTNICK timespent activate <$chan> (local or global owner)
# /msg BOTNICK timespent deactivate <$chan> (local or global owner)
# /msg BOTNICK timespent <$nickname> <$chan> (local or global owner)
#
####
# +++ Created: 6/8/2013
####
bind MSGM - * timespent:msg
setudef flag timespent
proc egghelp:timespent {min hour day month year} {
global timespent announce noa
set list ""
foreach chan [channels] {
if {[channel get $chan timespent]} {
foreach u [chanlist $chan] {
if {[matchattr $u -|C $chan] && [isop $u $chan]} {
putlog "Found \002$u"
set host [lindex [split [getchanhost $u $chan] @] 1]
if {![info exists timespent($chan,$host)]} {
set timespent($chan,$host) "60 $u"
timespent:save
} else {
set timespent($chan,$host) "[expr [lindex [split $timespent($chan,$host)] 0] + 60] $u"
timespent:save
}
}
}
}
}
}
proc timespent:msg {nick uhost hand arg} {
global timespent
if {[lindex [split $arg] 2] != ""} {
set chan [lindex [split $arg] 2]
set host [lindex [split [getchanhost [lindex [split $arg] 1] $chan] @] 1]
}
switch -exact -- [lindex [split $arg] 0] {
timespent {
switch -exact -- [lindex [split $arg] 1] {
activate {
if {[matchattr $hand n]} {
channel set $chan +timespent
putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00312activated\003 succesfully"
}
}
deactivate {
if {[matchattr $hand n]} {
channel set $chan -timespent
putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00304deactivated\003 succesfully"
}
}
reset {
if {[matchattr $hand n]} {
unset -nocomplain timespent
putserv "PRIVMSG $nick :\002$nick\002 - Timespent with @ was RESET for everyone"
}
}
default {
if {[matchattr $hand n]} {
if {[string match -nocase "#*" [lindex [split $arg] 2]]} {
if {![info exists timespent([lindex [split $arg] 2],$host)]} {
putserv "PRIVMSG $nick :\002$nick\002 - Nickname \00303[lindex [split $arg] 1]\003 has no info on \00312[lindex [split $arg] 2]"
} else {
putserv "PRIVMSG $nick :\002$nick\002 - Nickname \00303[lindex [split $arg] 1]\003 idled with @ on \00312[lindex [split $arg] 2]\003 for \00303[duration [lindex [split $timespent([lindex [split $arg] 2],$host)] 0]]"
}
}
}
}
}
}
}
}
proc timespent:save {} {
global timespent
set ofile [open timespent w]
puts $ofile "array set timespent [list [array get timespent]]"
close $ofile
}
catch {source timespent}
putlog "+++ Succesfully loaded: \00312Timpespent TCL Script"
|
Original script can be found at http://forum.egghelp.org/viewtopic.php?t=19314 _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|