Code:
on *:text:.peak:#:{
  var %net = $iif($network,$network,$server)
  var %flood = $+(%,peakflood,%net,#)
  if ($(,%flood)) return
  inc -z $(%flood) 5
  var %peak = $+(%,peak,%net,#)
  if (!$(,%peak)) set $(%peak) $nick(#,0)
  msg # User peak for # is: $(,%peak)
}
 [color:red]  [/color] 
on !*:join:#:{
  var %peak = $+(%,peak,$iif($network,$network,$server),#)
  if ($nick(#,0) > $calc($(,%peak))) set $(%peak) $ifmatch
}

For those wondering, the $calc is there so you can use this code without having to rejoin all channels you are currently in, because if (5 > $null) is no valid if comparision, but if (5 > $calc($null)) is, since $calc($null) returns 0.

I've added a simplistic flood protection so that people can only use the .peak command once per 5 seconds on a certain channel from a certain network.

The script is network specific, so the peak for channel #mirc on network DALnet, will be different from #mirc on network Undernet. If $network isn't filled, it uses the $server name as reference.


Gone.