pawn Код:
COMMAND:admins(playerid, params[])
{
SendClientMessage(playerid, 0x80FF00FF, "Online admins:");
for(new i; i != GetMaxPlayers(); ++i)
{
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i))
{
new pName[MAX_PLAYER_NAME], adminsMessage[100], finalMessage[500];
GetPlayerName(playerid, pName, sizeof(pName));
format(adminsMessage, sizeof(adminsMessage), "%s(%d)\n", pName, playerid);
strcat(finalMessage, adminsMessage);
ShowPlayerDialog(playerid, 1000, DIALOG_STYLE_MSGBOX, "Online Admins", finalMessage, "Okay", "");
}
}
}
return 1;
}
Not tested, and works with ZCMD, I can convert it to strcmp if you wish. But it would be easier with messages, here is my somewhat overdone command for my server. Please tell me if it doesn't work so I can fix it for you.
pawn Код:
COMMAND:admins(playerid, params[])
{
new bool:adminOnline;
foreach(new i : Player) { if(P_DATA[i][AdminLevel] >= 1) { adminOnline = true; } }
if(adminOnline == true)
{
SendClientMessage(playerid, COLOR_WHITE, "List of online admins:");
foreach(new i : Player)
{
if(P_DATA[i][AdminLevel] >= 1)
{
new iRank[20], iAdmin[80];
switch(P_DATA[i][AdminLevel])
{
case 1: iRank = "Junior Moderator";
case 2: iRank = "Moderator";
case 3: iRank = "Administrator";
case 4: iRank = "Head Administrator";
case 5: iRank = "Owner";
default: iRank = "Unknown";
}
format(iAdmin, sizeof(iAdmin), EMBED_GREEN"%s(%d)"EMBED_WHITE" Rank - %s - Level %d", ReturnPlayerName(i), i, iRank, P_DATA[i][AdminLevel]);
SendClientMessage(playerid, COLOR_WHITE, iAdmin);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "No admins are currently online!");
}
return 1;
}
The 'PAWN' tags somehow screwed up the syntax of the code.