string too small. but i dont wanna make the string like 9999..
#1

hey everyone,

i have this /admins cmd, but the string is too small, when it pupups the dialog, it shows 1 admin, and the second for a part, then the string is ended and too small, but there must be a better way for this, cuz i dont wanna make my string like 9999 bigg...

pawn Код:
CMD:admins(playerid, params[])
{
        new count = 0;
        new string[128];
        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 {FFFFFF}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(string, sizeof(string), "%s{FF00FF}Level: {FF0000}%d {FF00FF}- {00FF00}%s (Id:{FF0000}%i{00FF00}) {FF00FF}| %s \n",string, PlayerInfo[i][AdminLevel], PlayerName2(i),i,AdmRank);
                    ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", string, "OK", "");
                    count++;
                }
            }
        }
        if (count == 0)
        {
            ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", "No online admins", "OK", "");
        }
        return 1;
}
greets niels
Reply
#2

I don't think there is another way, so I guess you have to make your string abit bigger.
Reply
#3

if i use this:
pawn Код:
format(string, sizeof(string), "{FF00FF}Level: {FF0000}%d {FF00FF}- {00FF00}%s (Id:{FF0000}%i{00FF00}) {FF00FF}| %s \n",PlayerInfo[i][AdminLevel], PlayerName2(i),i,AdmRank);
instead of
pawn Код:
format(string, sizeof(string), "%s{FF00FF}Level: {FF0000}%d {FF00FF}- {00FF00}%s (Id:{FF0000}%i{00FF00}) {FF00FF}| %s \n",string, PlayerInfo[i][AdminLevel], PlayerName2(i),i,AdmRank);
then it will replace the first admin with new joined admin...

and wut do you mean with every loop ******?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)