Server crashes because of dialogs -
Kyle_Olsen - 06.08.2011
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?
Re: Server crashes because of dialogs -
0_o - 06.08.2011
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;
}
Re: Server crashes because of dialogs -
Kyle_Olsen - 06.08.2011
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.
Re: Server crashes because of dialogs -
0_o - 06.08.2011
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.
Re: Server crashes because of dialogs -
Kyle_Olsen - 06.08.2011
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.
Re: Server crashes because of dialogs -
=WoR=Varth - 06.08.2011
Debug your server and see where the code stop.
Re: Server crashes because of dialogs -
0_o - 06.08.2011
Your Problem Is Basicly
Because It Happened To Me Many Times. That's Not Really Big Problem I Guess.
Re: Server crashes because of dialogs -
Kyle_Olsen - 06.08.2011
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
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...
Re: Server crashes because of dialogs -
0_o - 06.08.2011
Great. So Working Now?
Re: Server crashes because of dialogs -
Kyle_Olsen - 06.08.2011
No, when I get the same thing, of course it isn't working?