Top 5 players (with score) by Ryder into top 5 kills?
#1

Hey guys, I was searching for something like this. I finally found it but I needed it with kills. I have my kills defined as pInfo[MAX_PLAYERS][pkills]. Can somebody tell me how to convert this into a top 5 killers list? Thanks.
Reply
#2

Код:
new bool:Top10ShowForPlayer[MAX_PLAYERS] = false;
new Text:Moneytop10,
	Text:Scoretop10;
forward Updatetoplist();
forward LoadTop10Richlist();
forward LoadTop10Scoredlist();
CMD:top10(playerid,params[])
{
    	if(Top10ShowForPlayer[playerid] == false)
    	{
	   	 	Top10ShowForPlayer[playerid] = true;
			TextDrawShowForPlayer(playerid,Moneytop10);
			TextDrawShowForPlayer(playerid,Scoretop10);
		}
		else
		{
 			Top10ShowForPlayer[playerid] = false;
		 	TextDrawHideForPlayer(playerid,Moneytop10);
		 	TextDrawHideForPlayer(playerid,Scoretop10);
		}
		return 1;
}
stock LoadTextDraws()
{
	Moneytop10  = TextDrawCreate(90,190,"~r~~h~Servers Top 10 Rich Players");
	TextDrawFont(Moneytop10 ,2);
	TextDrawLetterSize(Moneytop10 , 0.26634737241, 1.046);
	TextDrawTextSize(Moneytop10,300,300.5);
	TextDrawColor(Moneytop10,/*0x500C0CFF*/0x33FF06FF);
	TextDrawSetOutline(Moneytop10 , 1);
	TextDrawSetProportional(Moneytop10 , 1);
	TextDrawSetShadow(Moneytop10, 2);
	TextDrawBackgroundColor(Moneytop10,0x000000AA);
	TextDrawUseBox(Moneytop10,1);
	TextDrawBoxColor(Moneytop10,0x00FAFA30);

	Scoretop10  = TextDrawCreate(305.5,190,"~r~~h~Servers High Scored Top 10 Players~n~1. Tester~n~2. Tester2");
	TextDrawFont(Scoretop10 ,2);
	TextDrawLetterSize(Scoretop10 , 0.26634737241, 1.046);
	TextDrawTextSize(Scoretop10,540,300.5);
	TextDrawColor(Scoretop10,/*0x500C0CFF*/0x33FF06FF);
	TextDrawSetOutline(Scoretop10, 1);
	TextDrawSetProportional(Scoretop10, 1);
	TextDrawSetShadow(Scoretop10, 2);
	TextDrawBackgroundColor(Scoretop10,0x000000AA);
	TextDrawUseBox(Scoretop10,1);
	TextDrawBoxColor(Scoretop10,0x00FAFA30);
}
public Updatetoplist()
{
    LoadTop10Richlist();
    LoadTop10Scoredlist();
    return 1;
}
public LoadTop10Richlist()
{
	new Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1,Slot5 = -1;
    new HighestCash = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x))
	if(GetPlayerMoney(x) >= HighestCash)
	{
		HighestCash = GetPlayerMoney(x);
		Slot1 = x;
	}
	HighestCash = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1)
	if(GetPlayerMoney(x) >= HighestCash)
	{
		HighestCash = GetPlayerMoney(x);
		Slot2 = x;
	}
	HighestCash = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1 && x != Slot2)
	if(GetPlayerMoney(x) >= HighestCash)
	{
		HighestCash = GetPlayerMoney(x);
		Slot3 = x;
	}
	HighestCash = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3)
	if(GetPlayerMoney(x) >= HighestCash)
	{
		HighestCash = GetPlayerMoney(x);
		Slot4 = x;
	}
	HighestCash = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3 && x != Slot4)
	if(GetPlayerMoney(x) >= HighestCash)
	{
		HighestCash = GetPlayerMoney(x);
		Slot5 = x;
	}
	if(Slot1 != -1)
	{
		format(RichlistString, sizeof(RichlistString), "~w~~h~Servers Top 5 Rich Players~n~~r~~h~1. %s(%d): $%d", pName(Slot1),Slot1,GetPlayerMoney(Slot1));
	}
	if(Slot2 != -1)
	{
		format(RichlistString, sizeof(RichlistString), "~w~~h~Servers Top 5 Rich Players~n~~r~~h~1. %s(%d): $%d ~n~2. %s(%d): $%d",pName(Slot1),Slot1,GetPlayerMoney(Slot1),pName(Slot2),Slot2,GetPlayerMoney(Slot2));
 	}
	if(Slot3 != -1)
	{
		format(RichlistString, sizeof(RichlistString), "~w~~h~Servers Top 5 Rich Players~n~~r~~h~1. %s(%d): $%d~n~2. %s(%d): $%d~n~3. %s(%d): $%d",pName(Slot1),Slot1,GetPlayerMoney(Slot1),pName(Slot2),Slot2,GetPlayerMoney(Slot2),pName(Slot3),Slot3,GetPlayerMoney(Slot3));
	}
	if(Slot4 != -1)
	{
		format(RichlistString, sizeof(RichlistString), "~w~~h~Servers Top 5 Rich Players~n~~r~~h~1. %s(%d): $%d~n~2. %s(%d): $%d~n~3. %s(%d): $%d~n~4. %s(%d): $%d",pName(Slot1),Slot1,GetPlayerMoney(Slot1),pName(Slot2),Slot2,GetPlayerMoney(Slot2),pName(Slot3),Slot3,GetPlayerMoney(Slot3),pName(Slot4),Slot4,GetPlayerMoney(Slot4));
	}
	if(Slot5 != -1)
	{
		format(RichlistString, sizeof(RichlistString), "~w~~h~Servers Top 5 Rich Players~n~~r~~h~1. %s(%d): $%d~n~2. %s(%d): $%d~n~3. %s(%d): $%d~n~4. %s(%d): $%d~n~5. %s(%d): $%d",pName(Slot1),Slot1,GetPlayerMoney(Slot1),pName(Slot2),Slot2,GetPlayerMoney(Slot2),pName(Slot3),Slot3,GetPlayerMoney(Slot3),pName(Slot4),Slot4,GetPlayerMoney(Slot4),pName(Slot5),Slot5,GetPlayerMoney(Slot5));
	}
	return TextDrawSetString(Moneytop10,RichlistString);
}
public LoadTop10Scoredlist()
{
	new Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1,Slot5 = -1;
    new HighestScore = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x))
	if(GetPlayerScore(x) >= HighestScore)
	{
		HighestScore = GetPlayerScore(x);
		Slot1 = x;
	}
	HighestScore = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1)
	if(GetPlayerScore(x) >= HighestScore)
	{
		HighestScore = GetPlayerScore(x);
		Slot2 = x;
	}
	HighestScore = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1 && x != Slot2)
	if(GetPlayerScore(x) >= HighestScore)
	{
		HighestScore = GetPlayerScore(x);
		Slot3 = x;
	}
	HighestScore = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3)
	if(GetPlayerScore(x) >= HighestScore)
	{
		HighestScore = GetPlayerScore(x);
		Slot4 = x;
	}
	HighestScore = -9999;
	for(new x=0; x<MAX_PLAYERS; x++)
	if(IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3 && x != Slot4)
	if(GetPlayerScore(x) >= HighestScore)
	{
		HighestScore = GetPlayerScore(x);
		Slot5 = x;
	}
	if(Slot1 != -1)
	{
		format(ScorelistString, sizeof(ScorelistString), "~w~~h~Servers Top 5 Scored Players~n~~r~~h~1. %s(%d): %d", pName(Slot1),Slot1,GetPlayerScore(Slot1));
	}
	if(Slot2 != -1)
	{
		format(ScorelistString, sizeof(ScorelistString), "~w~~h~Servers Top 5 Scored Players~n~~r~~h~1. %s(%d): %d ~n~2. %s(%d): %d",pName(Slot1),Slot1,GetPlayerScore(Slot1),pName(Slot2),Slot2,GetPlayerScore(Slot2));
 	}
	if(Slot3 != -1)
	{
		format(ScorelistString, sizeof(ScorelistString), "~w~~h~Servers Top 5 Scored Players~n~~r~~h~1. %s(%d): %d~n~2. %s(%d): %d~n~3. %s(%d): %d",pName(Slot1),Slot1,GetPlayerScore(Slot1),pName(Slot2),Slot2,GetPlayerScore(Slot2),pName(Slot3),Slot3,GetPlayerScore(Slot3));
	}
	if(Slot4 != -1)
	{
		format(ScorelistString, sizeof(ScorelistString), "~w~~h~Servers Top 5 Scored Players~n~~r~~h~1. %s(%d): %d~n~2. %s(%d): %d~n~3. %s(%d): $%d~n~4. %s(%d): %d",pName(Slot1),Slot1,GetPlayerScore(Slot1),pName(Slot2),Slot2,GetPlayerScore(Slot2),pName(Slot3),Slot3,GetPlayerScore(Slot3),pName(Slot4),Slot4,GetPlayerScore(Slot4));
	}
	if(Slot5 != -1)
	{
		format(ScorelistString, sizeof(ScorelistString), "~w~~h~Servers Top 5 Scored Players~n~~r~~h~1. %s(%d): %d~n~2. %s(%d): %d~n~3. %s(%d): %d~n~4. %s(%d): %d~n~5. %s(%d): %d",pName(Slot1),Slot1,GetPlayerScore(Slot1),pName(Slot2),Slot2,GetPlayerScore(Slot2),pName(Slot3),Slot3,GetPlayerScore(Slot3),pName(Slot4),Slot4,GetPlayerScore(Slot4),pName(Slot5),Slot5,GetPlayerScore(Slot5));
	}
	return TextDrawSetString(Scoretop10,ScorelistString);
}
Not tested, hope this help and +rep !
Reply
#3

Sorry but I said top 5 kills and to edit/convert it. Not to copy paste it from another script. Anyways, thanks for the help.
Reply
#4

It's copied from my server, anyway , np..
Reply
#5

Yeah, thanks for the help.
Reply
#6

Every X seconds under probably a timer OR under OnPlayerDeath, (whenever one player kills another) you sort the kills using quicksort, or the include Slice made, or you can even do your own. Just make sure it's fast. Then the top 5, you simply format them into a textdraw! Either use 5 different textdraws, or insert ~n~ after every player. (a loop and strins)
Reply
#7

error 017: undefined symbol "RichlistString"
Reply
#8

Quote:
Originally Posted by FatihBey
Посмотреть сообщение
error 017: undefined symbol "RichlistString"
Thanks for bumping 55555555 years old thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)