DIALOG_STYLE_LIST help..
#3

pawn Код:
#define DIALOG_SHOP 1

CMD_shop(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "SHOP", "AK-47\nM4A1\nCombat Shotgun", "Choose", "Quit"); //In the command
   return 1;
}

//AK is Case 0
//M4 is Case 1
//Combat Shotgun is case 2

//On Dialog Response
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_SHOP:
        {
            if (!response)
            {
               return 1;
            }
            if (response)
            {
                switch(listitem)
                {
                  case 0://AK
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                   }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
                    GivePlayerWeapon(playerid, 30, 300);
                 }
                 case 1://M4
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                   }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an M4 for 2500$.");
                    GivePlayerWeapon(playerid, 31, 300);
                 }
                case 2://Combat Shotgun
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                    }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
                    GivePlayerWeapon(playerid, 27, 300);
                 }
               }
           }
       }
    }
    return 1;
}
I hope I helped
Reply


Messages In This Thread
DIALOG_STYLE_LIST help.. - by CLT - 24.06.2013, 22:24
Re: DIALOG_STYLE_LIST help.. - by DobbysGamertag - 24.06.2013, 22:28
Re: DIALOG_STYLE_LIST help.. - by _Khaled_ - 24.06.2013, 22:32
Re: DIALOG_STYLE_LIST help.. - by CLT - 24.06.2013, 22:52
Re: DIALOG_STYLE_LIST help.. - by Josh_Main - 25.06.2013, 04:25
Re: DIALOG_STYLE_LIST help.. - by CLT - 25.06.2013, 06:44

Forum Jump:


Users browsing this thread: 1 Guest(s)