SA-MP Forums Archive
How to Create Top Death and Drift? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to Create Top Death and Drift? (/showthread.php?tid=574846)



How to Create Top Death and Drift? - OnelifeGaming - 21.05.2015

Bro how to create top death and drift Use Y_Ini Or Dini No Mysql


Re: How to Create Top Death and Drift? - Deathlane - 21.05.2015

If there's a way, it will definitely lag your server.


Re: How to Create Top Death and Drift? - dominik523 - 21.05.2015

Quote:
Originally Posted by OnelifeGaming
Посмотреть сообщение
Bro how to create top death and drift Use Y_Ini Or Dini No Mysql
The best way would be MySQL, bro?


Re: How to Create Top Death and Drift? - PowerPC603 - 21.05.2015

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.


Re: How to Create Top Death and Drift? - OnelifeGaming - 24.05.2015

Quote:
Originally Posted by dominik523
Посмотреть сообщение
The best way would be MySQL, bro?
I do not understand using mysql


Re: How to Create Top Death and Drift? - OnelifeGaming - 24.05.2015

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
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.
How to create?


Re: How to Create Top Death and Drift? - FplayerGR - 24.05.2015

Quote:
Originally Posted by OnelifeGaming
Посмотреть сообщение
I do not understand using mysql
if you not use mysql or sqlite is some hard to create top scores system.
if you use id's for accounts (id 1 (name = gase,password = xxx,money...etc))
use one loop for,while..etc for get all accounts stats for update top scores.


Re: How to Create Top Death and Drift? - Yashas - 24.05.2015

If you use MySQL, you can find the top 10 in just one query.

Do not use Dini, it is insanely slow.Also one mustn't use INI as a player database.

https://sampforum.blast.hk/showthread.php?tid=574754