Loop and dialog response
#1

So..
I'm having stadiums IDs 1, 2, 3 and 5. ID 4 is missing but that's ok.

pawn Код:
CMD:stadiums(playerid, params[])
{
    new StadiumList[500];
    for (new StadiumID = 1; StadiumID < MAX_STADIUMS; StadiumID++)
    {
        if (AStadium[StadiumID][PickupID] != 0) format(StadiumList, sizeof(StadiumList), "%s%s stadium\n", StadiumList, AStadium[StadiumID][StadiumLocation]);
    }
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "List:", StadiumList, "OK", "Cancel");
    return 1;
}

OnDialogResponse(..
{
    new String[128];
    if (!response) return 1;
    new StadiumLocalID = listitem + 1;
    format(String, sizeof(String), "You're next to %s stadium", AStadium[StadiumLocalID][StadiumLocation]);
    SendClientMessage(playerid, -1, String);
    return 1;
}
When I enter /stadiums it shows a dialog type listitem with all existing stadiums, like:
Код:
ID 1
ID 2
ID 3
ID 5
When I click on IDs 1, 2 and 3 it's shows the correct stadium ID, but when I choose 5 it returns ID 4 which doesn't exist.
Код:
new StadiumLocalID = listitem + 1;
Does anyone have any idea how to make it?
Reply


Messages In This Thread
Loop and dialog response - by PPC23 - 10.02.2019, 19:04
Re: Loop and dialog response - by None1337 - 10.02.2019, 20:37
Re: Loop and dialog response - by Calisthenics - 10.02.2019, 20:52
Re: Loop and dialog response - by Pottus - 10.02.2019, 21:14
Re: Loop and dialog response - by Mugala - 10.02.2019, 21:37

Forum Jump:


Users browsing this thread: 1 Guest(s)