OnDialogResponse problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnDialogResponse problem (
/showthread.php?tid=418220)
OnDialogResponse problem -
Noles2197 - 24.02.2013
Solved
Re: OnDialogResponse problem -
kay420 - 24.02.2013
Trying to get that to work too :P
Re: OnDialogResponse problem -
JaKe Elite - 24.02.2013
You doing it wrong.
It must be like this
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) // Answers: 2,1,3,1,2,3,1
{
if(dialogid == 3) //The same just like i did below
{
if(!response) return Kick(playerid);
if(response)
{
switch(listitem)
{
case 0:
{
}
case 1:
{
}
case 2:
{
}
}
}
return 1;
}
if(dialogid == 2)
{
if(!response) return Kick(playerid);
if(response)
{
switch(listitem)
{
case 0:
{
///me thinks about Allen's clothes.
}
case 1:
{
///me laughs at Allen's joke.
}
case 2:
{
//me punches Allen in the face
}
}
}
return 1;
}
}
Re: OnDialogResponse problem -
Noles2197 - 24.02.2013
I tried to use this, but I got an error for basically every line. Can you tell me what I did wrong?
pawn Код:
if(dialogid == 2)
{
if(!response) return Kick(playerid);
if(response)
{
switch(listitem)
{
case 2:
{
ShowPlayerDialog(playerid,3,2, "What's a good example of a '/do'?{007F46} (2/7)", "/do My hair appears to be brown.\n/do Smiles at Jordan.\n/do Where is Cluckin' Bell?", "Select", "Cancel");
}
else Kick(playerid);
}
}
return 1;
}
Re: OnDialogResponse problem -
JaKe Elite - 24.02.2013
stop using else inside the switch.
i already give you the example.
Example
pawn Код:
ShowPlayerDialog(playerid, 0, 2, "Who is my gf", "Lady Gaga\nJustin Bieber\nNicki Minaj", "Choose", "Exit");
pawn Код:
if(dialogid == 0)
{
switch(listitem)
{
case 0: //lady gaga
{
GameTextForPlayer(playerid, "~r~Wrong", 3000, 3);
Kick(playerid);
}
case 1: //justin bieber
{
GameTextForPlayer(playerid, "~g~Correct~n~~w~He is gay!", 4500, 3);
}
case 2: //Nicki Minaj
{
GameTextForPlayer(playerid, "~r~Wrong", 3000, 3);
Kick(playerid);
}
}
}
Re: OnDialogResponse problem -
Scenario - 24.02.2013
By the way, this is redundant...
pawn Код:
if(!response) return Kick(playerid);
if(response)
You only need to check if the response was 0/false, there's no reason to check if it was 1/true. So, just do this:
pawn Код:
if(!response)
return Kick(playerid);
Re: OnDialogResponse problem -
Noles2197 - 24.02.2013
Nevermind