TopScoreCreate
#8

hi,
thx a lot once again MadeMan
Mhh, i dont know if its the fault if this code but it seems that its buggy as soon as there are more then 1-2 players in the server?
The first player that joins is able to view the top 5 board with /top
but if the second and third player that join type in /top it says unknown command.
But the ClientMessage still shows up.
Anyone knows where the probem might be?
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;
}
regards...

//Edit:

Yeah, this code simply crashes the server
If there is just 1 player in the server it works fine but as soon as there are more than 1 players online it doesnt work.
In that case it says unknown command and no commands that are available on my server works anymore.
It always says unknown command. In addition to that it also bugs up my spawnpoints, the deathMessage isnt shown anymore ect.....
This is very important to me, id be very thankful if someone could tell me the error
Reply


Messages In This Thread
TopScoreCreate - by BlackWolf120 - 06.01.2011, 05:27
Re: TopScoreCreate - by DarrenThayer - 06.01.2011, 08:21
Re: TopScoreCreate - by Joe Staff - 06.01.2011, 08:36
Re: TopScoreCreate - by DarrenThayer - 06.01.2011, 08:39
Re: TopScoreCreate - by BlackWolf120 - 06.01.2011, 18:21
Re: TopScoreCreate - by BlackWolf120 - 08.01.2011, 22:37
Re: TopScoreCreate - by MadeMan - 08.01.2011, 23:48
Re: TopScoreCreate - by BlackWolf120 - 10.01.2011, 18:10
Re: TopScoreCreate - by BlackWolf120 - 11.01.2011, 16:43
Re: TopScoreCreate - by BlackWolf120 - 14.01.2011, 17:58

Forum Jump:


Users browsing this thread: 11 Guest(s)