24.05.2015, 08:53
Quote:
You only need the player with the highest deaths?
Or the highest 10? You could have a file that holds that information and an array to hold them on the server. When someone dies, add 1 to their deaths. Then compare it against the values in that new array and if they have a higher death value compared to another player, put his name in that array and remove the player with the lowest death value. Then re-save the file which holds these 10 players. Example: A 10 B 15 C 7 D 2 E 100 F 16 G 24 H 37 I 45 J 9 These could be the top players on your server and this data should be in that file. Then your player dies and reaches a death value of 3. Then you should remove player D and put your player in it's place. Then re-save the file with the new playerlist. You may also sort the list in a descending order before saving. It can be done, but if you want to record all your players (over 1000), it's not that efficient. Better use MySQL for longer lists. |