Dialog listitem problem?
#1

The code:
pawn Код:
else if(dialogid == 4)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid, 666, DIALOG_STYLE_MSGBOX, "Dialog Closed", "You chose to close the dialog", "Close", "");
        }
        else
        {
            if(listitem == 1)
            {
                ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "General Help", "The Rules\r\nJob Locations\r\nDonation Information\r\n", "Select", "Close");
            }
            else if(listitem == 2)
            {
                ShowPlayerDialog(playerid, 7, DIALOG_STYLE_MSGBOX, "Commands Help", " [/help] - [/stats] ", "Close", "");
            }
            else if(listitem == 3)
            {
                ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "Job Help", " Jobs are great ways to make a good earning \n around the server. A job can help you purchase \n many things available to players around the \n server if you want to join a job, look for the \n yellow dots around the map, and go to the location! \n", "Close", "");
            }
            else if(listitem == 4)
            {
                if(PlayerInfo[playerid][pFaction] == 0)
                {
                    SendClientMessage(playerid, COLOR_BLACK, "You are not in any factions!");
                }
                else if(PlayerInfo[playerid][pFaction] == 1)
                {
                    ShowPlayerDialog(playerid, 9, DIALOG_STYLE_LIST, "Faction Help", "Faction Information\r\nFaction Commands\r\n", "Select", "Close");
                }
            }
        }
    }
So I go in game type the command, the dialog, id 4, opens up... So I click on the first option, but nothing opens... Even though I have listitem == 1... So I click on the second item and I get list item one instead of list item two?

Here is the command:

pawn Код:
CMD:help(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid] == 1)
        {
            ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Server Help", "General Help\r\nCommands Help\r\nJob Help\r\nFaction Help\r\n", "Select", "Close");
        }
    }
    return 1;
}
Reply
#2

Quote:

I have listitem == 1... So I click on the second item and I get list item one instead of list item two?

You need to have listitem 0 if you want to access first option.

So it will be like:
pawn Код:
else if(dialogid == 4)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid, 666, DIALOG_STYLE_MSGBOX, "Dialog Closed", "You chose to close the dialog", "Close", "");
        }
        else
        {
            if(listitem == 0)
            {
                ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "General Help", "The Rules\r\nJob Locations\r\nDonation Information\r\n", "Select", "Close");
            }
            else if(listitem == 1)
            {
                ShowPlayerDialog(playerid, 7, DIALOG_STYLE_MSGBOX, "Commands Help", " [/help] - [/stats] ", "Close", "");
            }
            else if(listitem == 2)
            {
                ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "Job Help", " Jobs are great ways to make a good earning \n around the server. A job can help you purchase \n many things available to players around the \n server if you want to join a job, look for the \n yellow dots around the map, and go to the location! \n", "Close", "");
            }
            else if(listitem == 3)
            {
                if(PlayerInfo[playerid][pFaction] == 0)
                {
                    SendClientMessage(playerid, COLOR_BLACK, "You are not in any factions!");
                }
                else if(PlayerInfo[playerid][pFaction] == 1)
                {
                    ShowPlayerDialog(playerid, 9, DIALOG_STYLE_LIST, "Faction Help", "Faction Information\r\nFaction Commands\r\n", "Select", "Close");
                }
            }
        }
    }
Reply
#3

Oh okay thanks , also how can I find out if inputtext is a number? Example, to select their age, I do not want ferferfer as the age...
Reply
#4

Quote:
Originally Posted by Dr
Посмотреть сообщение
Oh okay thanks , also how can I find out if inputtext is a number? Example, to select their age, I do not want ferferfer as the age...
Check this TOPIC, problem already solved.

pawn Код:
if (!IsNumeric(inputtext)) return SendClientMessage(playerid, 0xFF0000FF, "Your age must be a number.");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)