Top 5 players
#1

Hi is it possbile a command can read my saved files in user.ini? So basically it will read all player who has registered to the server. It will only read the player Kills, Score, etc.. Im using y_ini and I woul like to make /top5 player command in a dialog message box.

It would be like this

Code:
Top 5 Players //Dialog Title

Top 5 Killers:
1.
2.
3.
4.
5

Top 5 Score
1.
2.
3.
4.
5.

Top 5 Quiter
1.
2.
3.
4.
5.
Reply
#2

I think you can only do that with MySQL. With .ini files you can loop through the online players. I am not sure tho.
Reply
#3

Hmmh, I have never get used to INI, but i don't think it's possible, since you will have to open and read all player files which will lag no matter what. If it was mysql (BlueG). It's easiere than school exam :3
Reply
#4

I know it's only possible with SQL. The way I could think of making it was to store the top 5 in each category in a file and read it from there.
Reply
#5

Thanks for the response guys. I see that its only possible using SQL. I think even its possible with y_ini and you have 10000+ registered users after y_ini reads one by one your server may explode?
Reply
#6

It's possible with ini it's actually pretty easy.

1.) Create a command to figure out the top 5 this will only be used once
2.) Keep checking and saving your list for new top killers
3.) Wiseman says - Know your DB never use ini again

In fact I won't even consider using ini myself not for anything it's like a wild animal getting a taste of human blood lol.
Reply
#7

I don't think it will explode, but it will harm the server on some perspectives.

EDIT: Pottus came up with a solution.
Reply
#8

Quote:
Originally Posted by [uL]Pottus
View Post
It's possible with ini it's actually pretty easy.

1.) Create a command to figure out the top 5 this will only be used once
2.) Keep checking and saving your list for new top killers
3.) Wiseman says - Know your DB never use ini again

In fact I won't even consider using ini myself not for anything it's like a wild animal getting a taste of human blood lol.
Can you please make a demo for this? So I could see the concept for y_ini.

and what you mean, will only be used once? I can only use /top5 until I exit the server or restart?
Reply
#9

It will also be funny when you have the 3 topscores mentioned above (killers, score and quiters) and you've saved them all into 3 separate files.
And later on, you decide to add another topscore to find out who has the most money, and by that time you have 10000+ registered players.

You would need to create a test-script to read all those 10000 playerfiles, sort the players from rich to poor through code yourself to get the 5 richest players on your server and write those 5 to a new topscore file.
This test-script would be required to prevent lagging your server while it's reading and analyzing 10000+ playerfiles.

Using MySQL, it would simply be a matter of creating the proper query and let MySQL figure it out in the background without putting any stress on your server.
Using threaded queries, you won't notice any lag, even when you would have 1 million registered accounts.
You may notice a small delay between entering the command and seeing the results because MySQL processes your query in another thread which may take some time, but you won't ever see any lag while MySQL is working.

It can find and sort the data you want in one simple query, where you need to create alot more code to read all playerfiles and sort them manually through code yourself if you were to use ini files.


To answer a question in the previous post:
"Only once" is meant to let that command read all playerfiles once, sort them by the required value and write the topscore file for that value.
Once this file exists, you can simply update the file (overwrite it) everytime the topscores change, without the need to re-read all playerfiles again.
Reply
#10

Quote:
Originally Posted by AmigaBlizzard
View Post
It will also be funny when you have the 3 topscores mentioned above (killers, score and quiters) and you've saved them all into 3 separate files.
And later on, you decide to add another topscore to find out who has the most money, and by that time you have 10000+ registered players.

You would need to create a test-script to read all those 10000 playerfiles, sort the players from rich to poor through code yourself to get the 5 richest players on your server and write those 5 to a new topscore file.
This test-script would be required to prevent lagging your server while it's reading and analyzing 10000+ playerfiles.

Using MySQL, it would simply be a matter of creating the proper query and let MySQL figure it out in the background without putting any stress on your server.
Using threaded queries, you won't notice any lag, even when you would have 1 million registered accounts.
You may notice a small delay between entering the command and seeing the results because MySQL processes your query in another thread which may take some time, but you won't ever see any lag while MySQL is working.

It can find and sort the data you want in one simple query, where you need to create alot more code to read all playerfiles and sort them manually through code yourself if you were to use ini files.


To answer a question in the previous post:
"Only once" is meant to let that command read all playerfiles once, sort them by the required value and write the topscore file for that value.
Once this file exists, you can simply update the file (overwrite it) everytime the topscores change, without the need to re-read all playerfiles again.
Congratulations, it has taken you 2 years, 2 months and 28 days to reply!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)