14.01.2011, 17:58
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//Top5 Show
if (strcmp("/top", cmdtext, true) == 0)
{
SendClientMessage(playerid,0xAA3333AA,"{283A90}The {B0171F}Top 5 {283A90}board is displayed. {283A90}Type in {855E42}/tophide {283A90}to hide the {B0171F}Top 5 {283A90}board again.");
new TotalScores[6];
new TotalPlayers[6];
new PlayerScore[2];
new PlayerID[2];
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerScore[0] = kills[i]; //kills
PlayerID[0] = i;
for(new place; place < sizeof(TotalScores); place++)
{
if(PlayerScore[0] > TotalScores[place])
{
strins(TotalScores, PlayerScore, place);
strins(TotalPlayers, PlayerID, place);
place = sizeof(TotalScores);
}
}
}
}
TextDrawShowForPlayer(playerid,Top51);
new stringa[80];
GetPlayerName(TotalPlayers[0], stringa, sizeof(stringa));
format(stringa, sizeof(stringa), "~r~1. ~w~%s ~r~%d ~w~Kills ~y~%s", stringa,TotalScores[0],RankName[pRank[TotalPlayers[0]]]);
TextDrawShowForPlayer(playerid,Top52);
TextDrawSetString(Text:Top52, stringa);
new stringb[80];
GetPlayerName(TotalPlayers[1], stringb, sizeof(stringb));
format(stringb, sizeof(stringb), "~r~2. ~w~%s ~r~%d ~w~Kills ~y~%s", stringb,TotalScores[1],RankName[pRank[TotalPlayers[1]]]);
TextDrawShowForPlayer(playerid,Top53);
TextDrawSetString(Text:Top53, stringb);
new stringc[80];
GetPlayerName(TotalPlayers[2], stringc, sizeof(stringc));
format(stringc, sizeof(stringc), "~r~3. ~w~%s ~r~%d ~w~Kills ~y~%s", stringc,TotalScores[2],RankName[pRank[TotalPlayers[2]]]);
TextDrawShowForPlayer(playerid,Top54);
TextDrawSetString(Text:Top54, stringc);
new stringd[80];
GetPlayerName(TotalPlayers[3], stringd, sizeof(stringd));
format(stringd, sizeof(stringd), "~r~4. ~w~%s ~r~%d ~w~Kills ~y~%s", stringd,TotalScores[3],RankName[pRank[TotalPlayers[3]]]);
TextDrawShowForPlayer(playerid,Top55);
TextDrawSetString(Text:Top55, stringd);
new stringe[80];
GetPlayerName(TotalPlayers[4], stringe, sizeof(stringe));
format(stringe, sizeof(stringe), "~r~5. ~w~%s ~r~%d ~w~Kills ~y~%s", stringe,TotalScores[4],RankName[pRank[TotalPlayers[4]]]);
TextDrawShowForPlayer(playerid,Top56);
TextDrawSetString(Text:Top56, stringe);
return 1;
}
//Top5 Hide
if (strcmp("/tophide", cmdtext, true) == 0)
{
SendClientMessage(playerid,0xAA3333AA,"{283A90}The {B0171F}Top 5 {283A90}board is hidden now. {283A90}Type in {855E42}/top {283A90}to show the {B0171F}Top 5 {283A90}board again.");
TextDrawHideForPlayer(playerid,Top51);
TextDrawHideForPlayer(playerid,Top52);
TextDrawHideForPlayer(playerid,Top53);
TextDrawHideForPlayer(playerid,Top54);
TextDrawHideForPlayer(playerid,Top55);
TextDrawHideForPlayer(playerid,Top56);
return 1;
}
SendClientMessage(playerid, 0xAA3333AA,"This command doesn't exist!");
return 1;
}
Cause this is bugged up if there are more than 1 players online.
What could cause this problem?
Pls, this is very important to me.