09.07.2012, 20:51
O que faзo para exibir os players que estгo sendo procurados em um dialogo?
procurado[playerid]=1;
/\ Esses sгo os players procurados.
procurado[playerid]=1;
/\ Esses sгo os players procurados.
new string[200], string2[200], Nome[24];
GetPlayerName(playerid, Nome, sizeof(Nome));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(procurado[i] > 0)
{
format(string, sizeof(string), "%s", Nome);
strcat(string, string2, sizeof(string));
}
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_MSGBOX, "Procurados", string, "Ok", "Fechar");
return 1;
}
if(!strcmp(cmdtext,"/procurados",true))
{
string[512],name[MAX_PLAYER_NAME],count;
for(new i; i < MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && procurado[i] != 0)
{
GetPlayerName(i, name, sizeof(name));
format(string,sizeof(string), "%s [%i]", name,i);
ShowPlayerDialog(playerid,1337, DIALOG_STYLE_MSGBOX, "• Lista de Procurados •",string, "FECHAR", "");
count++;
}
if(count == 0)
ShowPlayerDialog(playerid,1337, DIALOG_STYLE_MSGBOX, "• Lista de Procurados •","Nenhum Procurado", "FECHAR", "");
}
return 1;
}
pawn Код:
|
if(!strcmp(cmdtext,"/procurados",true))
{
new string[512],name[MAX_PLAYER_NAME],count;
for(new i; i < MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && procurado[i] != 0)
{
GetPlayerName(i, name, sizeof(name));
format(string,sizeof(string), "%s [%i]", name,i);
count++;
}
ShowPlayerDialog(playerid,1337, DIALOG_STYLE_MSGBOX, "• Lista de Procurados •",string, "FECHAR", "");
if(count == 0)
ShowPlayerDialog(playerid,1337, DIALOG_STYLE_MSGBOX, "• Lista de Procurados •","Nenhum Procurado", "FECHAR", "");
}
return 1;
}
tente assim:
pawn Код:
|
tente assim:
pawn Код:
|
if(!strcmp(cmdtext, "/procurados", true))
{
new
arm[500],
Nome[24]
;
for(new i, e = GetMaxPlayers(); i != e;++i)
{
if(procurado[i] > 0)
{
GetPlayerName(i, Nome, sizeof(Nome));
strcat(arm, Nome);
}
}
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_LIST, "Procurados", arm, "Ok", "Fechar");
return true;
}
if(!strcmp(cmdtext, "/procurados", true))
{
new dialog[256], nome[MAX_PLAYER_NAME];
foreach(Player, i)
{
if(GetPlayerWantedLevel(i) > 0)
{
GetPlayerName(i, nome, MAX_PLAYER_NAME);
format(dialog, sizeof dialog, "%s%s (%i)", dialog, nome, GetPlayerWantedLevel(i));
}
}
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "PROCURADOS", dialog, "Ok", "Sair");
return 1;
}
Outro modo
![]() pawn Код:
|
if(!strcmp(cmdtext, "/procurados", true))
{
// Cria arrays
new dialog[256], nome[MAX_PLAYER_NAME];
// Faz um loooping de player(que estб errado pela ъltima atualizaзгo)
foreach(Player, i)
{
// Verifica se o level de procurado й maior que 0
if(GetPlayerWantedLevel(i) > 0)
{
// Pega o nome do player e armazena na variбvel nome.
GetPlayerName(i, nome, MAX_PLAYER_NAME);
// Formata a string, dialog com o nome do player e level de procurado e tambйm a prуpria dialog
format(dialog, sizeof dialog, "%s%s (%i)", dialog, nome, GetPlayerWantedLevel(i));
}
}
// Exibe oque estб armazenado na array "dialog".
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "PROCURADOS", dialog, "Ok", "Sair");
return 1;
}
if(!strcmp(cmdtext, "/procurados", true))
{
#define sStatic::%0<%1> \
static %0[%1]; %0[0] = '\0'
#define iStatic::<%0> static %0; %0 = 0
sStatic::arm<500>;
sStatic::Nome<24>;
iStatic::<i>;
iStatic::<e>;
for(e = GetMaxPlayers(); i != e; ++i)
{
if(procurado[i] > 0)
{
GetPlayerName(i, Nome, sizeof(Nome));
strcat(arm, Nome);
}
}
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_LIST, "Procurados", arm, "Ok", "Fechar");
return true;
}