26.11.2014, 19:21
Quote:
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;
}