Код:
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);
}