Help Please in Top 5 system. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Please in Top 5 system. (
/showthread.php?tid=466215)
Help Please in Top 5 system. -
Champ - 26.09.2013
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.
Re: Help Please in Top 5 system. - Patrick - 26.09.2013
I noticed something on your OnPlayerDeath Callback
Remove this
pawn Код:
public OnPlayerDeath(playerid)
and Change it to this
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
Re: Help Please in Top 5 system. -
Konstantinos - 26.09.2013
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]++;
Re: Help Please in Top 5 system. -
Champ - 27.09.2013
Ok, Konstantinos. I will try this .
Thank You