Dialog script issue.
#5

use this:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "Use Again");
                return 1; // We processed it
            }

            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0:
                {
					if (GetPlayerMoney(playerid) >= 50)
					{
					GivePlayerWeapon(playerid,22,50);
					GivePlayerMoney(playerid,-50);
					GameTextForPlayer(playerid,"~r~-$50",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
                case 1:
                {
                    if (GetPlayerMoney(playerid) >= 3000)
					{
					GivePlayerWeapon(playerid,24,50);
					GivePlayerMoney(playerid,-3000);
					GameTextForPlayer(playerid,"~r~-$3000",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
               	case 2:
                {
                    if (GetPlayerMoney(playerid) >= 750)
					{
                  	GivePlayerWeapon(playerid,25,50);
					GivePlayerMoney(playerid,-750);
					GameTextForPlayer(playerid,"~r~-$750",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
                case 3:
                {
                    if (GetPlayerMoney(playerid) >= 3500)
					{
                  	GivePlayerWeapon(playerid,26,50);
					GivePlayerMoney(playerid,-3500);
					GameTextForPlayer(playerid,"~r~-$3500",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
				case 4:
                {
                    if (GetPlayerMoney(playerid) >= 10000)
					{
                  	GivePlayerWeapon(playerid,27,100);
					GivePlayerMoney(playerid,-10000);
					GameTextForPlayer(playerid,"~r~-$10000",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
				case 5:
                {
                    if (GetPlayerMoney(playerid) >= 2000)
					{
                  	GivePlayerWeapon(playerid,29,150);
					GivePlayerMoney(playerid,-2000);
					GameTextForPlayer(playerid,"~r~-$2000",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
                case 6:
                {
                    if (GetPlayerMoney(playerid) >= 5000)
					{
                  	GivePlayerWeapon(playerid,16,5);
					GivePlayerMoney(playerid,-5000);
					GameTextForPlayer(playerid,"~r~-$5000",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
                case 7:
                {
                    if (GetPlayerMoney(playerid) >= 15000)
					{
                  	GivePlayerWeapon(playerid,30,300);
					GivePlayerMoney(playerid,-15000);
					GameTextForPlayer(playerid,"~r~-$15000",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
                case 8:
                {
                    if (GetPlayerMoney(playerid) >= 25000)
					{
                  	GivePlayerWeapon(playerid,31,300);
					GivePlayerMoney(playerid,-25000);
					GameTextForPlayer(playerid,"~r~-$25000",3000,1);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 10.0);
					}
					else
					{
					SendClientMessage(playerid,red,"You do not have the cash.");
					}
                }
			}
		}
	}
	return 0;
}
Reply


Messages In This Thread
Dialog script issue. - by Sleek - 29.04.2012, 01:20
Re: Dialog script issue. - by warcodes_ - 29.04.2012, 01:34
Re: Dialog script issue. - by $$inSane - 29.04.2012, 01:59
Re: Dialog script issue. - by warcodes_ - 29.04.2012, 02:01
Re: Dialog script issue. - by $$inSane - 29.04.2012, 02:03

Forum Jump:


Users browsing this thread: 5 Guest(s)