CMD error -
SukMathcuck - 04.01.2017
I did this command but it does not work, what should I do to show the dialog? Or rather what I did wrong?
PHP код:
CMD:flist(playerid, params[])
{
new dialogo[200], string[200];
for (new i = 0; i != MAX_FACTIONS; i ++) if (FactionData[i][factionExists])
{
format(dialogo, 128, "{FFFFFF}[%d] {%06x}%s", i, FactionData[i][factionColor] >>> 8, FactionData[i][factionName]);
strcat(string, dialogo);
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Lista de facзхes", string, "Fechar", "");
return 1;
}
Re: CMD error -
CutX - 04.01.2017
Quote:
Originally Posted by SukMathcuck
I did this command but it does not work, what should I do to show the dialog? Or rather what I did wrong?
PHP код:
CMD:flist(playerid, params[])
{
new dialogo[200], string[200];
for (new i = 0; i != MAX_FACTIONS; i ++) if (FactionData[i][factionExists])
{
format(dialogo, 128, "{FFFFFF}[%d] {%06x}%s", i, FactionData[i][factionColor] >>> 8, FactionData[i][factionName]);
strcat(string, dialogo);
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Lista de facзхes", string, "Fechar", "");
return 1;
}
|
well, most likely accesing something out of bounds of "FactionData" and
because of that the processing of the cmd stops exactly when that happens
and you'll get the "unknown command" message
the end condition in your for-loop is incorrect.
it should be
i < MAX_FACTIONS
and not
i != MAX_FACTIONS
for example, lets say
#define DDD (20)
and you do something like
new abc[DDD];
elements range from 0 to DDD-1
if you do
i < DDD
it would stop right before 20
and that's good since
abc[20]
would be out of abc's boundaries
Re: CMD error -
Yaa - 04.01.2017
#define DIALOG_FACTION 500
PHP код:
CMD:flist(playerid, params[])
{
new dialogo[200], string[200];
for (new i = 0; i < MAX_FACTIONS; i ++) if (FactionData[i][factionExists])
{
format(dialogo, 128, "{FFFFFF}[%d] {%06x}%s", i, FactionData[i][factionColor] >>> 8, FactionData[i][factionName]);
strcat(string, dialogo);
}
ShowPlayerDialog(playerid, DIALOG_FACTION, DIALOG_STYLE_LIST, "Lista de facзхes", string, "Fechar", "");
return 1;
}
this issue happins where there duplicate dialogs with same id
use this code ^^ and try to change the id of dialog faction in OnDialogReponse to DIALOG_FACTION
Re: CMD error -
SukMathcuck - 04.01.2017
Reputed, not problem, resolved question, tranks!