if(!strcmp(cmdtext, "/recorde", true))
{
new Scor[MAX_PLAYERS];
for(new i; i != MAX_PLAYERS; ++i) Scor[i] = GetPlayerScore(i);
BubbleSort(Scor, sizeof(Scor));
for(new i; i != 1; i++)
{
format(string, sizeof(string),"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MATA MATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
SendClientMessage(playerid, Verde, string);
format(string, sizeof(string),"~> O jogador conectado com o level mais alto й: %s (ID %d) (Level: %d).", PlayerName(i),i,Scor[i]);
SendClientMessage(playerid, Branco, string);
format(string, sizeof(string),"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MATA MATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
SendClientMessage(playerid, Verde, string);
}
return 1;
}
new Float: Lataria;
GetVehicleHealth(PlayerVehicleModelID, Lataria);
format(string,sizeof(string)," ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~g~LATARIA:~w~%d", Lataria);
TextDrawSetString(LatariaVeiculo[i], string);//latariaaqui
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/recorde", true) == 0)
{
MaiorNivel()
return 1;
}
return 1;
}
MaiorNivel()
{
new
PlayerID = -1,
MaiorLevel,
string[128]
;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i))
continue
;
if(GetPlayerScore(i) > MaiorLevel)
{
PlayerID = i;
MaiorLevel = GetPlayerScore(i);
}
}
if(PlayerID == -1)
return
;
new Name[MAX_PLAYER_NAME];
GetPlayerName(PlayerID, Name, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s (ID: %d) [Level: %d] й o player com o maior nнvel conectado no servidor!", Name, PlayerID, GetPlayerScore(i));
SendClientMessageToAll(-1, string);
}
Olб, boa noite tou com dois problemas serio no meu servidor.
1є Comando que nгo funciona direito. ( quando digito /recorde ele pega o level mais auto do server e o id do outro jogador sem ser que ta com level auto). PHP код:
2є o segundo problema й a questгo da lataria. (que fica nesse numero grande) https://imgur.com/a/di4akmY PHP код:
|
PHP код:
|
Corrija isso
GetPlayerScore(i)); por isso GetPlayerScore(PlayerID)); |
MaiorNivel()
{
new MaiorLevelID = INVALID_PLAYER_ID, string[128];
for(new x = 0, j = GetPlayerPoolSize(); x <= j; ++x)
{
if(IsPlayerConnected(j))
{
if(GetPlayerScore(j) > GetPlayerScore(MaiorLevelID)) MaiorLevelID = j;
}
}
new Name[MAX_PLAYER_NAME];
GetPlayerName(MaiorLevelID, Name, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s (ID: %d) [Level: %d] й o player com o maior nнvel conectado no servidor!", Name, MaiorLevelID, GetPlayerScore(MaiorLevelID));
SendClientMessageToAll(-1, string);
}
if(!strcmp(cmdtext, "/recorde", true)) { new Score[MAX_PLAYERS][2], count = 0; //na prбtica o count й um contador de players online for(new i; i != MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Score[count][0] = GetPlayerScore(i), Score[count][1] = i, count++; //Use foreach aqui para ser mais performatico //caso use ou vб usar a foreach, basta substituir "for(new i; i != MAX_PLAYERS; i++) if(IsPlayerConnected(i))" por "foreach(Players, i)" SelectionSort(Score, count); //faz um selection sort pela variбvel bidimensional 'Score' que armazena o Level e o ID dos players SendClientMessage(playerid, Verde, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MATA MATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); for(new i; i != 1; i++) { format(string, sizeof(string), "~> O jogador conectado com o level mais alto й: %s (ID %d) (Level: %d).", PlayerName(Score[i][1]), Score[i][1], Score[i][0]); SendClientMessage(playerid, Branco, string); } SendClientMessage(playerid, Verde, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MATA MATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); return 1; } #define TrocarPosicao(%0,%1) (%0 ^= %1, %1 ^= %0, %0 ^= %1) stock SelectionSort(var_sort[][], size) { new i, j, aux; for(i = 0; i < (size-1); i++) { aux = i; for(j = (i+1); j < size; j++) if(var_sort[j][0] > var_sort[aux][0]) aux = j; if (i != aux) TrocarPosicao(var_sort[i][0], var_sort[aux][0]), TrocarPosicao(var_sort[i][1], var_sort[aux][1]); } }