SA-MP Forums Archive
Little help. - 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: Little help. (/showthread.php?tid=408017)



Little help. - rVar - 16.01.2013

// delete


AW: Little help. - IPrototypeI - 16.01.2013

Quote:
Originally Posted by rVar
Посмотреть сообщение
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..
Thats very easy you have tree opportunities.
1. You can save it with sqlite or MySQL and use the SQL Command
PHP код:
ORDER BY `...ASC 
2. Use the Include from Slice
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(; 
MAX_PLAYERS; ++i)CommandCount[i]=i;
    
i=0;
    for(; 
MAX_PLAYERS; ++i)if(Top[0] < CommandCount[i])Top[0] = CommandCount[i];
    
i=0;
    for(; 
MAX_PLAYERS; ++i)if(Top[1] < CommandCount[i] && Top[0] > CommandCount[i])Top[1] = CommandCount[i];
    
i=0;
    for(; 
MAX_PLAYERS; ++i)if(Top[2] < CommandCount[i] && Top[1] > CommandCount[i])Top[2] = CommandCount[i];
    
i=0;
    for(; 
MAX_PLAYERS; ++i)if(Top[3] < CommandCount[i] && Top[2] > CommandCount[i])Top[3] = CommandCount[i];
    
i=0;
    for(; 
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]); 
You have your choice


Re: Little help. - RajatPawar - 16.01.2013

Or if ypu are using zcmd, under oncommandperformed, if success, commandsperformed[playerid]++!