Dialog help
#1

Hey guys,

I've got a problem with dialogs. When i enter a password in my dialog, it doesnt show me a message or anything else.
It think it just shut's down or something.
Yes, i made if(response) {, and yes i know that none of the dialog id's are used by any filterscript/gamemode.
What can be the problem?

~Wesley
PS: Tell me if you need an example of the dialogresponse
Reply
#2

No one knows what the problem could be?
Reply
#3

Sorry for early bump, but need to know something else aswell:
How can i check if a player puts letters or numbers in the inputtext? Like if someone types "abjlqwerqw", is it possible to give an error message with " ** No letters alowed in this inputbox, numbers only" or something?

Thanks in advance!
Reply
#4

Could you show us the full code of your dialog?

Quote:
Originally Posted by samp
This forum requires that you wait 120 seconds between posts. Please try again in 1 seconds.
Reply
#5

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == REGISTERBANK)
    {
        print("Registerdialog");
        if(response)
        {
            print("Response");
            if(strlen(inputtext))
            {
                print("Inputtext");
                new file[100], name[MAX_PLAYER_NAME], string[128];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), " ** You succesfully registered your bank account. Account name: %s, Password: %s", name, inputtext);
                format(file, sizeof(file), Bankfile, name);
                dini_Create(file);
                dini_Set(file, "Bank owner", name);
                dini_IntSet(file, "Password", num_hash(inputtext));
                dini_IntSet(file, "Registered", 1);
                dini_IntSet(file, "Cash amount", 0);
                dini_IntSet(file, "Logged", 1);
                SendClientMessage(playerid, SKY_BLUE, string);
            }
            else if(!strlen(inputtext))
            {
                SendClientMessage(playerid, SKY_BLUE, " ** You must fill in a password!");
                ShowPlayerDialog(playerid, REGISTERBANK, DIALOG_STYLE_INPUT, "Welcome to your Local Bank! \nI see you don't got a bank account yet.", "Please enter a password, to register your bank account. \nPlease note: It cost's $1000 to register your bank account. \n\nPassword:", "Register", "Cancel");
            }
        }
        else if(!response)
        {
            SendClientMessage(playerid, SKY_BLUE, " ** You did not register your bank account. Please step by next time.");
        }
    }
        return 0; // Return 0 is for filterscripts right?
}
Check comment aswell
Reply
#6

You need it to return 1. That should fix it. If it returns 0 nothing will happen.
Reply
#7

Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback.

This is what the wiki said.
Reply
#8

Make the end of your code look like so
pawn Код:
return 1;
    }
        return 0;
}
Reply
#9

Still the same problem..
Reply
#10

I don't see any errors
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        if(dialogid == REGISTERBANK)
        {
            print("Registerdialog");
            if(response)
            {
                print("Response");
                if(strlen(inputtext))
                {
                    print("Inputtext");
                    new file[100], name[MAX_PLAYER_NAME], string[128];
                    GetPlayerName(playerid, name, sizeof(name));
                    format(string, sizeof(string), " ** You succesfully registered your bank account. Account name: %s, Password: %s", name, inputtext);
                    format(file, sizeof(file), Bankfile, name);
                    dini_Create(file);
                    dini_Set(file, "Bank owner", name);
                    dini_IntSet(file, "Password", num_hash(inputtext));
                    dini_IntSet(file, "Registered", 1);
                    dini_IntSet(file, "Cash amount", 0);
                    dini_IntSet(file, "Logged", 1);
                    SendClientMessage(playerid, SKY_BLUE, string);
                }
                else
                {
                    SendClientMessage(playerid, SKY_BLUE, " ** You must fill in a password!");
                    ShowPlayerDialog(playerid, REGISTERBANK, DIALOG_STYLE_INPUT, "Welcome to your Local Bank! \nI see you don't got a bank account yet.", "Please enter a password, to register your bank account. \nPlease note: It cost's $1000 to register your bank account. \n\nPassword:", "Register", "Cancel");
                }
            }
            else
            {
                SendClientMessage(playerid, SKY_BLUE, " ** You did not register your bank account. Please step by next time.");
            }
        }
        return 1;
    }
    return 1; // Return 0 is for filterscripts right?
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)