Very simple Peak script

From Scriptwiki
Jump to: navigation, search

A script that remembers the user record of channels. Shows the record when someone types !peak

;Execute the following every time someone (including you) joins a channel
on *:join:#: {
 ;If the variable (%peak.#channel) where we save user peak doesn't already exist, set it to 0
 if (!%peak. [ $+ [ $chan ] ]) {
   set %peak. $+ $chan 0
 ;If the total amount of users is more than the old value of %peak.#channel, set the variable to the new total amount
 if ($nick($chan,0) > %peak. [ $+ [ $chan ] ]) {
   set %peak. $+ $chan $ifmatch

;Make the script do something every time someone says !peak
on *:text:!peak:#: {
 ;This here is to prevent people flooding you out
 ;If a variable called %peakspam.#channel does not exist, continue
 if (!%peakspam. [ $+ [ $chan ] ]) {
   ;Save a variable called %peakspam.#channel for 10 seconds
   set -u10 %peakspam. $+ $chan 1
   ;Send a message to the channel telling people what the user record is
   msg $chan User peak for $chan is: %peak. [ $+ [ $chan ] ]

;Please note:
;If you join a channel and someone says !peak before another person has joined, it will return "1"
;This is due to mIRC not knowing the total number of users when joining a new channel
;It could be fixed pretty easily, but as this is supposed to be a 'very simple' script.. :)

See Also