cmd:admins
#9

pawn Код:
COMMAND:admins(playerid, params[])
{
    SendAdminText(playerid, "/admins", params);
    if(!APlayerData[playerid][LoggedIn]) return SendClientMessage(playerid, 0xFF0000FF, "REPORT THIS TO ADMIN");
    new count = 0, AdminList[750];
    for(new i = 0, j = GetPlayerPoolSize(); i != j; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(!APlayerData[i][PlayerLevel]) continue;
        new fstr[75], Name[MAX_PLAYER_NAME];
        GetPlayerName(i, Name, sizeof(Name));
        format(fstr, sizeof(fstr), "%s: %s (id: %i), admin-level: %i", AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]);
        strcat(fstr, (IsPlayerAdmin(i)) ? ("(RCON admin)\n") : ("\n"));
        strcat(AdminList, fstr);
        count++;
        if(count >= 10) break;
    }
    if(!count) return SendClientMessage(playerid, 0xFF0000FF, "No admin online");
    ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Online admins:", AdminList, "OK", "Cancel");
    return 1;
}
Make sure your 'new AdminLevelName' elements do not exceed your maximum admin level.

Example: If your maximum admin level is 10, AdminLevelName should be 11. (Unless you want to take 1 from the variable in the code - eg. AdminLevelName[APlayerData[i][PlayerLevel] - 1])
Reply


Messages In This Thread
cmd:admins - by kalanerik99 - 12.05.2015, 19:16
Re: cmd:admins - by Yashas - 12.05.2015, 19:19
Re: cmd:admins - by C4SH - 12.05.2015, 19:26
Re: cmd:admins - by Konstantinos - 12.05.2015, 19:27
Re: cmd:admins - by StR_MaRy - 12.05.2015, 19:27
Re: cmd:admins - by Abagail - 12.05.2015, 19:29
Re: cmd:admins - by Yashas - 12.05.2015, 19:31
Re: cmd:admins - by J0sh... - 12.05.2015, 19:34
Re: cmd:admins - by Threshold - 13.05.2015, 04:34
Re: cmd:admins - by kalanerik99 - 13.05.2015, 16:07

Forum Jump:


Users browsing this thread: 1 Guest(s)