Help Please in Top 5 system.
#1

I got a serious problem. When player joins, its alright. it shows the top list like this ↓

Код:
1. Champ
2. Stranger
3. N/A
4. N/A
5. N/A
but when i kill some one. it shows it like this.

Код:
1. Champ
2. Champ
3. N/A
4. N/A
5. N/A
I have created a variable for it. Here is it.

pawn Код:
new score[MAX_PLAYERS];

public OnPlayerDeath(playerid)
(
  score[killerid]++;
)
and

pawn Код:
for(new i; i != MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            playerScores[index][player_Score] = score[i];
            playerScores[index++][player_ID] = i;
        }
    }
Please help.
Reply
#2

I noticed something on your OnPlayerDeath Callback

Remove this
pawn Код:
public OnPlayerDeath(playerid)
and Change it to this
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
Reply
#3

That would give an error about function heading differs from prototype. I guess it was a typing mistake while writing the thread.

When you pass killerid in an array, you need to make sure first that the player is valid - otherwise a runtime error about index out of bounds will be caused.

pawn Код:
if(killerid != INVALID_PLAYER_ID) score[killerid]++;
Reply
#4

Ok, Konstantinos. I will try this .
Thank You
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)