How to fix my /admins
#1

I made This code but when there more than 2 admins online the server owner and scripter thin is printed again and again. I mean if there are 2 admins its printed 2 times and if there are 3 3 times and its annoying Can anyone help me please

Код:
CMD:admins(playerid, params[])
{
    #pragma unused params
    new
        count = 0,
        string[800],
        AdmRank[500];		

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Hide] == 0)
            {
                if(IsPlayerAdmin(i)) AdmRank ="{F3FF02}[The Server Guy!]";
                else
                {
                    switch(PlayerInfo[i][Level])
                    {
                        case 1: AdmRank = "{FFD700}[Trial Admin]";
                        case 2: AdmRank = "{FF4500}[Server Admin]";
                        case 3: AdmRank = "{1E90FF}[Senior Admin]";
                        case 4: AdmRank = "{0000CD}[Lead Admin]";
                        case 5: AdmRank = "{00FF00}[Head Admin]";
                        case 6: AdmRank = "{4B0082}[Server Manager]";
                        case 7: AdmRank = "{F08080}[Server Co-Owner]";
                        case 8: AdmRank = "{FF1493}[Sever Owner]";
                        case 9: AdmRank = "{800000}[Community Co-Owner]";
                        case 10: AdmRank = "{FF0000}[Community Owner]";
                    }


                    new nameee[128];
                    GetPlayerName(i, nameee, 16);
                    if(!strcmp(nameee, "[XP]IzZaN", true))
                    GetPlayerName(i, nameee, 16);
                    if(!strcmp(nameee, "Admin", true))
                    GetPlayerName(i, nameee, 16);
                    if(!strcmp(nameee, "[XP]IzZaN", true))
                    {
                      AdmRank = "{B22222}[Community Owner And Scripter]";
                    }
                    GetPlayerName(i, nameee, 16);
                    if(!strcmp(nameee, "NONE-NOBODY", true))
                    {
                      AdmRank = "{FF4500}[Server Owner]";
                    }
                    if(!strcmp(nameee, "NONE-NOBODY", true))
                    {
                      AdmRank = "{FF4500}[Co-Owner]";
                    }
                    GetPlayerName(i, nameee, 16);
                    if(!strcmp(nameee, "[XP]Perfect_Boy", true))
                    {
                      AdmRank = "{FA8072}[Community Owner]";
                    }
                }
               format(string, 500, ""cred"\nServer Scripter: [XP]IzZaN\n\n Server Owner [XP]Perfect_Boy\n\n\n%s{F81414}%s [ID:%i] | Level: %d - %s\n\n", string, PlayerName2(i), i, PlayerInfo[i][Level], AdmRank);
                //We are appending the string, so put %s before any new data is added,
                //and that parameter actually refers to the string itself.
                count++;
            }
        }
    }
Reply
#2

How are you actually sending the dialog?
Reply
#3

Код:
format(string, 500, ""cred"\nServer Scripter: [XP]IzZaN\n\n Server Owner [XP]Perfect_Boy\n\n\n%s{F81414}%s [ID:%i] | Level: %d - %s\n\n", string, PlayerName2(i), i, PlayerInfo[i][Level], AdmRank);
Reply
#4

I don't understand why've you got all the GetPlayerName things? I mean seeing that admin dialog would really annoy me as a player. It's not even aligned.
Reply
#5

Код:
if (count == 0) ShowPlayerDialog(playerid, 800, DIALOG_STYLE_MSGBOX, "{F81414}RWW2 - Online Admins :", "{00FFEE}No Admins Are Online in Server\n\n{00FF00}COD - RWW2 ", "Close", "");
    else ShowPlayerDialog(playerid, 800, DIALOG_STYLE_MSGBOX, "{F81414}RWW2 - Online Admins :", string, "Close", "");
Reply
#6

pawn Код:
CMD:admins(playerid, params[])
{
    new count = 0, string[760];
    for(new i = 0, j = GetPlayerPoolSize(); i != j; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(PlayerInfo[i][Hide] || !PlayerInfo[i][Level]) continue;
        new nameee[MAX_PLAYER_NAME], AdmRank[45], fstr[95];
        GetPlayerName(i, nameee, sizeof(nameee));
        if(!strcmp(nameee, "[XP]IzZaN", true)) AdmRank = "{B22222}[Community Owner And Scripter]";
        /*else if(!strcmp(nameee, "NONE-NOBODY", true)) AdmRank = "{FF4500}[Server Owner]";
        else if(!strcmp(nameee, "NONE-NOBODY", true)) AdmRank = "{FF4500}[Co-Owner]";*/
// Why does this even exist?
        else if(!strcmp(nameee, "[XP]Perfect_Boy", true)) AdmRank = "{FA8072}[Community Owner]";
        else switch(PlayerInfo[i][Level])
        {
            case 1: AdmRank = "{FFD700}[Trial Admin]";
            case 2: AdmRank = "{FF4500}[Server Admin]";
            case 3: AdmRank = "{1E90FF}[Senior Admin]";
            case 4: AdmRank = "{0000CD}[Lead Admin]";
            case 5: AdmRank = "{00FF00}[Head Admin]";
            case 6: AdmRank = "{4B0082}[Server Manager]";
            case 7: AdmRank = "{F08080}[Server Co-Owner]";
            case 8: AdmRank = "{FF1493}[Sever Owner]";
            case 9: AdmRank = "{800000}[Community Co-Owner]";
            case 10: AdmRank = "{FF0000}[Community Owner]";
            default: continue;
        }
        if(IsPlayerAdmin(i)) AdmRank ="{F3FF02}[The Server Guy!]";
        format(fstr, sizeof(fstr), "%s [ID:%d] | Level %d - %s\n\n", nameee, i, PlayerInfo[i][Level], AdmRank);
        strcat(string, fstr);
        count++;
        if(count >= 8) break; // Just so we don't have to create a MASSIVE string
    }
    if(!count) strcat(string, "{00FFEE}No Admins Are Online in Server\n\n");
    strcat(string, "{00FF00}COD - RWW2");
    ShowPlayerDialog(playerid, 800, DIALOG_STYLE_MSGBOX, "{F81414}RWW2 - Online Admins :", string, "Close", "");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)