You should check out the identifier:
$nick($chan,$nick).idle
Then use the > operator to see if people are idle longer than the idle allowance. Your approach is not well-advised.