Need some help to get this working...
#1

I am trying to get this Dialog working.

pawn Code:
command(help, playerid, params[])
{
    {
        ShowPlayerDialog( playerid, 100, DIALOG_STYLE_LIST, "Help Menu", "Commands\nRules\n", "Select", "Cancel" );
    }
    return 1;
}

And this bit was from SAMP Wiki.

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(100)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, YELLOW, "You cancelled.");
                return 1;
            }

            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                    SendClientMessage(playerid, WHITE, "commands go here" );
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                }
                case 1:
                {
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                    SendClientMessage(playerid, WHITE, "rules go here" );
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                }
            }
        }
    }
    return 1;
}
I get no errors but when i go in game it doesn't work. Anyone know the problem?
Reply
#2

Your usage of the switch statement is wrong, you need to perform it on the dialogid and then check if the case is 100, which means the dialogid was 100! Like so:

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 100:
        {
            if(!response)
            {
                SendClientMessage(playerid, YELLOW, "You cancelled.");
                return 1;
            }

            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                    SendClientMessage(playerid, WHITE, "commands go here" );
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                }
                case 1:
                {
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                    SendClientMessage(playerid, WHITE, "rules go here" );
                    SendClientMessage(playerid, YELLOW, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
                }
            }
        }
    }
    return 1;
}
I hope this makes sense and helps.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)