OnDialogResponse codes not working?
#1

I have no idea what the problem here is, so I'm asking you.

What happens is that the dialog box shows up as it should, but nothing else happens. When you press the submit button, just, nothing happens.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

    switch(dialogid){
        case 1:
        {
               if(response){
                     new filestring[128];
                     format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
                     new password[256];
                     password = dini_Get(filestring, "Password");
                     if(strcmp(inputtext, password, false) == 0){
                        Player[playerid][Skin] = dini_Int(filestring, "Skin");
                        Player[playerid][LastX] = dini_Float(filestring, "LastX");
                        Player[playerid][LastY] = dini_Float(filestring, "LastY");
                        Player[playerid][LastZ] = dini_Float(filestring, "LastZ");
                        SetSpawnInfo(playerid, 0, Player[playerid][Skin], Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
                        SpawnPlayer(playerid);
                     }else{
                        SendClientMessage(playerid, RED, "Wrong password!");
                        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel");
                       
                     }
               
               }
        }
        case 2:
        {
              if(response){
                     new filestring[128];
                     format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
                     dini_Create(filestring);
                     new namestring[256];
                     new passstring[256];
                     format(namestring, sizeof(namestring), "%s", GetPlayerName(playerid));
                     format(passstring, sizeof(passstring), "%s", inputtext);
                     dini_Set(filestring, "Name", namestring);
                     dini_Set(filestring, "Password", passstring);
                     dini_FloatSet(filestring, "LastX", 1643.086181);
                     dini_FloatSet(filestring, "LastY", -2237.591796);
                     dini_FloatSet(filestring, "LastZ", 13.494955);
                     dini_IntSet(filestring, "Skin", 0);
                     dini_IntSet(filestring, "Level", 0);
                     dini_IntSet(filestring, "AdminLevel", 0);
                     SendClientMessage(playerid, GREEN, "You have been registered successfully! Please now go through some steps.");
                     ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Gender", "Please choose the gender of your character:", "Male", "Female");
              }
        }
        case 3:
        {
              new filestring[128];
                     format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
              if(response){
                   dini_Set(filestring, "Gender", "Male");
              }else{
                   dini_Set(filestring, "Gender", "Female");
              }
              ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Date of Birth", "Please type in the day of the month which your character were born on:", "Submit", "Cancel");
        }
        case 4:
        {
                 new filestring[128];
                     format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
                 if(response){
                     new dob = strval(inputtext);
                     dini_IntSet(filestring, "DateOB", dob);
                     ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "Month of Birth", "Please type in the the month in which your character were born:", "Submit", "Cancel");

                 }
        }
        case 5:
        {
                 new filestring[128];
                     format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
                 if(response){
                     new mob = strval(inputtext);
                     dini_IntSet(filestring, "MonthOB", mob);
                     ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "Year of Birth", "Please type in the the year in which your character were born:", "Submit", "Cancel");

                 }
        }
        case 6:
        {
                 new filestring[128];
                     format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
                 if(response){
                     new yob = strval(inputtext);
                     dini_IntSet(filestring, "YearOB", yob);
                     SendClientMessage(playerid, GREEN, "You are now fully registered! Please log in with your password.");
                     ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel");
                 }
        }
   
    }
    return 0;
}
Reply
#2

Since you didnt post and dialogid I think it happens at all

Add a \/ in the first line (of the callback)
pawn Код:
printf("OnDialogResponse(%d, %d, %d, %d, \"%s\")", playerid, dialogid, response, listitem, inputtext);
And check what the console prints if you press a dialog button
Reply
#3

It says what it's supposed to say, that the playerid is 0, dialogid is 2, response is 1, listitem is -1 and inputtext is whatever I wrote in the box..
Reply
#4

Make sure you also have return 0; at the end of OnDialogResponse in all your other scripts which uses dialogs
Reply
#5

It is return 0 in those.
Reply
#6

Place print's. The code might be stopping somewhere.
Reply
#7

Alright. Here's what I did:

Quote:

print("case 2 works - this shows");
if(response){
print("if response works - this shows");
new filestring[128];
format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
dini_Create(filestring);
new namestring[256];
new passstring[256];
format(namestring, sizeof(namestring), "%s", GetPlayerName(playerid));
format(passstring, sizeof(passstring), "%s", inputtext);
dini_Set(filestring, "Name", namestring);
dini_Set(filestring, "Password", passstring);
dini_FloatSet(filestring, "LastX", 1643.086181);
dini_FloatSet(filestring, "LastY", -2237.591796);
dini_FloatSet(filestring, "LastZ", 13.494955);
dini_IntSet(filestring, "Skin", 0);
dini_IntSet(filestring, "Level", 0);
dini_IntSet(filestring, "AdminLevel", 0);
SendClientMessage(playerid, GREEN, "You have been registered successfully! Please now go through some steps.");
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Gender", "Please choose the gender of your character:", "Male", "Female");
print("after code - this shows");

and the print("after code - this shows"); were not executed.

What is wrong? Any ideas?
Reply
#8

Alright, it seems that it's my dini functions that is not working... Any ideas here?
Reply
#9

Quote:
Originally Posted by Kyle_Olsen
Посмотреть сообщение
Alright, it seems that it's my dini functions that is not working... Any ideas here?
It's /Accounts/%s not Accounts/%s

Also, remember that it's case sensetive on Linux.

PS. Don't doublepost
Reply
#10

1: I've got the same cases.
2: I'm using Windows Vista
3: It didn't work putting a / before Accounts
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)