This script will keep the record of visitors on a channels.
When user joins and the count of users is bigger than the peak for channel it will be displayed to the channel, the peak for the channel is also possible to get by using !Peak.
I decided to add popup menu to keep list of the channels where this script should work, delete channels and add.
Sorry if there's mistake(s) i can't use mirc to test. :"(
;Peak by shitbreak
;Use rightclick -> peak to see the available options
on *:load:{
if (!$hget(peak)) { hmake peak }
if ($exists(peak.hsh)) { hload peak peak.hsh }
}
on *:connect:{
if (!$hget(peak)) { hmake peak }
if ($exists(peak.hsh)) { hload peak peak.hsh }
}
on *:disconnect:{
if ($hget(peak.hsh)) { hsave peak peak.hsh }
}
menu channel {
...Peak:{
..Enable the peak for $chan $+ :{
if (!$hget(peak,$chan)) { hadd peak $chan $date $time $me $nick($chan,0) }
echo 2 -a The peak for channel $chan has now been enabled.
}
..Disable the peak for $chan $+ :{
if ($hget(peak,$chan)) { hdel peak $chan }
echo 2 -a The peak for channel $chan has now been disabled.
}
..List the peak channels:{
if ($hfind(peak,*,0,w) == 0) { echo 2 -a The list of the channels is empty }
if ($hfind(peak,*,0,w) > 0) {
var %i = 1
while (%i <= $hfind(peak,*,0,w)) {
var %k = %k $+ $chr(44) $hfind(peak,*,%i,w)
inc %i
}
if (%k) { echo 2 -a The list of the channels: $right(%k,-1) }
}
}
}
on *:text:!peak:#:{
if (!$hget(peak,$chan)) { notice $nick The peak for channel $chan hasn't been enabled. }
else {
msg $chan Peak record: $gettok($hget(peak,$chan),4,32) - made by: $gettok($hget(peak,$chan),3,32) - made on: $gettok($hget(peak,$chan),1-2,32) ( $+ $duration($calc($ctime - $ctime($gettok($hget(peak,$chan),1-2,32))) ago.)
}
}
on *:join:#:{
if ($hget(peak,$chan)) {
if ($nick($chan,0) > $gettok($hget(peak,$chan),4,32)) {
msg $chan New peak record of $nick($chan,0) by: $nick
}
}
}
if (!$hget(peak)) { hmake peak }
if ($exists(peak.hsh)) { hload peak peak.hsh }
In the on :connect and on :load events change to:
if (!$hget(peak)) hmake peak
else hload peak peak.hsh
Instead of checking twice, it skips straight to the next bit, making it faster.
Taking out the brackets also makes it faster.