/factions
#1

The following command I have got an issue with.

pawn Код:
command(factions, playerid, params[])
{
    new string[128];
    for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(strlen(Factions[i][FactionName]) > 1)
        {
            format(string, sizeof(string), "%s\n", Factions[i][FactionName]);
        }
    }
    ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Faction Member(s)", string, "OK", "");
    return 1;
}
It only shows one faction (The last faction on the list EG:

I have in my SQL

Red County Sheriffs Department
Red County Fire & Rescue

But it only shows Red County Fire & Rescue, not both.

Thanks!
Reply
#2

Quote:
Originally Posted by iGetty
Посмотреть сообщение
The following command I have got an issue with.

pawn Код:
command(factions, playerid, params[])
{
    new string[128];
    for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(strlen(Factions[i][FactionName]) > 1)
        {
            format(string, sizeof(string), "%s\n", Factions[i][FactionName]);
        }
    }
    ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Faction Member(s)", string, "OK", "");
    return 1;
}
It only shows one faction (The last faction on the list EG:

I have in my SQL

Red County Sheriffs Department
Red County Fire & Rescue

But it only shows Red County Fire & Rescue, not both.

Thanks!
pawn Код:
command(factions, playerid, params[])
{
    new string[81], smallstr[40];
    for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(strlen(Factions[i][FactionName]) > 1)
        {
            format(smallstr, sizeof(smallstr), "%s\n", Factions[i][FactionName]);
            strcat(string, smallstr, sizeof(string));
        }
    }
    ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Faction Member(s)", string, "OK", "");
    return 1;
}
We need to put that into the string we're going to display instead of just re-formatting it every time.
Reply
#3

There;



It does that with your code.
Reply
#4

pawn Код:
command(factions, playerid, params[])
{
    new string[256], smallstr[40];
    for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(strlen(Factions[i][FactionName]) > 1)
        {
            format(smallstr, sizeof(smallstr), "%s\n", Factions[i][FactionName]);
            strcat(string, smallstr, sizeof(string));
        }
    }
    ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_LIST, "Faction Member(s)", string, "OK", "");
    return 1;
}
UP string...
Reply
#5

Can you show me the enum & array definitions?

To above;

The string is perfectly fine....He said he has two factions, the largest one is 30 characters..
Reply
#6

You mean Factions[MAX_FACTIONS][fData]?
Reply
#7

Add multiple strings?

Cause you first define one string to all factions, and after that show the dialog
Reply
#8

How do you mean milanosie? Could you show me please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)