Display the most - 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: Display the most (
/showthread.php?tid=315606)
Display the most -
BGMike - 03.02.2012
Hello, First of all I'll give you an example:
Код:
new kills[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
kills[killerid] += 1;
return 1;
}
Example:
My name is Player1 and my kills are 5.
Player2's kills are 3.
Player3's kills are 2.
And my question is how to make a command to display player id with the most kills ?
Re: Display the most -
[HiC]TheKiller - 03.02.2012
pawn Код:
new maxscore[2];
for(new i; i<MAX_PLAYERS; i++)
{
if(maxscore[0] < kills[i])
{
maxscore[1] = i;
maxscore[0] = kills[i];
}
}
new Pname[24], str[100];
GetPlayerName(maxscore[1], Pname, 24);
format(str, sizeof(str), "%s(id:%d) has the highest score with the score of %d", maxscore[1], Pname, maxscore[0]);
SendClientMessageToAll(-1, str);
Something like that would work.
Re: Display the most -
thimo - 03.02.2012
Use something like if(kills[playerid] > 30)
Re: Display the most -
BGMike - 03.02.2012
Thanks to [HiC]TheKiller, but if the kills are equal SendClientMessageToAll will display the player with fewer id. How to make when we have players with equal kills to give them a battle ?
Re: Display the most -
Amit_B - 04.02.2012
Quote:
Originally Posted by BGMike
Thanks to [HiC]TheKiller, but if the kills are equal SendClientMessageToAll will display the player with fewer id. How to make when we have players with equal kills to give them a battle ?
|
To do this, I guess you have to script your own battles system. Do you have any one?