1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Ranking

Discussion in 'Development' started by BLOCKSTORM, May 1, 2018.

  1. BLOCKSTORM

    BLOCKSTORM Witch

    Messages:
    67
    Hello,
    I want to make a ranking for my System. So i have a directory where one file exists for each player. In this config, there is a value named Points. Now i want to sort all player points and get the top 3(as a variable or array or else), so i can display them in a ranking.
    Any ideas how to realize that?
    Regards,
    Blockstorm_
     
  2. Michel5F30

    Michel5F30 Silverfish

    Messages:
    22
    Load the files into an associative array by player UUID / name as key and points as value.
    Then use asort.

    Due to performance reasons you shouldn't use separated files...
    If you mostly need all of those files, put all in one file, if you let them separated only load the ones you need, not all. Best is to use SQL.
     
    Primus likes this.
  3. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Using one_file_per_player is very bad. User mysql or sqlite
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.