Dialog only showing 1 Row - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog only showing 1 Row (
/showthread.php?tid=572119)
Dialog only showing 1 Row -
sammp - 25.04.2015
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?
Re: Dialog only showing 1 Row -
Konstantinos - 25.04.2015
You never add the previous text:
PHP код:
new string[255], Char[MAX_PLAYER_NAME];
for(new i = 0; i != rows; i++)
{
cache_get_field_content(i, "Name", Char);
format(string, sizeof(string), "%s(%d) %s\n", string, (i+1), Char);
}
ShowPlayerDialog(playerid, DIALOG_SELECT_CHARACTER, DIALOG_STYLE_LIST, "Select Character", string, "Select", "Cancel");
Re: Dialog only showing 1 Row -
J4Rr3x - 25.04.2015
pawn Код:
Change:
for(new i = 0; i != rows; i++)
to:
for(new i = 0; i <= rows; i++)
Re: Dialog only showing 1 Row -
SickAttack - 25.04.2015
Use strcat instead of formatting the string over and over. It will add up the source to the dest.
Re: Dialog only showing 1 Row -
Konstantinos - 25.04.2015
Quote:
Originally Posted by SickAttack
Use strcat instead of formatting the string over and over. It will add up the source to the dest.
|
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.
Re: Dialog only showing 1 Row -
sammp - 25.04.2015
Quote:
Originally Posted by Konstantinos
You never add the previous text:
PHP код:
new string[255], Char[MAX_PLAYER_NAME];
for(new i = 0; i != rows; i++)
{
cache_get_field_content(i, "Name", Char);
format(string, sizeof(string), "%s(%d) %s\n", string, (i+1), Char);
}
ShowPlayerDialog(playerid, DIALOG_SELECT_CHARACTER, DIALOG_STYLE_LIST, "Select Character", string, "Select", "Cancel");
|
Thanks!! Can't rep you for some reason but I'll do so asap