Hmm..I think that was a dialog.
I'll show you an example
UNTESTED
1. We define a variable to store score of each player
pawn Код:
new score[MAX_PLAYERS];
new scoreid[MAX_PLAYERS];//we will use this later
#define DIALOG_TOP 1 //Used to show dialog.
2. Now, set score of each player to 0 when gamemode start and add 1 after every kill.
pawn Код:
//----------------------GAME_MODE_START-----------------------------\\
public OnGameModeInit()
{
for(new i=0;i<MAX_PLAYERS;++i) score[i] = 0;
return 1;
}
//--------------------------------AFTER KILLING------------------------------------\\
public OnPlayerDeath(playerid, killerid, reason)
{
score[killerid]++;
return 1;
}
3. When GameMode finishes.. we wish to sort them in descending order.
pawn Код:
public OnGameModeExit()
{
return 1;
}
Now under OnGameModeExit add
1. Loop to sort everything in descending order.
pawn Код:
new temp;
for(new i = 0;i<MAX_PLAYERS;++i)
{
for(new j = i;j<MAX_PLAYERS;++j)
{
if(score[j] > score[i])
{
temp = score[i];
score[i] = score[j];
score[j] = temp;
temp = scoreid[i];
scoreid[i] = scoreid[j];
scoreid[j] = temp;
}
}
}
2. String's to show in dialog
pawn Код:
new string[5][200];
for(new i =0;i<5;++i)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(scoreid[i],name,sizeof(name));
format(string[i],200,"{FFFFFF}%d. {DE1868}%s (ID %d) : {3EA63A}%d",i+1,name,scoreid[i],score[i]);
}
new dstring[300];
format(fstring,300,"%s\n%s\n%s\n%s\n%s",string[0],string[1],string[2],string[3],string[4]);
3. Loop to show Dialog
pawn Код:
for(new i=0;i<MAX_PLAYERS;++i)
{
if(IsPlayerConnected(i))
{
ShowPlayerDialog(i,DIALOG_TOP,0,"TOp 5",dstring,"OK","");
}
}
Full OnGameModeExit :
pawn Код:
public OnGameModeExit()
{
new temp;
for(new i = 0;i<MAX_PLAYERS;++i)
{
for(new j = i;j<MAX_PLAYERS;++j)
{
if(score[j] > score[i])
{
temp = score[i];
score[i] = score[j];
score[j] = temp;
temp = scoreid[i];
scoreid[i] = scoreid[j];
scoreid[j] = temp;
}
}
}
new string[5][200];
for(new i =0;i<5;++i)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(scoreid[i],name,sizeof(name));
format(string[i],200,"{FFFFFF}%d. {DE1868}%s (ID %d) : {3EA63A}%d",i+1,name,scoreid[i],score[i]);
}
new dstring[300];
format(fstring,300,"%s\n%s\n%s\n%s\n%s",string[0],string[1],string[2],string[3],string[4]);
for(new i=0;i<MAX_PLAYERS;++i)
{
if(IsPlayerConnected(i))
{
ShowPlayerDialog(i,DIALOG_TOP,0,"TOp 5",dstring,"OK","");
}
}
return 1;
}