Posts: 131
Threads: 29
Joined: Mar 2014
Quote:
Originally Posted by LeXuZ
Hello, i have been having to problem, when i use /admins it shows the user who typed the command as the admin, but no other admin shows on there, don't get where it's gone wrong.
Код:
CMD:admins(playerid, params[])
{
foreach(Player, i)
{
new string[256], name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
if(pInfo[i][Adminlevel ] > 0)
{
format(string, sizeof(string), "%s %s\n", AdminLevelName(playerid), name);
ShowPlayerDialog(playerid, DIALOG_ONLINE_ADMINS, DIALOG_STYLE_MSGBOX, "Admins online", string, "Close", "");
}
}
return 1;
}
|
pawn Код:
CMD:admins(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 2)
{
new AdminString[1500];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[i][AdminLevel] >= 1)
{
if(IsPlayerAdmin(i))
{
AdmRank = "{FF0000}RCON {FFFFFF}Administrator";
}
else
{
switch(PlayerInfo[i][AdminLevel])
{
case 1:
{
AdmRank = "{00FF00}Trial {FFFFFF}Admin";
}
case 2:
{
AdmRank = "{FFFFFF}Basic {FF0000}Moderator";
}
case 3:
{
AdmRank = "{FF0000}Moderator";
}
case 4:
{
AdmRank = "Master {FF0000}Moderator";
}
case 5:
{
AdmRank = "{FFFFFF}Administrator";
}
case 6:
{
AdmRank = "{FF0000}Master {FFFFFF}Administrator";
}
case 7:
{
AdmRank = "{00FF00}Professional {FFFFFF}Administrator";
}
case 8:
{
AdmRank = "{0000FF}Server {FFFFFF}Mapper";
}
case 9:
{
AdmRank = "{0000FF}Server {FF00FF}Beta Tester";
}
case 10:
{
AdmRank = "{0000FF}Server {00FF00}Owner";
}
}
}
new file[300];
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
format(file,sizeof(file),"nAdmin/Users/%s.ini",name);
PlayerInfo[i][AdminLevel] = dini_Int(file, "AdminLevel");
format(AdminString, sizeof(AdminString), "%s{FF00FF}Level: {FF0000}%d {FF00FF}- {00FF00}%s (Id:{FF0000}%i{00FF00}) {FF00FF}| %s \n",AdminString, PlayerInfo[i][AdminLevel], PlayerName2(i),i,AdmRank);
ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", AdminString, "OK", "");
count++;
}
}
}
if (count == 0)
{
ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", "No online admins", "OK", "");
}
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: you need to be atleast Admin Level 2 to view the Admins List");
return 1;
}
Try Like this
Posts: 302
Threads: 56
Joined: Oct 2014
Reputation:
0
Why are you writing it like that when it could be so much smaller and simpler..
Posts: 184
Threads: 22
Joined: Feb 2014
Reputation:
0
You use showdialog each time in the foreach loop, instead of putting all admins in 1 line and then putting that in your dialog.
Posts: 3,934
Threads: 353
Joined: Jan 2010
Reputation:
0
My post relates to yours in no way whatsoever.