Question - 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: Question (
/showthread.php?tid=484827)
Question -
kalanerik99 - 01.01.2014
Hi
I have got one question!
How to make that it will show player with most score in the top of the dialog and then on second with lower score than 1st ...?
Re: Question -
kalanerik99 - 02.01.2014
Please
Re: Question -
Vykintas - 02.01.2014
1. Make a function which sorts your players by score
2. Make a dialog to show function result
Re: Question -
dominik523 - 02.01.2014
Make a loop which will go through all players and sort them by their score, and then use strcat to add all those players in one string.
Re: Question -
kalanerik99 - 02.01.2014
Please code I am confused
Re: Question -
kalanerik99 - 06.01.2014
Please
Re: Question -
Mic_H - 06.01.2014
Use this only if you have 60- players. If you have more than 60, let me know, I will help..
I guessed from you Signature that u had 50 players
Код:
#define DIALOG_LEADERSHIP 298
CMD:leaders(playerid, params[])
{
new LeadMSG[32*55];
new Sorted[MAX_PLAYERS];
for(new i=0; i<MAX_PLAYERS; i++)
{
for(new j=i+1; j<MAX_PLAYERS; j++)
{
if(IsPlayerConnected(j))
{
if(GetPlayerScore(i)<GetPlayerScore(j))
{
Sorted[i]=j;
}
}
}
}
new LeadName[24];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, LeadName, sizeof(LeadName));
format(LeadMSG, sizeof(LeadMSG), "%s%s\n", LeadMSG, LeadName);
//If you Want to show score.. Remove ^ and Un-Comment the following.
//format(LeadMSG, sizeof(LeadMSG), "%s%s - %i\n", LeadMSG, LeadName, GetPlayerScore(i));
}
}
ShowPlayerDialog(playerid,DIALOG_LEADERSHIP ,1, "Leading Players: ", LeadMSG, "*o*", "-_*");
return 1;
}