Dialog only showing 1 Row
#1

Well, I'm making an account system where you have a Master Account and Characters within the Master Account.

It all loads fine and dandy, however my dialog is only showing 1 of the 2 characters I have.

Id 0 = Good_Guy
Id 1 = Bad_Guy

Its only showing bad_guy

pawn Код:
new string[255];
            for(new i = 0; i != rows; i++)
            {
                new Char[MAX_PLAYER_NAME];
               
                cache_get_field_content(i, "Name", Char);
                format(string, sizeof(string), "(%d) %s\n", (i+1), Char);
            }
            ShowPlayerDialog(playerid, DIALOG_SELECT_CHARACTER, DIALOG_STYLE_LIST, "Select Character", string, "Select", "Cancel");
The query is fine, as if I do the same thing but with SendClientMessage I get both of the characters. Solution?
Reply
#2

You never add the previous text:
PHP код:
new string[255], Char[MAX_PLAYER_NAME];
for(new 
0!= rowsi++)
{
    
cache_get_field_content(i"Name"Char);
    
format(stringsizeof(string), "%s(%d) %s\n"string, (i+1), Char);
}
ShowPlayerDialog(playeridDIALOG_SELECT_CHARACTERDIALOG_STYLE_LIST"Select Character"string"Select""Cancel"); 
Reply
#3

pawn Код:
Change:
for(new i = 0; i != rows; i++)
to:
for(new i = 0; i <= rows; i++)
Reply
#4

Use strcat instead of formatting the string over and over. It will add up the source to the dest.

pawn Код:
strcat(dest, source);
Reply
#5

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Use strcat instead of formatting the string over and over. It will add up the source to the dest.

pawn Код:
strcat(dest, source);
Using strcat will just call strcat as many times as it will call format which is more than just calling format.

@J4Rr3x: "!=" is equal to "<" in this case, which both are correct. Though using "<=" will use 1 more row which does not exist.
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You never add the previous text:
PHP код:
new string[255], Char[MAX_PLAYER_NAME];
for(new 
0!= rowsi++)
{
    
cache_get_field_content(i"Name"Char);
    
format(stringsizeof(string), "%s(%d) %s\n"string, (i+1), Char);
}
ShowPlayerDialog(playeridDIALOG_SELECT_CHARACTERDIALOG_STYLE_LIST"Select Character"string"Select""Cancel"); 
Thanks!! Can't rep you for some reason but I'll do so asap
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)