Help with enums!
#1

I made an enum with all admin commands and require level, then I made a stock to send a message of the cmds.
here are the codes:

Enum:

pawn Код:
enum A_COMMANDS
{
    aCommand[24],
    aLevel
}

new AdminCommands[][A_COMMANDS] = {
{"goto", ADMIN_1},
{"gethere", ADMIN_1},
{"ban", ADMIN_1},
{"kick", ADMIN_1},
{"ajail", ADMIN_1},
{"slap", ADMIN_1},
{"freeze", ADMIN_1},
{"unfreeze", ADMIN_1},
{"mute", ADMIN_1},
{"getcar", ADMIN_1},
{"gotocar", ADMIN_1}
};
Now the stock:

pawn Код:
stock DisplayLevelCommands(playerid, level)
{
    new count = 0, cmds[256];
    SCMEx(playerid, COLOR_LIGHTRED, "Admin Level %d Commands", level);
    for(new i = 0; i < sizeof(AdminCommands); i++)
    {
        if(AdminCommands[i][aLevel] == level)
        {
            format(mstr, sizeof(mstr), " /%s |", AdminCommands[i][aCommand]);
            strcat(cmds, mstr);
            count++;
            if(count == 8)
            {
                strcat(cmds, "\n");
                count = 0;
            }
        }
    }
    SCM(playerid, COLOR_WHITE, cmds);
    return 1;
}

The problem is that when the count is equal to 8, the \n doesn't works the cmds are at the same line.
Picture:



Reply


Messages In This Thread
Help with enums! - by PaulDinam - 23.06.2013, 16:25
Re: Help with enums! - by Macluawn - 23.06.2013, 16:35
Re: Help with enums! - by NoahF - 23.06.2013, 16:37
Re: Help with enums! - by Youarex - 23.06.2013, 17:20
Re: Help with enums! - by PaulDinam - 23.06.2013, 17:51

Forum Jump:


Users browsing this thread: 4 Guest(s)