Author Topic: [TUTORIAL] How to use ShowPlayerDialog?  (Read 636 times)

xian

  • Administrator
  • Newbie
  • **********
  • Posts: 8
  • Reputation: 0
    • View Profile
Re: [TUTORIAL] How to use ShowPlayerDialog?
« on: April 22, 2013, 11:07:08 pm »
Input dialog example(s) :
Code: [Select]
ShowPlayerDialog(
    playerid,
    1337,
    DIALOG_STYLE_INPUT,
    "Food Shop",
    "(1). Burger\n(2). Pizza\n(3). Donuts\nPlease input the number of the food you want to buy.",
    "Input", "Exit"
);

At OnDialogResponse :
Code: [Select]
switch ( dialogid )
{
    case 1337:
    {
        if ( response )
        {
            new food = strval( inputtext );
            if ( !( 1 <= food <= 3 ) ) return SendClientMessage( playerid, -1, "Invalid food ID! <1-3>" );
            new food_name[ 100 ];
            switch ( food )
            {
                case 0: food_name = "Burger";
                case 1: food_name = "Pizza";
                case 2: food_name = "Donuts";
            }
            new str[128]; format(str, 128, "You have bought a %s", food_name);
            SendClientMessage(playerid, -1, str);
        }
    }
}
yum, yum, that's delicious. Anyway, thanks for listing out a tutorial of INPUT. ;)