dialogs
#1

Hi.

I tried to create a /help dialog menu
and it kinda failed

i put this ondialogresponse

pawn Код:
if(dialogid == 4 && response)
    {
        SendClientMessage(playerid, White, "Test 1");
        return 1;
    }
    if(dialogid == 4 && response)
    {
        SendClientMessage(playerid, White, "Test 2");
        return 1;
    }
    return 1;
}
ofc after the register/login dialogs

here is the cmd

pawn Код:
COMMAND:help(playerid, params[])
{
    ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Help", "Test 1\nTest 2", "Select", "Cancel");
    return 1;
}
ok here is the problem.. the dialog shows up, and when I press Test 1, it works... but when I press Test 2, it shows Test 1 message? Pls help
Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4)
    {
        switch(listitem)
        {
        case 0: SendClientMessage(playerid, White, "Test 1");
        case 1: SendClientMessage(playerid, White, "Test 2");
        }
    }
    return 1;
}
Responses are the ''Select'' and ''Cancel'' buttons, not the ''Test 1'' and ''Test 2'' Buttons.
Reply
#3

What if I got more lines than test 1? how can i make it work with case then?
Reply
#4

adding
pawn Код:
case 2: return SendClientMessage(playerid,White,"Test 3");
Cause you already used 0 and 1.
Reply
#5

uhm, i did the wrong way can you show me

i did this and when i example press test 1, it will just show test 1 and not the other text

pawn Код:
if(dialogid == 4)
    {
        switch(listitem)
        {
        case 0: return SendClientMessage(playerid, Green, "Hi);
        case 1: return SendClientMessage(playerid, Yellow, "
Welcome");
        case 2: return SendClientMessage(playerid, Yellow, "
Test");
I want all those 3 to be shown when i press test1
Reply
#6

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4)
    {
        switch(listitem)
        {
        case 0: // Test 1
        {
            SendClientMessage(playerid, Green, "Hi");
            SendClientMessage(playerid, Yellow, "Welcome");
            SendClientMessage(playerid, Yellow, "Test");
        }
        case 1: SendClientMessage(playerid, White, "Test 2");
        case 2: SendClientMessage(playerid, White, "Test 3");
        }
    }
    return 1;
}
Reply
#7

ah I got it now, it works. Thank you
Respect
Reply
#8

As I didnt want to create new topic, i got a new question..

I want something like this and how can i make it

when a player type /help they will example choose "Rules" lets say

and a little msg box will pop up with rules and they can press next to see more rules. how can I make somethig like that?
Reply
#9

Well, show another dialog when he responses a dialog.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4)
    {
        switch(listitem)
        {
        case 0: // Rules
        {
            ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "Rules Part 1", "1єRule1\n2єRule2\n3єRule3", "Continue", "Cancel");
        }
        case 1: SendClientMessage(playerid, White, "Test 2");
        case 2: SendClientMessage(playerid, White, "Test 3");
        }
    }
    if(dialogid == 5)
    {
        if(response)
        {
            ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX, "Rules Part 2", "1єRule1\n2єRule2\n3єRule3", "Ok", "Back");
        }
        else if(!response)
        {
            return 1;
        }
    }
    if(dialogid == 6)
    {
        if(response)
        {
            return 1;
        }
        else if(!response)
        {
            ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "Rules Part 1", "1єRule1\n2єRule2\n3єRule3", "Continue", "Cancel");
        }
    }
    return 1;
}
Reply
#10

errors
pawn Код:
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(1191) : error 002: only a single statement (or expression) can follow each "case"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(1191 -- 1192) : error 029: invalid expression, assumed zero
this line
pawn Код:
if(dialogid == 5)
this script

http://pastebin.com/K5S7P0h9
help Marricio please
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)