It's just calculating percentage...
((amount ÷ total) × 100) = percentage
on *:text:!airtime:#:{
msg $chan So far our DJs have been on air for $&
$round($calc((%OnAir.Staff / (%OnAir.Staff + %OnAir.Playlist))*100),0) $+ % $&
of the time!
}
In the +dj event you should also be checking if $nick OR Playlist is %DJ AND if $nick is someone who is authorised to be a DJ (but I don't know where or how that last info is stored so I can't add it).
on *:text:+dj *:#: {
if ($2 == off) && (%DJ == $nick) {
set %no-dj_ctime $ctime
inc %OnAir. $+ $nick $calc($ctime - %dj_ctime)
inc %OnAir.Staff $calc($ctime - %dj_ctime)
set %DJ Playlist
msg $chan Off
writeini -n radio.ini DJ Current Playlist
writeini -n radio.ini DJ Time $time
writeini -n radio.ini DJ Date $date
}
elseif ($2 == on) && (%DJ == Playlist) {
set %dj_ctime $ctime
inc %OnAir.Playlist $calc($ctime - %no-dj_ctime)
set %DJ $nick
msg $chan On
writeini -n radio.ini DJ Current $nick
writeini -n radio.ini DJ Time $time
writeini -n radio.ini DJ Date $date
}
}
BTW...Your code also has "
else ($2 == on) {" which should be "
elseif ($2 == on) {"