Admins Bug [REPS]
#1

Hello, iv a command include vips and admins in one list, but the problem that when join 2 admins , list is bugged i mean if my rank Rcon Manager Other admin will be Rcon Manager how to fix that:

Код:
CMD:admins(playerid, params[])
{
    new strtext[1024], string[1024], adminname[MAX_PLAYER_NAME];
    strcat(string, "{00FF00}SPA - Online Admins/VIPs\n{FFFF00}Online Administrators:\n");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pInfo[i][Admin] > 0 && pInfo[i][Hide] == 0)
            {
                if(IsPlayerAdmin(i))
                {
                    pARank = "RCON Manager";
                }
                else if (pInfo[i][Admin] > 0)
                {
                    switch(pInfo[i][Admin])
                    {
                        case 1: pARank = "Level 1 - Helper";
                        case 2: pARank = "Level 2 - Mod";
                        case 3: pARank = "Level 3 - Admin ";
                        case 4: pARank = "Level 4 - Leader";
                        case 5: pARank = "Level 5 - Assistant Head Administrator";
                    }
                }
                GetPlayerName(i, adminname, sizeof(adminname));
                format(string,sizeof(string),"{FFFFFF}%s (%i) - %s", adminname, i, pARank);
                strcat(string, "\n");
                strcat(strtext, string);
            }
        }
    }
    strcat(strtext, "\n\n");
    strcat(strtext, "{00FF00}Online Very Important Players:\n\n");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pInfo[i][Vip] > 0)
            {
                switch(pInfo[i][Vip])
                {
                    case 1: pVRank = "FREE";
                    case 2: pVRank = "Donator";
                    case 3: pVRank = "Silver";
                    case 4: pVRank = "Gold";
                    case 5: pVRank = "CO-Gold";
                    case 6: pVRank = "Head Donator";
                }
                GetPlayerName(i, adminname, sizeof(adminname));
                format(string,sizeof(string),"{FFFFFF}%s (%i) - %s", adminname, i, pVRank);
                strcat(string, "\n");
                strcat(strtext, string);
            }
        }
    }
    ShowPlayerDialog(playerid, 9000,DIALOG_STYLE_MSGBOX,"{00FF00}SPA - Online Admins/VIPs\n",strtext,"Close","");
    return 1;
}
Reply
#2

At line 13
pawn Код:
pARank = "RCON Manager";
You can't do that, you have to use strcpy.

Same at
pawn Код:
case 1: pARank = "Level 1 - Helper";
case 2: pARank = "Level 2 - Mod";
case 3: pARank = "Level 3 - Admin ";
case 4: pARank = "Level 4 - Leader";
case 5: pARank = "Level 5 - Assistant Head Administrator";
And you did it again from line 43 to line 48.

This is how you should do it:
pawn Код:
strcpy(pARank, "Level 2 - Mod", sizeof(pARank))
You'll have to look for the definition of strcpy on this forum.
Reply
#3

thanks fixed. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)