Dialoge help rep+
#1

Can any oone help me with dialoge when I buy something I dont get any thing nor my money reduces
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/buyaccessories", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,58.6817,-168.0704,990.0303))
        ShowPlayerDialog(playerid,3300,DIALOG_STYLE_LIST,"What do you want buy?","Motorcycle Helmet green($50)\nMotorcycle Helmet black($50)\nMotorcycle Helmet blue($50)\nMotorcycle Helmet purple($50)\nTopHat green($50)\nTopHat black($50)\nTopHat purple($50)\nTopHat yellow($50)","Purchase","Cancel");
        return 1;
    }
    return 0;
}
pawn Код:
{
    if(dialogid == 3300)//our dialog!
    {
        if(response)// They pressed the first button.
        {
            switch(listitem)
            {
                case 0:// The first item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xFF00FF00);
                }
                case 1: // The second item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0x000000);
                }
                case 2: // The third item listed
                {
                    if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -3);
                    SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0x0039F5);
                }
                   case 3: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
                }
                   case 4: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
                    SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);
                }
                   case 5: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0x000000);
                }
                case 6: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xE105FA);
                }
                case 7: // The forth item listed
                {
                    if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFAFA05);
                }
            }
        }

    }
    return 1;
}
REP + if you fix it.
Reply
#2

On dialog's cases where you use if,try use if-else...
Reply
#3

Make sure you don't have any dialog defined to 0, 1, 2,3 etc.
Reply
#4

you have any dialogresponse on your script?
Reply
#5

Well I've just tested this out real quick, works perfect.

Try this, changed a few things. Also make sure you doesn't have any other dialogs under ID 3300.
If you do, just change the ID number to something thats not in use, as well make sure you put this under OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

pawn Код:
if(dialogid == 3300)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -50);
                SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xFF00FF00);
            }
            if(listitem == 1)
            {
                if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -50);
                SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0x000000);
            }
            if(listitem == 2)
            {
                if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -3);
                SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0x0039F5);
            }
            if(listitem == 3)
            {
                if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -50);
                SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
            }
            if(listitem == 4)
            {
                if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -50);SetPlayerAttachedObject(playerid, 3, 18976, 2, 0.101, -0.0, 0.0, 2.0, 90.60, 83.7, 1.05, 1.2, 1, 0xF500ED);
                SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);
            }
            if(listitem == 5)
            {
                if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -50);
                SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0x000000);
            }
            if(listitem == 6)
            {
                if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -50);
                SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xE105FA);
            }
            if(listitem == 7)
            {
                if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                GivePlayerMoney(playerid, -50);
                SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFAFA05);
            }
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)