16.01.2013, 15:19
Quote:
Hello.
I want to make a top 5 for players with highest number of used commands. I have the variable to store the number of commands per each player and it will be saved in a .ini file. What I don't know is how to make such a thing. I know how to read offline players .ini files but i don't know how to read variables for online players at the same time and to be displayed. Ex: 1: Trock (Offline player) 2: Crock (Online player) ...and so on.. I just need an example and i hope you understand what i mean.. |
1. You can save it with sqlite or MySQL and use the SQL Command
PHP код:
ORDER BY `...` ASC
https://sampforum.blast.hk/showthread.php?tid=343172
3. Make your own System with forloops and compare the values
PHP код:
new Top[5];
new CommandCount[MAX_PLAYERS];
new i;
for(; i < MAX_PLAYERS; ++i)CommandCount[i]=i;
i=0;
for(; i < MAX_PLAYERS; ++i)if(Top[0] < CommandCount[i])Top[0] = CommandCount[i];
i=0;
for(; i < MAX_PLAYERS; ++i)if(Top[1] < CommandCount[i] && Top[0] > CommandCount[i])Top[1] = CommandCount[i];
i=0;
for(; i < MAX_PLAYERS; ++i)if(Top[2] < CommandCount[i] && Top[1] > CommandCount[i])Top[2] = CommandCount[i];
i=0;
for(; i < MAX_PLAYERS; ++i)if(Top[3] < CommandCount[i] && Top[2] > CommandCount[i])Top[3] = CommandCount[i];
i=0;
for(; i < MAX_PLAYERS; ++i)if(Top[4] < CommandCount[i] && Top[3] > CommandCount[i])Top[4] = CommandCount[i];
printf("%d %d %d %d %d",Top[0],Top[1],Top[2],Top[3],Top[4]);