on *:join:#:if !$timer($+(opcheck.,#)) { $+(.timeropcheck.,#) 0 5 opcheck # }
on *:text:!optime *:#:if $nick isop # { optime # $iif($2,$2,$nick) 1 }
alias -l opcheck {
if $me !ison $1 { $+(.timeropcheck.,$1) off | return }
var %i 1
while $nick($1,%i,o) {
optime $1 $v1
inc %i
}
}
alias -l optime {
if $isfile(opfile.ini) { var %d $iif($readini(opfile.ini,$+(optime.,$1),$2),$v1,0) }
else { var %d 0 }
if $3 { msg $1 $2 has $iif(%d,spent $duration(%d) as an op.,no online record.) }
else { writeini opfile.ini $+(optime.,$1) $2 $calc(%d + 5) }
return
}