Skin selection via inputtext?
#2

Your code checks if the dialogid is equal to SHOP_DIALOG and then you use switch on dialogid and you say, if the dialogid is 0 then show the dialog SHOP_SKIN.

I guess you mean list item:
pawn Код:
if (dialogid == SHOP_DIALOG)
{
    if (response)
    {
        if (!listitem) ShowPlayerDialog(playerid, SHOP_SKIN, DIALOG_STYLE_INPUT, "Enter a valid Skin ID.", "",  "OK", "Cancel");
    }
    return 1;
}
else if (dialogid == SHOP_SKIN)
{
    if (response)
    {
        SetPlayerSkin(playerid, strval(inputtext));
        GivePlayerMoney(playerid, -5000);
    }
    return 1;
}
However, using switch is faster and it's recommended:
pawn Код:
switch (dialogid)
{
    case SHOP_DIALOG:
    {
        if (response)
        {
            if (!listitem) ShowPlayerDialog(playerid, SHOP_SKIN, DIALOG_STYLE_INPUT, "Enter a valid Skin ID.", "",  "OK", "Cancel");
        }
        return 1;
    }
    case SHOP_SKIN:
    {
        if (response)
        {
            SetPlayerSkin(playerid, strval(inputtext));
            GivePlayerMoney(playerid, -5000);
        }
        return 1;
    }
}
If you don't use DIALOG_STYLE_LIST in SHOP_DIALOG dialog, then listitem will be -1 so you will need to change:
pawn Код:
if (!listitem) ShowPlayerDialog(playerid, SHOP_SKIN, DIALOG_STYLE_INPUT, "Enter a valid Skin ID.", "",  "OK", "Cancel");
to:
pawn Код:
ShowPlayerDialog(playerid, SHOP_SKIN, DIALOG_STYLE_INPUT, "Enter a valid Skin ID.", "",  "OK", "Cancel");
Reply


Messages In This Thread
Skin selection via inputtext? - by rangerxxll - 01.03.2014, 19:02
Re: Skin selection via inputtext? - by Konstantinos - 01.03.2014, 19:08
Re: Skin selection via inputtext? - by rangerxxll - 01.03.2014, 19:12
Re: Skin selection via inputtext? - by Konstantinos - 01.03.2014, 19:16
Re: Skin selection via inputtext? - by rangerxxll - 01.03.2014, 19:19
Re: Skin selection via inputtext? - by Konstantinos - 01.03.2014, 19:22
Re: Skin selection via inputtext? - by rangerxxll - 01.03.2014, 19:23
Re: Skin selection via inputtext? - by Konstantinos - 01.03.2014, 19:25

Forum Jump:


Users browsing this thread: 2 Guest(s)