if (strcmp(cmd, "/admins", true) == 0)
{
new count = 0, dialog1[1000], adm[64], adm1[25];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (AccountData[i][pAdmin] >= 0)
{
if (ModociaAdm3000[i] == 0)
{
switch (AccountData[i][pAdmDuty])
{
case 0:
{
if (AccountData[i][pAdmin] == 0)
{
format(adm, sizeof(adm), "Moderador: %s [Trabalhando]\n", GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
else if (AccountData[i][pAdmin] >= 1)
{
format(adm, sizeof(adm), "Admin [%d]: %s [Trabalhando]\n", AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
}
case 1:
{
if (AccountData[i][pAdmin] == 0)
{
format(adm, sizeof(adm), "Moderador: %s [Jogando]\n", GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
else if (AccountData[i][pAdmin] >= 1)
{
format(adm, sizeof(adm), "Admin [%d]: %s [Jogando]\n", AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog1, adm1, sizeof dialog1);
count++;
}
}
}
}
}
if (count == 0) ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "ERRO", "Nгo hб nenhum admin/moderador online", "Fechar", "");
}
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog1, "Fechar", "");
return 1;
}
if(!strcmp(cmdtext, "/admins", true)){
static
bool: Working,
dialog[667],
str[100]
;
Working = false;
dialog[0] = EOS;
str[0] = EOS;
for(new i, e = GetPlayerPoolSize(); i != e; ++i){
if(AccountData[i][pAdmin] > 0){
format(str, 100, "%s [%d]: %s [%s]\n", !AccountData[i][pAdmin] ? ("Moderador") : ("Admin"), AccountData[i][pAdmDuty] ? ("Trabalhando") : ("Jogando"), AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog, str);
Working = true;
}
}
if(!Working){
format(dialog, sizeof(dialog), "Nгo hб nenhum admin/moderador online");
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog, "Fechar", "");
return true;
}
if(!strcmp(cmdtext, "/admins", true))
{
static
bool: Working,
dialog[667],
str[100]
;
Working = false;
dialog[0] = EOS;
str[0] = EOS;
for(new i, e = GetPlayerPoolSize(); i != e; ++i)
{
if(AccountData[i][pAdmin] > 0){
format(str, 100, "%s [%d]: %s [%s]\n", !AccountData[i][pAdmin] ? ("Moderador") : ("Admin"), AccountData[i][pAdmDuty] ? ("Trabalhando") : ("Jogando"), AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog, str);
Working = true;
}
}
if(Working == false) format(dialog, sizeof(dialog), "Nгo hб nenhum admin/moderador online");
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog, "Fechar", "");
return true;
}
zSuYaNw, eu dei uma modificada no comando, mais tem apenas um problema, quando tem admin/moderador online aparece o dialogo com "Nгo hб nenhum admin/moderador online", em veis de aparece o nome da pessoa, como eu faзo para deixar a mensagem apenas com "Nгo hб nenhum admin/moderador online" para quando n tiver mesmo admin online e quando tiver, mostrar os admins.
Cуdigo atual: PHP код:
|
if(!strcmp(cmdtext, "/admins", true))
{
static
bool: Working,
dialog[667],
str[100]
;
Working = false;
dialog[0] = EOS;
str[0] = EOS;
for(new i, e = GetPlayerPoolSize(); i != e; ++i)
{
if(AccountData[i][pAdmin] > 0){
format(str, 100, "%s [%d]: %s [%s]\n", !AccountData[i][pAdmin] ? ("Moderador") : ("Admin"), AccountData[i][pAdmDuty] ? ("Trabalhando") : ("Jogando"), AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog, str);
Working = true;
}
}
if(Working == false) return ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", "Nenhum administrador online :/", "Fechar", "");
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog, "Fechar", "");
return true;
}
Ao meu ver, o comando parece estar correcto.
Mande o comando que dб nнvel de administrador. |
if(!strcmp(cmdtext, "/admins", true)){
static
bool: Working,
dialog[667],
str[100]
;
Working = false;
dialog[0] = EOS;
str[0] = EOS;
for(new i, e = GetPlayerPoolSize(); i != e; ++i){
if(AccountData[i][pAdmin] > 0){ // AccountData[playerid][pAdmin]
format(str, 100, "%s [%d]: %s [%s]\n", !AccountData[i][pAdmin] ? ("Moderador") : ("Admin"), AccountData[i][pAdmDuty] ? ("Trabalhando") : ("Jogando"), AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog, str); printf(str);
Working = true;
}
}
if(!Working){
format(dialog, sizeof(dialog), "Nгo hб nenhum admin/moderador online");
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog, "Fechar", "");
return true;
}
Testa aн e manda oque aparece no Console do jogador..
pawn Код:
|
if(!strcmp(cmdtext, "/admins", true)){
static
bool: Working,
dialog[667],
str[100]
;
Working = false;
dialog[0] = EOS;
str[0] = EOS;
for(new i, e = GetPlayerPoolSize(); i != e; ++i){ printf("DEBUG LVL: %d", AccountData[i][pAdmin]);
if(AccountData[i][pAdmin] >= 0){ // AccountData[playerid][pAdmin]
format(str, 100, "%s [%d]: %s [%s]\n", !AccountData[i][pAdmin] ? ("Moderador") : ("Admin"), AccountData[i][pAdmDuty] ? ("Trabalhando") : ("Jogando"), AccountData[i][pAdmin], GetPlayerNameRP(i));
strcat(dialog, str);
Working = true;
}
}
if(!Working){
format(dialog, sizeof(dialog), "Nгo hб nenhum admin/moderador online");
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Administraзгo", dialog, "Fechar", "");
return true;
}