OnDialogResponse isn't working
#7

Fixed script:

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 11112)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                
ShowPlayerDialog(playerid22221DIALOG_STYLE_LIST"Make a weapon order""Deagle - 2,000\nSpas-12 - 5,000\nM4 - $3,900\nSniper - $3,700\nAK-47 - $3500\nMP5 - $1,500\nFlamethrower - $10,000Shovel - $60\nBat - $50\nKnife - $25\nChainsaw - $7,000""Purchase""Cancel order");
            }
            if(
listitem == 1)
            {
                
ShowPlayerDialog(playerid33331DIALOG_STYLE_LIST"First aid & vest order""First aid kit - $4,500\nVest - $6,000""Purchase""Cancel order");
            }
            if(
listitem == 2)
            {
                
ShowPlayerDialog(playerid44441DIALOG_STYLE_MSGBOX"Department of Protection""The Department of Protection (DOP) are currently\nworking on a cure called Antidevoxal.  An Antidevoxal\nwill cure infected human beings from the Vox virus.""Okay""");
            }
            if(
listitem == 3)
            {
                
ShowPlayerDialog(playerid66661DIALOG_STYLE_MSGBOX"Department of Protection""There are currently no maps in stock at this department.\nVisit a D.O.P in another state for more supples!""Okay""");
            }
            if(
listitem == 4)
            {
                
ShowPlayerDialog(playerid77771DIALOG_STYLE_MSGBOX"Department of Protection""There is no food available at this department.\nVisit a D.O.P in another state for more supplies!""Okay""");
            }
            if(
listitem == 5)
            {
                
ShowPlayerDialog(playerid88881DIALOG_STYLE_LIST"BULK BUY (SETTLEMENT SUPPORT SCHEME)""Bulk buy weapons - $30,000\nBulk buy kits/armour - $10,000\nBulk buy maps\nBulk buy food""Select""Cancel");
            }
        }
    }
    if(
dialogid == 22221)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                if(
GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid24200);
                    
GivePlayerMoney(playerid, -2000);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Deagle from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 1)
            {
                if(
GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid27250);
                    
GivePlayerMoney(playerid, -5000);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Spas12 from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 2)
            {
                if(
GetPlayerMoney(playerid) < 3900) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid31400);
                    
GivePlayerMoney(playerid, -3900);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased an M4 from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 3)
            {
                if(
GetPlayerMoney(playerid) < 3700) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid34200);
                    
GivePlayerMoney(playerid, -3700);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Sniper from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 4)
            {
                if(
GetPlayerMoney(playerid) < 3500) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid30400);
                    
GivePlayerMoney(playerid, -3500);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased an AK-47 from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 5)
            {
                if(
GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid29200);
                    
GivePlayerMoney(playerid, -1500);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased an MP5 from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 6)
            {
                if(
GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid37300);
                    
GivePlayerMoney(playerid, -10000);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased an Flame Thrower from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 7)
            {
                if(
GetPlayerMoney(playerid) < 60) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid6200);
                    
GivePlayerMoney(playerid, -60);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Shovel from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 8)
            {
                if(
GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid5200);
                    
GivePlayerMoney(playerid, -50);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Bat from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 9)
            {
                if(
GetPlayerMoney(playerid) < 25) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid4200);
                    
GivePlayerMoney(playerid, -25);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Knife from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 10)
            {
                if(
GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid9200);
                    
GivePlayerMoney(playerid, -7000);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Chainsaw from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
        }
    }
    if(
dialogid == 3331)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                if(
GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
SetPlayerHealth(playerid100);
                    
GivePlayerMoney(playerid, -4500);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a First aid kit from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
            if(
listitem == 1)
            {
                if(
GetPlayerMoney(playerid) < 6000) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
SetPlayerArmour(playerid100);
                    
GivePlayerMoney(playerid, -6000);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Your order has been processed.  You have purchased a Vest from the Department of Protection");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe out there, it's very dangerous! Group up, stay together and stay away from populated areas.");
                }
            }
        }
    }
    if(
dialogid == 88881)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                if(
GetPlayerMoney(playerid) < 30000) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
GivePlayerWeapon(playerid24200);
                    
GivePlayerWeapon(playerid27250);
                    
GivePlayerWeapon(playerid31400);
                    
GivePlayerWeapon(playerid34200);
                    
GivePlayerWeapon(playerid30400);
                    
GivePlayerWeapon(playerid29300);
                    
GivePlayerWeapon(playerid37200);
                    
GivePlayerWeapon(playerid6200);
                    
GivePlayerWeapon(playerid5200);
                    
GivePlayerWeapon(playerid4200);
                    
GivePlayerWeapon(playerid9200);
                    
GivePlayerMoney(playerid, -30000);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: You have bought one each of every weapon in bulk purchase.  You paid $30,000 and saved $6,000!");
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: Stay safe courageous survivor. The outskirts of Los Santos are unsafe.");
                }
            }
            if(
listitem == 1)
            {
                if(
GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, -1"You don't have enough money to make an order for this item!");
                {
                    
SetPlayerHealth(playerid100);
                    
SetPlayerArmour(playerid100);
                    
GivePlayerMoney(playerid, -10000);
                    
SendClientMessage(playerid, -1"AUTOMATED MESSAGE: You have bought a first aid kit and vest in bulk purchase.  You paid $10,000 and saved $500!");
                }
            }
        }
       return 
1;
    }
    return 
0;

There should also be a "return 1;" at the end. Please calculate the braces and place the "return 1;" where it should be IF THERE ARE ERRORS.

Visit this: Click here
Reply


Messages In This Thread
OnDialogResponse isn't working - by Josh_Main - 12.09.2016, 10:49
Re: OnDialogResponse isn't working - by Shinja - 12.09.2016, 11:30
Re: OnDialogResponse isn't working - by Josh_Main - 12.09.2016, 12:39
Re: OnDialogResponse isn't working - by Josh_Main - 13.09.2016, 00:41
Re: OnDialogResponse isn't working - by Rufio - 13.09.2016, 02:33
Re: OnDialogResponse isn't working - by Josh_Main - 13.09.2016, 10:58
Re: OnDialogResponse isn't working - by AjaxM - 13.09.2016, 12:32

Forum Jump:


Users browsing this thread: 1 Guest(s)