SA-MP Forums Archive
Items not showing up within list... - 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: Items not showing up within list... (/showthread.php?tid=374605)



Items not showing up within list... - Karkand - 03.09.2012

I've got the following code:

pawn Код:
// - N/A
If however I use the command /misc, the dialog appears, but the list items don't. I've been sitting on this confused
for the last two hours, seeing I've tried to re-build it over and over, but the same thing happens every time. Any ideas? Thanks for the assistance.


Re: Items not showing up within list... - [ABK]Antonio - 03.09.2012

Instead you should join them with strcat

pawn Код:
strcat(sz_text, text, sizeof(sz_text));
Instead of
pawn Код:
format(sz_text, sizeof(sz_text), "%s\n%s", sz_text, text);
Though, make sure you put \n in the first format

Though I do see what you were trying to do - might as well just use strcat


Re: Items not showing up within list... - Karkand - 03.09.2012

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
Instead you should join them with strcat

pawn Код:
strcat(sz_text, text, sizeof(sz_text));
Instead of
pawn Код:
format(sz_text, sizeof(sz_text), "%s\n%s", sz_text, text);
Though, make sure you put \n in the first format

Though I do see what you were trying to do - might as well just use strcat
Thanks for pointing that out, never thought of using strcat. As for the original issue, I'm come to the realization there is a looping issue. I put a print directly under.

pawn Код:
for(new m = 0; m < sizeof(AlternativeMusicInfo); m ++)
And nothing was printed into the console. Seeing this, I thought the 'sizeof(AlternativeMusicInfo);' was the problem, so I changed it to '6' and '7', yet it still had the same effect and result.


Re: Items not showing up within list... - leonardo1434 - 03.09.2012

pawn Код:
CMD:misc(playerid, params[])
{
    new sz_text[1024],a;
    for(; a < sizeof AlternativeMusicInfo; ++a)
    {
        strcat(sz_text, AlternativeMusicInfo[a][StationName]);
        strcat(sz_text,"\n");
        printf(#%s,sz_text);
    }
    ShowPlayerDialog(playerid, DIALOG_MUSICMAIN, DIALOG_STYLE_LIST, "Misc Music", sz_text, "Play", "Cancel");
    return 1;
}



Re: Items not showing up within list... - Karkand - 03.09.2012

Thanks. The issue has been resolved.