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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
BigToe
Halfop
Posts: 99 Joined: Thu Dec 30, 2010 4:49 pm
Post
by BigToe » Wed Jan 23, 2013 7:26 am
hi - i am looking for a script that for each user it will count the total amount of time he was in that certain channel, it can also be viewed with
!timespent <nickname> <#channel>
Every time a user has spent more than a certain amount of time in a channel (set by the user), the script will send a message to that channel stating:
*Nickname* has spent over 10 hours (the certain amount of time set by the user) in this channel and is now considered a regular user and is added to the db
the user is added to the db.
the script will never alert about that user again.
an initial database of regular users can be added manually by the user
Madalin
Master
Posts: 310 Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:
Post
by Madalin » Sat Jan 26, 2013 3:47 pm
Informations are saved by $chan,$host
if you restart the eggdrop you never loose any informations
Sorry for my bad english (its not my native language so live with it)
set announce(time) "1" ;#in hours
- So if you set it to '1' it will announce (only once for each user) the user that spent atleast that time on the channel
Code: Select all
#### ++++ Author: MadaliN <madalinmen28@yahoo.com>
### ++++ TCL Name: Timespent
## ++++
# Commands:
# !timespent activate (local or global owner)
# !timespent deactivate (local or global owner)
# !timespent <$nickname> <$chan> (local or global owner)
#
####
# +++ Created: 1/26/2013
####
bind TIME - * egghelp:timespent
bind PUB - !timespent timespent:pub
set announce(time) "1" ;#setting is in hours
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] {
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
if {$announce(time) != ""} {
if {[lindex [split $timespent($chan,$host)] 0] > [expr $announce(time) * 3600]} {
if {![info exists noa($chan,$host)]} {
set noa($chan,$host) "[unixtime]"
timespent:save
lappend list "\00303[lindex [split $timespent($chan,$host)] 1]\003"
}
}
}
}
}
if {$list != ""} {
putserv "PRIVMSG $chan :Users who spent more than \00312$announce(time)\003 hour on \00304$chan\003 are: [join $list "\002,\002 "]"
}
}
}
}
proc timespent:pub {nick uhost hand chan arg} {
global timespent
set host [lindex [split [getchanhost [lindex [split $arg] 0] $chan] @] 1]
switch -exact -- [lindex [split $arg] 0] {
activate {
if {[matchattr $hand n] || [matchattr $hand |N $chan]} {
channel set $chan +timespent
putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00312activated\003 succesfully"
}
}
deactivate {
if {[matchattr $hand n] || [matchattr $hand |N $chan]} {
channel set $chan -timespent
putserv "PRIVMSG $chan :\002$nick\002 - TIMESPENT script \00304deactivated\003 succesfully"
}
}
default {
if {[matchattr $hand n] || [matchattr $hand |N $chan]} {
if {[string match -nocase "#*" [lindex [split $arg] 1]]} {
if {![info exists timespent([lindex [split $arg] 1],$host)]} {
putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 has no info on \00312[lindex [split $arg] 1]"
} else {
putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 idled on \00312[lindex [split $arg] 1]\003 for \00303[duration [lindex [split $timespent([lindex [split $arg] 1],$host)] 0]]"
}
} else {
if {![info exists timespent($chan,$host)]} {
putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 has no info on this channel"
} else {
putserv "PRIVMSG $chan :\002$nick\002 - Nickname \00303[lindex [split $arg] 0]\003 idled on \00312$chan\003 for \00303[duration [lindex [split $timespent($chan,$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"
Last edited by
Madalin on Sat Jan 26, 2013 6:14 pm, edited 5 times in total.
BigToe
Halfop
Posts: 99 Joined: Thu Dec 30, 2010 4:49 pm
Post
by BigToe » Sat Jan 26, 2013 5:00 pm
What you mean by first version?
Madalin
Master
Posts: 310 Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:
Post
by Madalin » Sat Jan 26, 2013 5:01 pm
Well it is the first version maybe it has some bugs maybe it will need some more commands to be added etc
thats why is the first version. Just test this (i know i did) and see if it works.