Snippet that returns the last opped user and how many minutes ago the user was opped. /lastopped (chan)
/*
/lastopped by FLCL
Snippet that returns the last user that has been given an op and how long it was ago, based on the database you accumulate through the op event. Syntax: /lastopped (#channel)
This snippet is NOT to be redistributed/edited.
*/
alias lastopped {
if ($1 && $hget(opshash,$+($cid,$1)) && $regex($1,/^(#)/i)) {
echo $colour(info) -a $hget(opshash,$+($cid,.,$chan,.,nick)) - $round($calc($calc($ctime - $($hget(opshash,$+($cid,$1)),2)) / 60),0) minutes ago.
}
elseif (!$1) { echo $colour(info) -a Error. Invalid syntax. }
elseif (!$regex($1,/^(#)/i)) { echo $colour(info) -a Error. Invalid syntax. You have not specified the 35th character (#) before the channel name. }
elseif (!$hget(opshash,$+($cid,$1))) { echo $colour(info) -a Error. Channel is not in database. }
}
on ^*:OP:#:{
if (!$hget(opshash)) { hmake opshash }
if ($hget(opshash,$+($cid,.,$chan,.,nick))) hdel opshash $+($cid,.,$chan,.,nick)
hadd opshash $+($cid,$chan) $ctime
hadd opshash $+($cid,.,$chan,.,nick) $opnick
}
on ^*:part:#:{
if ($hget(opshash,$+($cid,$chan))) {
hdel opshash $+($cid,$chan)
hdel opshash $+($cid,.,$chan,.,nick)
}
}