Leaderboard[kills] -
DavidBilla - 28.05.2014
Well i want to make a Leaderboard using Textdraws once the round has finished in my gamemode which should be showing something like 1.Playername - No.of kills and similarly for the rest of the players. I don't want it to show the kills of only a certain number of players but all players inside the server.I'll limit the server slot to some small amount anyway.
The kills in the Leaderboard shouldn't count the total kills that the player has done but only the kills he did for the current round,so no need for MySql database things.
I can deal with creating the textdraws,but i have no clue how to bring the list of all players' position(like 1st place,2nd place etc),names and kills displayed based on the order of kills.
I've searched everywhere but couldn't find what i was looking for...
Any help would be appreciated.
Thanks in advance.
Re: Leaderboard[kills] -
DavidBilla - 28.05.2014
Bump
Really in need of help...
Re: Leaderboard[kills] -
DavidBilla - 29.05.2014
Quote:
Originally Posted by DavidBilla
Bump
Really in need of help...
|
please help
Re: Leaderboard[kills] -
Matess - 29.05.2014
Try this:
http://forum.sa-mp.com/showthread.ph...rt#post1085586
Re: Leaderboard[kills] -
DavidBilla - 29.05.2014
Quote:
Originally Posted by Matess
|
It functions well,except for that i do not know how to link the players' kills to it.
Re: Leaderboard[kills] -
JFF - 29.05.2014
It should be something like this
Add this on the top:
pawn Код:
new place[MAX_PLAYERS];
new out[MAX_PLAYERS];
And this is how you get the place of a player:
pawn Код:
for(new i=0; i < MAX_PLAYERS; i++)
{
out[i] = 0:
}
new places = 1;
for(new p =0; p < MAX_PLAYERS; p++)
{
new kills = 0;
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(out[i] != 1)
{
if(roundkills[i] >= kills)
{
kills = roundkills[i];
place[i] = places;
out[i] = 1;
places ++;
}
}
}
}
U know everyone rank now all what u need to do is add them to the textdraw
For example if you want to sendclientmessage to the player that are on 6th place
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
if(place[i] == 6)
{
SendClientMessage(i,-1,"bla boa");
}
}
P.S haven't tested it if there's any errors tell me
Re: Leaderboard[kills] -
R0 - 29.05.2014
I could explain you how to make it,first of all,lets say you will make 15 slots,define :
Now,under the function that you use for ending round create textdraw ,and in it show:
pawn Код:
for(new i = 0; i < 15; i++) //i will make example for the first player with most kills
{
for(new p = 0; p < MAX_PLAYERS; p++)
{
new mostkills = 0;
if(Kills[p] > mostkills)
{
mostkills = Kills[p];
SlotUsed[0] = 1;
//Now get p's name and set it as the textdraw's string,do the same for the other slots...
}
}
}
Re: Leaderboard[kills] -
FeniX70 - 30.03.2015
Quote:
Originally Posted by R0
I could explain you how to make it,first of all,lets say you will make 15 slots,define :
Now,under the function that you use for ending round create textdraw ,and in it show:
pawn Код:
for(new i = 0; i < 15; i++) //i will make example for the first player with most kills { for(new p = 0; p < MAX_PLAYERS; p++) { new mostkills = 0; if(Kills[p] > mostkills) { mostkills = Kills[p]; SlotUsed[0] = 1; //Now get p's name and set it as the textdraw's string,do the same for the other slots... } } }
|
So how you make this in textdraw? little example to help us kind of out please, for the beginners like me!
Re: Leaderboard[kills] -
SickAttack - 30.03.2015
pawn Код:
stock quickSort(array[], left, right)
{
/*new
array[] = { -541, 54, 689, 12, 3, 0, 3, 55, 66, -541, 5468484, -564, 1554, 1656 }
;
quickSort(array, 0, sizeof(array) - 1);
for(new i; i != sizeof(array); ++i)
{
printf("%d", array[i]);
}*/
new templeft = left, tempright = right, pivot = array[(left + right) / 2], tempvar;
while(templeft <= tempright)
{
while(array[templeft] < pivot) templeft ++;
while(array[tempright] > pivot) tempright --;
if(templeft <= tempright)
{
tempvar = array[templeft], array[templeft] = array[tempright], array[tempright] = tempvar;
templeft ++, tempright --;
}
}
if(left < tempright) quickSort(array, left, tempright);
if(templeft < right) quickSort(array, templeft, right);
}