You can use this code that has an different saving/reading way than yours and is better and faster.

Remove the 'exp.txt' file and the previous code before pasting this code.


Usage: !sort <nickname>

Code:
ON *:TEXT:*:#test_chan: {
  ; if ($($+(%,flood.,$nick),2)) { return }
  ; set -eu30 %flood. $+ $nick On

  var %f = exp.txt

  if ($strip($1) == !sort) {
    if (!$2) { msg $chan ( $+ $nick $+ ): Error, Please specify a nickname! | return }
    var %data = $read(%f,nw,$2 $+ *)
    if (!%data) { msg $chan ( $+ $nick $+ ): Error, The $qt($2) nickname does NOT exist into the database! | return }
    var %nick = $gettok(%data,1,126)
    var %result = $gettok(%data,2,126)
    msg $chan ( $+ $nick $+ ): First place is $qt(%nick) with $qt(%result) score.
    return
  }

  var %r = $read(%f,nw,$nick $+ *)
  var %rn = $readn

  if (!%r) { write $qt(%f) $nick $+ ~ $+ 1 }
  elseif (%r) {
    var %value = $gettok(%r,2,126)
    var %result = $calc(%value + 1)
    write -dl $+ %rn $qt(%f) 
    write $qt(%f) $nick $+ ~ $+ %result
  }
}


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-