/factions -
iGetty - 27.05.2012
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!
Re: /factions -
[ABK]Antonio - 27.05.2012
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.
Re: /factions -
iGetty - 27.05.2012
There;
It does that with your code.
Re: /factions -
CidadeNovaRP - 27.05.2012
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...
Re: /factions -
[ABK]Antonio - 27.05.2012
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..
Re: /factions -
iGetty - 27.05.2012
You mean Factions[MAX_FACTIONS][fData]?
Re: /factions -
milanosie - 27.05.2012
Add multiple strings?
Cause you first define one string to all factions, and after that show the dialog
Re: /factions -
iGetty - 27.05.2012
How do you mean milanosie? Could you show me please?