The order isn’t based on the player ServerId. Depends on the resource but sorting the player list by ServerId is easy. To sort the base scoreboard resource you can replace the GetPlayers function with this.
https://github.com/citizenfx/cfx-server-data/blob/master/resources/[system]/scoreboard/scoreboard.lua#L38

function GetPlayers()
    local players = {}

    for i = 0, 255 do
        if NetworkIsPlayerActive(i) then
            table.insert(players, i)
        end
    end

    table.sort(players, (function(a,b)
      return GetPlayerServerId(a) < GetPlayerServerId(b)
    end))

    return players
end
1 Like