Dialog help, It's showing only 1 song.
#1

Ok so my dialog Is only showing one song but I want it so show all of them not only the first one. Here's the command.

pawn Код:
COMMAND:music(playerid, params[])
{
    if(MusicInfo[0][Song] == 0) return SendClientMessage(playerid,COLOR_LIGHTRED,"Error: Server can't find any music.");
    {
        for(new i = 0; i < MAX_SERVERMUSIC;i++)
        {
            new string[128];
            format(string, sizeof(string), "%i) %s\n", i+1,MusicInfo[i][SongName]);
            ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Music Player", string, "Play", "Cancel");
            return 1;
        }
    }
    return 1;
}
At the moment the dialog is showing this.

Код:
1) Machine Gun Kelly - Swing life away.
So that show's if a player has only 1 song but if a player add's an other song it will show them both like this.

Код:
1) Machine Gun Kelly - Swing life away.
2) Linkin Park - Wastelands
any help?
Reply
#2

You show the dialog in the loop so it will only show the first song and then you return a value which stops the loop.
pawn Код:
new string[150];
for (new i; i != sizeof (MusicInfo); ++i) format(string, sizeof (string), "%s%i) %s\n", string, i + 1, MusicInfo[i][SongName]);
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Music Player", string, "Play", "Cancel");
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You show the dialog in the loop so it will only show the first song and then you return a value which stops the loop.
pawn Код:
new string[150];
for (new i; i != sizeof (MusicInfo); ++i) format(string, sizeof (string), "%s%i) %s\n", string, i + 1, MusicInfo[i][SongName]);
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Music Player", string, "Play", "Cancel");
Thanks man will test it now, It works man but how can I make it stop at like 15 then say next dialog? with number 16?
Reply
#4

pawn Код:
for(new i = 0; i < 16; i++)
pawn Код:
if(i == 15) strins(string, "Next Page");
Next page (OnDialogResponse):
pawn Код:
for(new i = 16; i < 32; i++)
Just examples.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)