Posts: 67
Threads: 23
Joined: Jan 2015
Reputation:
0
Hello im trying to create top 3 players and teleport them somewhere after each round..
How i could find who have most pRoundkills, i tried for(int i = 0; i <MAX_PLAYERS; i++)...
But i cant use playerid in for so how i could compare players?Or i must use something other?
Posts: 270
Threads: 7
Joined: Apr 2015
This is how you get the top player with the most kills:
Код:
GetTopPlayerByKills()
{
new top_player = -1;
new top_kills = 0;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (pRoundkills[i] > top_kills)
{
top_player = i;
top_kills = pRoundkills[i];
}
}
return top_player;
}
Now you need to get top 3 players,
Make a function yourself like the top one and don't count the top player,
Repeat it 3 times.
Posts: 6,242
Threads: 8
Joined: Jun 2008
^^ That seems legit, another thing to look at is
https://sampwiki.blast.hk/wiki/Advanced_Structures
The wiki topic simply shows some bits, but also shows to have the whole thing in one function, rather than having several.
There was a tutorial way back somewhere which did this entirely, making a top5-10 list. I have no idea where it's ended up.