Dialog msgbox? -
The Woody - 17.03.2011
Im currently learning that whole dialog thing and i have a problem.
When you press buy it does what its supposed to do but when you press cancel nothing happends
i can't get that thing to work and i dont really see a problem so i hope you guys can help out here.
pawn Код:
ShowPlayerDialog( playerid, 4512, DIALOG_STYLE_MSGBOX, "Menu", "Text here", "Buy", "Cancel");
pawn Код:
case 4512:
{
if( response == 0 )
{
RemovePlayerFromVehicle(playerid);
SendClientMessage( playerid, WHITE, "You pressed cancel." );
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage( playerid, WHITE, "You pressed buy." );
}
}
And no its not this:
pawn Код:
if(dialogid == 4512 && response == 1) // And so on... It gives the same result
Re: Dialog msgbox? -
The Woody - 18.03.2011
Can anybody help me with this, its pretty annoying and ive been working on such a small thing for about 4hours now.
Re: Dialog msgbox? -
admantis - 18.03.2011
pawn Код:
if( response == 0 )
// this should be
if (response)
Re: Dialog msgbox? -
The Woody - 18.03.2011
Thanks for your reply! but ive tryed that but nothing happends when i press cancel :/.
pawn Код:
case 4512:
{
if (response)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage( playerid, WHITE, "You pressed buy!" );
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage( playerid, WHITE, "You pressed cancel!" );
}
}
Re: Dialog msgbox? -
admantis - 18.03.2011
change that 'else'.
Does the first button have any effect ?
Re: Dialog msgbox? -
-Rebel Son- - 18.03.2011
I dont understand the case thing,
Should be.
pawn Код:
if(dialogid == DIALOGNAME)
{
if(response)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage( playerid, WHITE, "You pressed buy!" );
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage( playerid, WHITE, "You pressed cancel!" );
}
}
Re: Dialog msgbox? -
The Woody - 18.03.2011
Quote:
Originally Posted by -Rebel Son-
I dont understand the case thing,
Should be.
|
Im using this at top because i have allot of dialogs so its easier and they all work. Just not this one.
pawn Код:
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
{
if( response )
{
switch( dialogid )
{
so "case dialogname:" has the same effect as "if(dialogid == DIALOGNAME)"
Quote:
Originally Posted by admantis
change that 'else'.
Does the first button have any effect ?
|
That didnt work still nothing :/. Yes the first button does what its suppose to do.
Re: Dialog msgbox? -
-Rebel Son- - 18.03.2011
The way your doing it is causing the problems, dont use a switch, Just use as i gave you. i use 19 dialogs, and this way is solid.
Re: Dialog msgbox? -
JamesC - 18.03.2011
Quote:
Originally Posted by -Rebel Son-
The way your doing it is causing the problems, dont use a switch, Just use as i gave you. i use 19 dialogs, and this way is solid.
|
Its also slow and inefficient. Please do not post if you don't know what you're talking about.
@Woody: You have an if(response) right at the top, so everything below it only runs if your response = 1. Remove that if you want your code to work.
Re: Dialog msgbox? -
The Woody - 18.03.2011
Quote:
Originally Posted by JamesC
Its also slow and inefficient. Please do not post if you don't know what you're talking about.
@Woody: You have an if(response) right at the top, so everything below it only runs if your response = 1. Remove that if you want your code to work.
|
Thanks for your reply! but if i only say something like this
pawn Код:
case 4512:
{
RemovePlayerFromVehicle(playerid);
SendClientMessage( playerid, WHITE, "You pressed buy!" );
}
The first button works but how am i suppose to make a else for the second button?
Or did i misunderstood you? do you mean the if(response) at top or in the case?