26.06.2014, 01:07
well after cracking my head to find a way to sort data, so i can enlist them, i can't figure out how the hell can i possibly send the names of the players properly. This is how the code is:
What i want to do is where [%d] to display their id, and %s to show their name. But my brains just burned out after trying to understand the whole include concept, which i barely did, if still didn't. Plus, the whole gets repeated over and over again after the message is sent, whats wrong with my loop aswell?
pawn Код:
stock toplist()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(ffaon == true && ffaopen == false && playingffa[i] == true && IsPlayerConnected(i))
t_FeedInfo(i, GetPVarInt(i, "pPoints"));
}
new rank[3];
new p3[MAX_PLAYER_NAME];
new p2[MAX_PLAYER_NAME];
new p1[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(rank[0], p1, sizeof(p1));
GetPlayerName(rank[1], p2, sizeof(p2));
GetPlayerName(rank[2], p3, sizeof(p3));
for(new i=0; i<3; ++i)
{
rank[i] = t_GetPlayer(i+1, 1);
format(string, sizeof(string), "1st place - [%d]%s", rank[0]);
format(string, sizeof(string), "2nd place - [%d]%s", rank[1]);
format(string, sizeof(string), "3rd place - [%d]%s", rank[2]);
SendClientMessageToAll(-1, string);
}
return 1;
}
