20/10/2024 02:37
queria saber como posso quebrar a linha para o nome ficar em baixo do outro
pois aqui format(string, sizeof(string), "%d %s\n", i + 1, playerName, CheckpointCount[ranks[i]]);
fica assim tudo na mesma linha 1 andre 2 aleatorio 3 aleatorio
pois queria que ficasse assim um abaixo do outro estou tentando mas ja nao sei oq fazer coloquei para ser exbido em uma textdraw sou leigo em pawno e queria ajuda
1 andre
2 aleatorio
3 blablabla
#include <a_samp>
new Text:TextdrawRank;
new CheckpointCount[MAX_PLAYERS];
public OnPlayerEnterRaceCheckpoint(playerid)
{
CheckpointCount[playerid]++;
UpdateRankings();
}
UpdateRankings()
{
new string[256];
new rankString[512];
rankString[0] = '\0';
new ranks[MAX_PLAYERS];
new rankCount = 0;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (CheckpointCount[i] > 0)
{
ranks[rankCount++] = i;
}
}
for (new i = 0; i < rankCount - 1; i++)
{
for (new j = i + 1; j < rankCount; j++)
{
if (CheckpointCount[ranks[i]] < CheckpointCount[ranks[j]])
{
new temp = ranks[i];
ranks[i] = ranks[j];
ranks[j] = temp;
}
}
}
for (new i = 0; i < rankCount && i < 5; i++) // Exibe apenas os 5 primeiros
{
new playerName[24];
GetPlayerName(ranks[i], playerName, sizeof(playerName));
format(string, sizeof(string), "%d %s\n", i + 1, playerName, CheckpointCount[ranks[i]]);
strcat(rankString, string);
}
TextDrawSetString(TextdrawRank, rankString);
}
public OnGameModeInit()
{
TextdrawRank = TextDrawCreate(10.000000, 200.000000, "Pocisao:\n");
TextDrawAlignment(TextdrawRank, 0);
TextDrawBackgroundColor(TextdrawRank, 0x000000ff);
TextDrawFont(TextdrawRank, 1);
TextDrawLetterSize(TextdrawRank, 0.300000, 1.100000);
TextDrawColor(TextdrawRank, 0xffffffff);
TextDrawSetOutline(TextdrawRank, 1);
TextDrawSetProportional(TextdrawRank, 1);
TextDrawSetShadow(TextdrawRank, 1);
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, TextdrawRank);
return 1;
}
pois aqui format(string, sizeof(string), "%d %s\n", i + 1, playerName, CheckpointCount[ranks[i]]);
fica assim tudo na mesma linha 1 andre 2 aleatorio 3 aleatorio
pois queria que ficasse assim um abaixo do outro estou tentando mas ja nao sei oq fazer coloquei para ser exbido em uma textdraw sou leigo em pawno e queria ajuda
1 andre
2 aleatorio
3 blablabla
#include <a_samp>
new Text:TextdrawRank;
new CheckpointCount[MAX_PLAYERS];
public OnPlayerEnterRaceCheckpoint(playerid)
{
CheckpointCount[playerid]++;
UpdateRankings();
}
UpdateRankings()
{
new string[256];
new rankString[512];
rankString[0] = '\0';
new ranks[MAX_PLAYERS];
new rankCount = 0;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (CheckpointCount[i] > 0)
{
ranks[rankCount++] = i;
}
}
for (new i = 0; i < rankCount - 1; i++)
{
for (new j = i + 1; j < rankCount; j++)
{
if (CheckpointCount[ranks[i]] < CheckpointCount[ranks[j]])
{
new temp = ranks[i];
ranks[i] = ranks[j];
ranks[j] = temp;
}
}
}
for (new i = 0; i < rankCount && i < 5; i++) // Exibe apenas os 5 primeiros
{
new playerName[24];
GetPlayerName(ranks[i], playerName, sizeof(playerName));
format(string, sizeof(string), "%d %s\n", i + 1, playerName, CheckpointCount[ranks[i]]);
strcat(rankString, string);
}
TextDrawSetString(TextdrawRank, rankString);
}
public OnGameModeInit()
{
TextdrawRank = TextDrawCreate(10.000000, 200.000000, "Pocisao:\n");
TextDrawAlignment(TextdrawRank, 0);
TextDrawBackgroundColor(TextdrawRank, 0x000000ff);
TextDrawFont(TextdrawRank, 1);
TextDrawLetterSize(TextdrawRank, 0.300000, 1.100000);
TextDrawColor(TextdrawRank, 0xffffffff);
TextDrawSetOutline(TextdrawRank, 1);
TextDrawSetProportional(TextdrawRank, 1);
TextDrawSetShadow(TextdrawRank, 1);
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, TextdrawRank);
return 1;
}