top 5 code sometimes crashes my server!!
#1

hi,
like the title says.
this code i dont know why, sometimes crashes my server.
Only if there is only 1 player in the server it never crashes.
This is comparing the kills of a player and then it shows the top 5 players currently playing on the server.

pawn Код:
//kills are counted like this:
kills[killerid]++; //under OnPlayerDeath




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);
            }
        }
    }
}
hope someone can help me cause i just dont know what to do.

regards...
Reply


Messages In This Thread
top 5 code sometimes crashes my server!! - by BlackWolf120 - 23.02.2011, 17:15
Re: top 5 code sometimes crashes my server!! - by Jeffry - 23.02.2011, 17:49

Forum Jump:


Users browsing this thread: 1 Guest(s)