on me:*:join:#:set %justjoined $addtok(%justjoined,$chan,32)
on me:*:part:#:set %justjoined $remtok(%justjoined,$chan,32) | .timerlottery. $+ $chan off
on *:disconnect unset %justjoined | .timerlottery.* off
on *:op:#:{
if ($opnick == $me) {
if ($istok(%justjoined,$chan,32)) {
$+(.timerlottery.,$chan) 0 60 lottery $safe($chan)
}
set %justjoined $remtok(%justjoined,$chan,32)
}
}
alias lottery {
var %winner $nick($1,$r(1,$nick($1,0)))
var %point $gettok(5 10 20 30 40 50 60 70 80 150,$r(1,10),32)
var %inisection $+($1,.,%winner)
writeini -n Points.ini %inisection Points $calc($readini(Points.ini,%inisection,Points) + %point)
msg $1 %winner wins %point points!
}
alias safe return $!decode( $encode($1-, m) ,m)