on *:TEXT:!checkz:#: {
write -l1 totalscheck.txt $read(Blacknickstotal.txt, 1)
/var %c 2 | if ($read(Blacknickstotal.txt, %c) <= 21) && ($read(Blacknickstotal.txt, %c) > $read(totalscheck.txt, 1)) { write -l1 totalscheck.txt $read(Blacknickstotal.txt, %c) } | inc %c }
This should right into line 1 of the totalscheck.txt, then starting at line 2 of black nicks total,check if it's under 21 + bigger than the first line of totalscheck.txt. If it is, it will write it into the first lihe of totalscheck.txt and then move to the next line.
Blacknickstotal.txt looks like this-
9
10
15
16
21
20