Dialog msgbox?
#1

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
Reply
#2

Can anybody help me with this, its pretty annoying and ive been working on such a small thing for about 4hours now.
Reply
#3

pawn Код:
if( response == 0 )
// this should be
if (response)
Reply
#4

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!" );
    }
}
Reply
#5

pawn Код:
else if (!response)
change that 'else'.
Does the first button have any effect ?
Reply
#6

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!" );  
 }
}
Reply
#7

Quote:
Originally Posted by -Rebel Son-
Посмотреть сообщение
I dont understand the case thing,

Should be.

pawn Код:
code..
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
Посмотреть сообщение
pawn Код:
else if (!response)
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.
Reply
#8

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.
Reply
#9

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.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)