[HELP]Re-making dialog
#1

How can I remake it by using dialog list? I tried but couldnt do. Can you give me an example

Код:
case BUS_TYPE_AMMUNATION:
			{
			if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
			{
			ShowTextDrawMenu(playerid, TD_MENU_AMMUNATION,"~g~Ammunation", 20, 20);

			if (PlayerInfo[playerid][pGunLic] == 0)format(string, sizeof(string), "Weapon Permit: ~r~No");else format(string, sizeof(string), "Weapon Permit: ~y~Yes");
			ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
			format(string, sizeof(string), "~g~$%d",GOLF_CLUB_PRICE);
			ShowTextDrawMenuItems(playerid, 1, " ", "~y~1 ~w~- Golf Club", string ,GOLF_CLUB_PRICE);
			format(string, sizeof(string), "~g~$%d",BASEBALL_BAT_PRICE);
			ShowTextDrawMenuItems(playerid, 2, " ", "~y~2 ~w~- Baseball Bat", string ,BASEBALL_BAT_PRICE);
			format(string, sizeof(string), "~g~$%d",SHOVEL_PRICE);
			ShowTextDrawMenuItems(playerid, 3, " ", "~y~3 ~w~- Shovel", string ,SHOVEL_PRICE);
			format(string, sizeof(string), "~g~$%d",POOL_CUE_PRICE);
			ShowTextDrawMenuItems(playerid, 4, " ", "~y~4 ~w~- Pool Cue", string ,POOL_CUE_PRICE);
			format(string, sizeof(string), "~g~$%d",CANE_PRICE);
			ShowTextDrawMenuItems(playerid, 5, " ", "~y~5 ~w~- Cane", string ,CANE_PRICE);
			format(string, sizeof(string), "~g~$%d",CHAINSAW_PRICE);
			ShowTextDrawMenuItems(playerid, 6, " ", "~y~6 ~w~- Chainsaw", string ,CHAINSAW_PRICE);
			format(string, sizeof(string), "~g~$%d",PISTOL_PRICE);
			ShowTextDrawMenuItems(playerid, 7, " ", "~y~7 ~w~- Pistol ~r~150 Ammo", string ,PISTOL_PRICE);
			format(string, sizeof(string), "~g~$%d",SILENCED_PISTOL_PRICE);
			ShowTextDrawMenuItems(playerid, 8, " ", "~y~8 ~w~- Silenced Pistol ~r~150 Ammo", string ,SILENCED_PISTOL_PRICE);
			format(string, sizeof(string), "~g~$%d",DESERT_EAGLE_PRICE);
			ShowTextDrawMenuItems(playerid, 9, " ", "~y~9 ~w~- Desert Eagle ~r~150 Ammo", string ,DESERT_EAGLE_PRICE);
			format(string, sizeof(string), "~g~$%d",SHOTGUN_PRICE);
			ShowTextDrawMenuItems(playerid, 10, " ", "~y~10 ~w~- Shotgun ~r~150 Ammo", string ,SHOTGUN_PRICE);
			format(string, sizeof(string), "~g~$%d",SAWNOFF_SHOTGUN_PRICE);
			ShowTextDrawMenuItems(playerid, 11, " ", "~y~11 ~w~- Sawn Off Shotgun ~r~150 Ammo", string ,SAWNOFF_SHOTGUN_PRICE);
			format(string, sizeof(string), "~g~$%d",COMBAT_SHOTGUN_PRICE);
			ShowTextDrawMenuItems(playerid, 12, " ", "~y~12 ~w~- Combat Shotgun ~r~150 Ammo", string ,COMBAT_SHOTGUN_PRICE);
			format(string, sizeof(string), "~g~$%d",MAC10_PRICE);
			ShowTextDrawMenuItems(playerid, 13, " ", "~y~13 ~w~- Mac 10 ~r~200 Ammo", string ,MAC10_PRICE);
			format(string, sizeof(string), "~g~$%d",TEC9_PRICE);
			ShowTextDrawMenuItems(playerid, 14, " ", "~y~14 ~w~- Tec9 ~r~200 Ammo", string ,TEC9_PRICE);
			format(string, sizeof(string), "~g~$%d",MP5_PRICE);
			ShowTextDrawMenuItems(playerid, 15, " ", "~y~15 ~w~- MP5 ~r~200 Ammo", string ,MP5_PRICE);
			format(string, sizeof(string), "~g~$%d",AK47_PRICE);
			ShowTextDrawMenuItems(playerid, 16, " ", "~y~16 ~w~- AK47 ~r~200 Ammo", string ,AK47_PRICE);
			format(string, sizeof(string), "~g~$%d",M4_PRICE);
			ShowTextDrawMenuItems(playerid, 17, " ", "~y~17 ~w~- M4 ~r~200 Ammo", string ,M4_PRICE);
			format(string, sizeof(string), "~g~$%d",RIFLE_PRICE);
			ShowTextDrawMenuItems(playerid, 18, " ", "~y~18 ~w~- Rifle ~r~100 Ammo", string ,RIFLE_PRICE);
			format(string, sizeof(string), "~g~$%d",SNIPER_RIFLE_PRICE);
			ShowTextDrawMenuItems(playerid, 19, " ", "~y~19 ~w~- Sniper Rifle ~r~100 Ammo", string ,SNIPER_RIFLE_PRICE);
			format(string, sizeof(string), "~g~$%d",BODY_ARMOUR_PRICE);
			ShowTextDrawMenuItems(playerid, 20, " ", "~y~20 ~w~- Body Armour", string ,BODY_ARMOUR_PRICE);
			}
			}
Reply
#2

What's the problem ? Warning ? Errors?
Reply
#3

Quote:
Originally Posted by YanLanger
Посмотреть сообщение
What's the problem ? Warning ? Errors?
He wants to change it to a dialog list, as you can see he is using textdraws at the moment
Reply
#4

Quote:
Originally Posted by dionisak0s
Посмотреть сообщение
He wants to change it to a dialog list, as you can see he is using textdraws at the moment
Exactly. Just want a tip on how to do. Otherwise I mess the whole code up
Reply
#5

Can somebody please help me I can't continue scripting without doing this
Reply
#6

Let's say that's your command to open the menu to buy guns, be sure to #define the name of the dialog like #define GUN_MENU.
pawn Код:
CMD:buygun(playerid, params[])
{
    ShowPlayerDialog(playerid, GUN_MENU, DIALOG_STYLE_LIST, "Ammu Nation", "Deagle\nM4 Assault Rifle", "Buy", "Cancel");
}
And on dialog response put this.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == BUY_GUN)
    {
        if(response) // If they clicked 'Select' or double-clicked a weapon
        {
            if(listitem == 0)
            {
                if(GetPlayerCash(playerid) >= 1000)
                {
                    GivePlayerValidWeapon(playerid, 24, 100); // Weapon ID, Ammo
                    GivePlayerCash(playerid, -1000);
                    SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased a Desert Eagle!");
                    return 1;
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_WHITE, "You can't afford that weapon!");
                    return 1;
                }
            }
            if(listitem == 1)
            {
                if(GetPlayerCash(playerid) >= 1000)
                {
                    GivePlayerValidWeapon(playerid, 31, 100); // Weapon ID, Ammo
                    GivePlayerCash(playerid, -1000);
                    SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased an M4 Assasult Rifle!");
                    return 1;
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_WHITE, "You can't afford that weapon!");
                    return 1;
                }
            }
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }

    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
I tryed it to explain it to you somehow, but check this if you wish https://sampwiki.blast.hk/wiki/OnDialogResponse
Reply
#7

I would suggest that you would explain how you did it so next time he will know how.
Reply
#8

Quote:
Originally Posted by YanLanger
Посмотреть сообщение
I would suggest that you would explain how you did it so next time he will know how.
Well I am not that good, but the link from the SAMP Wiki which I gave above can explain something to him, it's not that hard to understand.
Reply
#9

Quote:
Originally Posted by dionisak0s
Посмотреть сообщение
Well I am not that good, but the link from the SAMP Wiki which I gave above can explain something to him, it's not that hard to understand.
I solved the problem thank you
Reply
#10

Quote:
Originally Posted by darkokan
Посмотреть сообщение
I solved the problem thank you
No problem glad to help. ^_^
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)