Get Player With The Most Kills? - 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: Get Player With The Most Kills? (
/showthread.php?tid=498626)
Get Player With The Most Kills? -
Blackazur - 04.03.2014
Hello, how can i get the player with the most kills after the end of a round (i have a round-map-system)? I know something with a timer, but can you give me a example please.
Re: Get Player With The Most Kills? -
]Rafaellos[ - 04.03.2014
Loop the players, get their kills and check if the current amount is higher than the previous one.
AW: Get Player With The Most Kills? -
Blackazur - 04.03.2014
Any example please?
Re: Get Player With The Most Kills? -
HK - 04.03.2014
pawn Code:
forward High();
public High()
{
static last; //it's static because it's like a global variable
new highestid = INVALID_PLAYER_ID, highest = -1;
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(GetPlayerScore(i) > highest)
{
highestid = i;
highest = GetPlayerScore(i);
}
}
if(highestid != INVALID_PLAYER_ID)
{
if(last != highestid)
{
//do something to remove the last one with highest score from the team
}
team[highestid] = 3;
}
last = highestid;
}
AW: Get Player With The Most Kills? -
Blackazur - 04.03.2014
What should i add to remove the last one? And where i write than a message like "Player Blabla has the most highest kills in this round"?