Server crashes because of dialogs
#1

Hello, I am using dialogs for my phone script, and I am having sort of a problem.

I run this dialog here:

pawn Code:
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_MSGBOX, "Phone", "Choose what you want to do:", "Call", "SMS");
Which should trigger this code:

pawn Code:
case 7:
        {
              if(response)
              {
                  format(string, sizeof(string), "* %s types in a number and brings their phone to their ear", GetName(playerid));
                  NearByMessage(playerid, 12.0, PURPLE, string);
                  ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Phone", "Type in the number you wish to call:", "Call", "Cancel");
              }else{
                  format(string, sizeof(string), "* %s types in a number on their cellphone", GetName(playerid));
                  NearByMessage(playerid, 12.0, PURPLE, string);
                  ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT, "Phone", "Type in the number you wish to SMS:", "Proceed", "Cancel");
              }
        }
But instead, if I click any of the buttons, it crashes the server.

Does anyone know what might cause this?
Reply
#2

Try This:

pawn Code:
case 7:
        {
                  format(string, sizeof(string), "* %s types in a number and brings their phone to their ear", GetName(playerid));
                  NearByMessage(playerid, 12.0, PURPLE, string);
                  ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Phone", "Type in the number you wish to call:", "Call", "Cancel");
              }else{
                  format(string, sizeof(string), "* %s types in a number on their cellphone", GetName(playerid));
                  NearByMessage(playerid, 12.0, PURPLE, string);
                  ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT, "Phone", "Type in the number you wish to SMS:", "Proceed", "Cancel");
              }
        }
return 1;
}
Reply
#3

That would return an error because there are one bracket too much and also I am using the if(response) to choose which action to do.
Reply
#4

Why Are You Using Case Then?
Try this:
pawn Code:
if(dialogid == id)
{
if(response)
        {
                  format(string, sizeof(string), "* %s types in a number and brings their phone to their ear", GetName(playerid));
                  NearByMessage(playerid, 12.0, PURPLE, string);
                  ShowPlayerDialog(playerid, 8, DIALOG_STYLE_INPUT, "Phone", "Type in the number you wish to call:", "Call", "Cancel");
              }else{
                  format(string, sizeof(string), "* %s types in a number on their cellphone", GetName(playerid));
                  NearByMessage(playerid, 12.0, PURPLE, string);
                  ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT, "Phone", "Type in the number you wish to SMS:", "Proceed", "Cancel");
              }
        }
return 1;
}
if Pawn Crashes Remove Or Add One More Bracket Before Return.
Reply
#5

That will not fix my problem.
Cases haven't got anything to do with my problem, cases are just an easier version of checking what dialog ID it is.
Reply
#6

Debug your server and see where the code stop.
Reply
#7

Your Problem Is Basicly
pawn Code:
}else{
Because It Happened To Me Many Times. That's Not Really Big Problem I Guess.
Reply
#8

Nope, that was not the problem, I tried replacing the else with a new if, but the same thing happened.

Quote:
Originally Posted by varthshenon
View Post
Debug your server and see where the code stop.
The server crashes when I click call or SMS, I can't get it closer than that...
Reply
#9

Great. So Working Now?
Reply
#10

No, when I get the same thing, of course it isn't working?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)