Dialog is not showing!
#1

Hello. Need help (again )

So, I'm trying to make a vehicle dealership for whole San Andreas
Instead for each city and each dialog to create so many same lines, I made it like this (Sorry for my english)

This is the code

There are the Airport dealerships (in LS, LV and SF) were you can buy air vehicles
Everything works but the "Back" line doesn't. (if you get what I mean)
it just exits the dialog and doesn't return the dialog (99)

How can I fix this? I tried and failed


Thanks!
Reply
#2

pawn Код:
new string[64];
format(string, sizeof(string), "I really need help with this guys. Any pro scripters in tha house?");
GameTextForAll( string, 5000, 3 );
Reply
#3

You need to add:
pawn Код:
if (!response) return ShowPlayerDialog(syntax...);
Response == Checks if the player pressed button 1 or 0.
In your case, you need to check if he's pressing button 0 = which is back.
Reply
#4

Uh I didn't explain very well.

http://www.xfire.com/video/478216/

Like in this video When I press the "Back" it closed the dialog instead of showing a previous dialog.

pawn Код:
if(dialogid == 79){carid = Aarray[listitem], money = AMarray[listitem], S = 8;}
        if(dialogid == 78){carid = Harray[listitem], money = HMarray[listitem], S = 6;}
        if(listitem == S) return ShowPlayerDialog(playerid, 99, DIALOG_STYLE_LIST,"Select","Airplanes\nHelicopters","Select","Cancle");
carid and money are working with no problems but the "S" isn't.
The question is how to make in this script when I press "Back" it returns me to previous dialog?
Reply
#5

Quote:
Originally Posted by Antonio144
Посмотреть сообщение
pawn Код:
new string[64];
format(string, sizeof(string), "I really need help with this guys. Any pro scripters in tha house?");
GameTextForAll( string, 5000, 3 );
You know, you didn't need to format that string. It could have been:

pawn Код:
GameTextForAll( "I really need help with this guys. Any pro scripters in tha house?", 5000, 3 );
Edit: Did you define 'S'?
Reply
#6

I know but I wanted to make it little bit complicated (not that this is)
Reply
#7

pawn Код:
new vehicle, carid, money, S;
        new Aarray[] = {592,577,511,512,593,553,519,513};
        new AMarray[] = {Andromada,AT-400,Beagle,Cropduster,Dodo,Nevada,Shamal,Stuntplane};
        new Harray[] = {548,417,487,488,563,469};
        new HMarray[] = {Cargobob,Leviathan,Maverick,NewsMaverick,Raindance,Sparrow};
like this (the S)

(shit I forgot about the edit button)
Reply
#8

Like I wrote,
Him pressing "Back" is the same as (!return).
Meaning, go to the Dialog where he can press "Back", if there isn't a response, then open the previous dialog with ShowPlayerDialog.
Reply
#9

Quote:
Originally Posted by shitbird
Посмотреть сообщение
Like I wrote,
Him pressing "Back" is the same as (!return).
Meaning, go to the Dialog where he can press "Back", if there isn't a response, then open the previous dialog with ShowPlayerDialog.
Back is a listitem and not the second button

And to your problem

But just some code improvements before
pawn Код:
//OnDialogResponse
    if(dialogid == 99 && response) {
        new string[256]; //only one string
        if(listitem == 0) { //switch is only useful for more items, not for two
            format(string, ...);
            ShowPlayerDialog(...);
        } else {
            format(string, ...);
            ShowPlayerDialog(...);
        }
        return 1; //just to stop the code, would be a waste to check for the other dialogids if we already know that its 99
    }
    if((dialogid == 79 || dialogid == 78) && response) { //and and or is like * and +, && gets checked first! so we need the bracket
Now to the problem
pawn Код:
if(dialogid == 79){carid = Aarray[listitem], money = AMarray[listitem], S = 8;}
if(dialogid == 78){carid = Harray[listitem], money = HMarray[listitem], S = 6;}
That code will crash if the listitem is bigger than the size of the array
And that happens with "Back", Aarray (size 8 - last item 7) and back is 8

So what to do, just some little changes
pawn Код:
if((dialogid == 79 || dialogid == 78) && response) {
    new vehicle, carid, money; //static and constant arrays, no need to recreate them if nothing changes
    static const Aarray[] = {592,577,511,512,593,553,519,513};
    static const AMarray[] = {Andromada,AT-400,Beagle,Cropduster,Dodo,Nevada,Shamal,Stuntplane};
    static const Harray[] = {548,417,487,488,563,469};
    static const HMarray[] = {Cargobob,Leviathan,Maverick,NewsMaverick,Raindance,Sparrow};
    if(dialogid == 79) {
        if(listitem == sizeof(Aarray)) return ShowPlayerDialog(playerid, 99, DIALOG_STYLE_LIST,"Select","Airplanes\nHelicopters","Select","Cancle");
        carid = Aarray[listitem], money = AMarray[listitem];
    } else { //the other id
        if(listitem == sizeof(Harray)) return ShowPlayerDialog(playerid, 99, DIALOG_STYLE_LIST,"Select","Airplanes\nHelicopters","Select","Cancle");
        carid = Harray[listitem], money = HMarray[listitem];
    }
    //the checkpoint code
    return 1; //the return again
}
Reply
#10

Oh, right. My mistake. :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)