!!Top 5 issue!!
#1

hi,
i want that this board displays the top 5 players (amount of kills) currently playing on the server.
But as soon as there are more than 2 players it doesnt work. It just screws the server up and nothing works anymore. I have to restart the server after that.
There are 5 textdraws (1 for each player of the 5 top players)
Can someone tell me the error?
Why doesnt it work with more than 1 player on the server?

pawn Код:
//OnPlayerCommand
if (strcmp("/top", cmdtext, true) == 0)
{

SendClientMessage(playerid,0xAA3333AA,"{283A90}The {B0171F}Top 5 {283A90}board is displayed.");

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 string[200];
GetPlayerName(TotalPlayers[0], string, sizeof(string));
format(string, sizeof(string), "~r~1.  ~w~%s  ~r~%d ~w~Kills  ~y~%s", string,TotalScores[0],RankName[pRank[TotalPlayers[0]]]);
TextDrawShowForPlayer(playerid,Top52);
TextDrawSetString(Text:Top52, string);

GetPlayerName(TotalPlayers[1], string, sizeof(string));
format(string, sizeof(string), "~r~2.  ~w~%s  ~r~%d ~w~Kills  ~y~%s", string,TotalScores[1],RankName[pRank[TotalPlayers[1]]]);
TextDrawShowForPlayer(playerid,Top53);
TextDrawSetString(Text:Top53, string);

GetPlayerName(TotalPlayers[2], string, sizeof(string));
format(string, sizeof(string), "~r~3.  ~w~%s  ~r~%d ~w~Kills  ~y~%s", string,TotalScores[2],RankName[pRank[TotalPlayers[2]]]);
TextDrawShowForPlayer(playerid,Top54);
TextDrawSetString(Text:Top54, string);

GetPlayerName(TotalPlayers[3], string, sizeof(string));
format(string, sizeof(string), "~r~4.  ~w~%s  ~r~%d ~w~Kills  ~y~%s", string,TotalScores[3],RankName[pRank[TotalPlayers[3]]]);
TextDrawShowForPlayer(playerid,Top55);
TextDrawSetString(Text:Top55, string);

GetPlayerName(TotalPlayers[4], string, sizeof(string));
format(string, sizeof(string), "~r~5.  ~w~%s  ~r~%d ~w~Kills  ~y~%s", string,TotalScores[4],RankName[pRank[TotalPlayers[4]]]);
TextDrawShowForPlayer(playerid,Top56);
TextDrawSetString(Text:Top56, string);
Reply


Messages In This Thread
!!Top 5 issue!! - by BlackWolf120 - 28.01.2011, 22:49
AW: !!Top 5 issue!! - by Nero_3D - 28.01.2011, 23:39
Re: !!Top 5 issue!! - by BlackWolf120 - 30.01.2011, 00:26

Forum Jump:


Users browsing this thread: 1 Guest(s)