Question
#1

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 ...?
Reply
#2

Please
Reply
#3

1. Make a function which sorts your players by score
2. Make a dialog to show function result
Reply
#4

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.
Reply
#5

Please code I am confused
Reply
#6

Please
Reply
#7

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)