COMMAND:admins(playerid,params[]) { new count = 0; new string[128]; SendClientMessage(playerid,COLOR_RED,""); SendClientMessage(playerid,COLOR_GREEN,"________________|ONLINE ADMINS|________________"); SendClientMessage(playerid,COLOR_RED,""); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pAdmin] > 0) { if(PlayerInfo[i][pAdmin] == 1) { AdminRank = "Moderator"; } else if(PlayerInfo[i][pAdmin] == 2) { AdminRank = "General Administrator"; } else if(PlayerInfo[i][pAdmin] == 3) { AdminRank = "Senior Administrator"; } else if(PlayerInfo[i][pAdmin] == 4) { AdminRank = "Server Owner"; } new Name[MAX_PLAYER_NAME]; GetPlayerName(i,Name,sizeof(Name)); format(string, sizeof(string), "Level: %d | Name: %s (ID:%i) | Rank: %s ", PlayerInfo[i][pAdmin], Name,i,AdminRank); SendClientMessage(playerid,COLOR_CYAN,string); count++; } } } if(count == 0) SendClientMessage(playerid,COLOR_RED,"No Admins online!"); SendClientMessage(playerid,COLOR_GREEN,"_________________________________________________"); return 1; }
COMMAND:admins(playerid,params[])
{
new count = 0;
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
if(PlayerInfo[i][pAdmin] == 1)
{
AdminRank = "Moderator";
}
else if(PlayerInfo[i][pAdmin] == 2)
{
AdminRank = "General Administrator";
}
else if(PlayerInfo[i][pAdmin] == 3)
{
AdminRank = "Senior Administrator";
}
else if(PlayerInfo[i][pAdmin] == 4)
{
AdminRank = "Server Owner";
}
new Name[MAX_PLAYER_NAME];
GetPlayerName(i,Name,sizeof(Name));
format(string, sizeof(string), "%sLevel: %d | Name: %s (ID:%i) | Rank: %s ", string,PlayerInfo[i][pAdmin], Name,i,AdminRank);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{00FF00}__|ONLINE ADMINS|__", string, "Close", "");
count++;
}
}
}
if(count == 0)
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{00FF00}__|ONLINE ADMINS|__", "Theres no admins online.", "Close", "");
return 1;
}
PHP код:
|
PHP код:
|
COMMAND:admins(playerid,params[])
{
new count = 0;
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
if(PlayerInfo[i][pAdmin] == 1)
{
AdminRank = "Moderator";
}
else if(PlayerInfo[i][pAdmin] == 2)
{
AdminRank = "General Administrator";
}
else if(PlayerInfo[i][pAdmin] == 3)
{
AdminRank = "Senior Administrator";
}
else if(PlayerInfo[i][pAdmin] == 4)
{
AdminRank = "Server Owner";
}
new Name[MAX_PLAYER_NAME];
GetPlayerName(i,Name,sizeof(Name));
format(string, sizeof(string), "%sLevel: %d | Name: %s (ID:%i) | Rank: %s \n %s", string,PlayerInfo[i][pAdmin], Name,i,AdminRank, string);
count++;
}
}
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{00FF00}__|ONLINE ADMINS|__", string, "Close", "");
if(count == 0)
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{00FF00}__|ONLINE ADMINS|__", "Theres no admins online.", "Close", "");
return 1;
}
this would not work, you should add the ShowPlayerDialog outside of the loop in order to smoothly make it work
like this PHP код:
|
COMMAND:admins(playerid,params[])
{
new count = 0;
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
if(PlayerInfo[i][pAdmin] == 1)
{
AdminRank = "Moderator";
}
else if(PlayerInfo[i][pAdmin] == 2)
{
AdminRank = "General Administrator";
}
else if(PlayerInfo[i][pAdmin] == 3)
{
AdminRank = "Senior Administrator";
}
else if(PlayerInfo[i][pAdmin] == 4)
{
AdminRank = "Server Owner";
}
new Name[MAX_PLAYER_NAME];
GetPlayerName(i,Name,sizeof(Name));
format(string, sizeof(string), "%sLevel: %d | Name: %s (ID:%i) | Rank: %s \n %s", string,PlayerInfo[i][pAdmin], Name,i,AdminRank, string);
count++;
}
}
}
if(count == 0)
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{00FF00}__|ONLINE ADMINS|__", "Theres no admins online.", "Close", "");
}
else
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{00FF00}__|ONLINE ADMINS|__", string, "Close", "");
}
return 1;
}