CMD error
#1

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(playeridparams[])
{
    new 
dialogo[200], string[200];
    for (new 
0!= MAX_FACTIONS++) if (FactionData[i][factionExists])
    {
        
format(dialogo128"{FFFFFF}[%d] {%06x}%s"iFactionData[i][factionColor] >>> 8FactionData[i][factionName]);
        
strcat(stringdialogo);
    }
    
ShowPlayerDialog(playerid0DIALOG_STYLE_LIST"Lista de facзхes"string"Fechar""");
    return 
1;

Reply
#2

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(playeridparams[])
{
    new 
dialogo[200], string[200];
    for (new 
0!= MAX_FACTIONS++) if (FactionData[i][factionExists])
    {
        
format(dialogo128"{FFFFFF}[%d] {%06x}%s"iFactionData[i][factionColor] >>> 8FactionData[i][factionName]);
        
strcat(stringdialogo);
    }
    
ShowPlayerDialog(playerid0DIALOG_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
Reply
#3

#define DIALOG_FACTION 500


PHP код:
CMD:flist(playeridparams[]) 

    new 
dialogo[200], string[200]; 
    for (new 
0MAX_FACTIONS++) if (FactionData[i][factionExists]) 
    { 
        
format(dialogo128"{FFFFFF}[%d] {%06x}%s"iFactionData[i][factionColor] >>> 8FactionData[i][factionName]); 
        
strcat(stringdialogo); 
    } 
    
ShowPlayerDialog(playeridDIALOG_FACTIONDIALOG_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
Reply
#4

Reputed, not problem, resolved question, tranks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)