Help with commands: withdraw & deposit.
#1

Код:
    if(dialogid == 2001)//deposit
    {
        if(response)
        {
            new izabranasuma;
            switch(listitem)
            {
                case 0:{izabranasuma = 1000;}
                case 1:{izabranasuma = 2000;}
				case 2:{izabranasuma = 3000;}
                case 3:{izabranasuma = 4000;}
                case 4:{izabranasuma = 5000;}
				case 5:{izabranasuma = 10000;}
                case 6:{izabranasuma = 20000;}
                case 7:{izabranasuma = 30000;}
				case 8:{izabranasuma = 40000;}
                case 9:{izabranasuma = 50000;}
                case 10:{izabranasuma = 100000;}
				case 11://unesi iznos
				{
					ShowPlayerDialog(playerid,2004,DIALOG_STYLE_INPUT,"|° Banka °|","Upisite vrijednost koju zelite da stavite u banku.","Deposit","Odustani");
					return 1;
				}

            }
			new cashdeposit = izabranasuma;
			if (cashdeposit > GetPlayerMoney(playerid))
			{
				GameTextForPlayer(playerid, "~w~Nemate toliko~n~~r~Novca!!!", 3000, 1);
				return 1;
			}
 			SafeGivePlayerMoney(playerid,-cashdeposit);
			new curfunds = PlayerInfo[playerid][pAccount];
			PlayerInfo[playerid][pAccount]=cashdeposit+PlayerInfo[playerid][pAccount];
			SendClientMessage(playerid, COLOR_WHITE, "|___ IZJAVA BANKE ___|");
			format(string, sizeof(string), "  Staro Stanje: $%d", curfunds);
			SendClientMessage(playerid, COLOR_GRAD2, string);
			format(string, sizeof(string), "  Deposit: $%d",cashdeposit);
			SendClientMessage(playerid, COLOR_GRAD4, string);
			SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
			format(string, sizeof(string), "  Novo Stanje: $%d", PlayerInfo[playerid][pAccount]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			ShowPlayerDialog(playerid,2001,DIALOG_STYLE_LIST,"|° Banka °|","1.000$\n2.000$\n3.000$\n4.000$\n5.000$\n10.000$\n20.000$\n30.000$\n40.000$\n50.000$\n100.000$\nUnesi Iznos","Deposit","Zatvori");
		}
		else
		{
			ShowPlayerDialog(playerid,2000,DIALOG_STYLE_LIST ,"|° Banka °|","Deposit\nWithdraw\nKredit\nBalance","Odaberi","Odustani");
		}
		return 1;
    }
    if(dialogid == 2002)//withdraw
    {
        if(response)
        {
            new izabranasuma;
            switch(listitem)
            {
                case 0:{izabranasuma = 1000;}
                case 1:{izabranasuma = 2000;}
				case 2:{izabranasuma = 3000;}
                case 3:{izabranasuma = 4000;}
                case 4:{izabranasuma = 5000;}
				case 5:{izabranasuma = 10000;}
                case 6:{izabranasuma = 20000;}
                case 7:{izabranasuma = 30000;}
				case 8:{izabranasuma = 40000;}
                case 9:{izabranasuma = 50000;}
                case 10:{izabranasuma = 100000;}
				case 11://unesi iznos
				{
					ShowPlayerDialog(playerid,2005,DIALOG_STYLE_INPUT,"|° Banka °|","Upisite vrijednost koju zelite da podignete.","Withdraw","Odustani");
					return 1;
				}

            }
            new cashdeposit = izabranasuma;
			if (cashdeposit > PlayerInfo[playerid][pAccount])
			{
				GameTextForPlayer(playerid, "~w~Nemate toliko~n~~r~Novca Na Racunu!", 3000, 1);
				return 1;
			}
			SafeGivePlayerMoney(playerid,cashdeposit);
			PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
			format(string, sizeof(string), "  Uzeli ste $%d sa vaseg racuna, Ukupno: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			ShowPlayerDialog(playerid,2002,DIALOG_STYLE_LIST,"|° Banka °|","1.000$\n2.000$\n3.000$\n4.000$\n5.000$\n10.000$\n20.000$\n30.000$\n40.000$\n50.000$\n100.000$\nUnesi Iznos","Withdraw","Zatvori");
        }
		else
		{
			ShowPlayerDialog(playerid,2000,DIALOG_STYLE_LIST ,"|° Banka °|","Deposit\nWithdraw\nKredit\nBalance","Odaberi","Odustani");
		}
        return 1;
    }
    if(dialogid == 2003)
    {
		if(response)
		{
			ShowPlayerDialog(playerid,2000,DIALOG_STYLE_LIST ,"|° Banka °|","Deposit\nWithdraw\nKredit\nBalance","Odaberi","Odustani");
		}

		return 1;
	}
	if(dialogid == 2004)
	{
	    if(response)
	    {
			new cashdeposit = strval(inputtext);
			if (cashdeposit > GetPlayerMoney(playerid))
			{
				GameTextForPlayer(playerid, "~w~Nemate toliko~n~~r~Novca!!!", 3000, 1);
				return 1;
			}
 			SafeGivePlayerMoney(playerid,-cashdeposit);
			new curfunds = PlayerInfo[playerid][pAccount];
			PlayerInfo[playerid][pAccount]=cashdeposit+PlayerInfo[playerid][pAccount];
			SendClientMessage(playerid, COLOR_WHITE, "|___ IZJAVA BANKE ___|");
			format(string, sizeof(string), "  Staro Stanje: $%d", curfunds);
			SendClientMessage(playerid, COLOR_GRAD2, string);
			format(string, sizeof(string), "  Deposit: $%d",cashdeposit);
			SendClientMessage(playerid, COLOR_GRAD4, string);
			SendClientMessage(playerid, COLOR_GRAD6, "|-----------------------------------------|");
			format(string, sizeof(string), "  Novo Stanje: $%d", PlayerInfo[playerid][pAccount]);
			SendClientMessage(playerid, COLOR_WHITE, string);
			ShowPlayerDialog(playerid,2001,DIALOG_STYLE_LIST,"|° Banka °|","1.000$\n2.000$\n3.000$\n4.000$\n5.000$\n10.000$\n20.000$\n30.000$\n40.000$\n50.000$\n100.000$\nUnesi Iznos","Deposit","Zatvori");
	    }
		else
		{
			ShowPlayerDialog(playerid,2000,DIALOG_STYLE_LIST ,"|° Banka °|","Deposit\nWithdraw\nKredit\nBalance","Odaberi","Odustani");
		}
	}
	if(dialogid == 2005)
	{
	    if(response)
	    {
            new cashdeposit = strval(inputtext);
			if (cashdeposit > PlayerInfo[playerid][pAccount])
			{
				GameTextForPlayer(playerid, "~w~Nemate toliko~n~~r~Novca Na Racunu!", 3000, 1);
				return 1;
			}
			SafeGivePlayerMoney(playerid,cashdeposit);
			PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
			format(string, sizeof(string), "  Uzeli ste $%d sa vaseg racuna, Ukupno: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			ShowPlayerDialog(playerid,2002,DIALOG_STYLE_LIST,"|° Banka °|","1.000$\n2.000$\n3.000$\n4.000$\n5.000$\n10.000$\n20.000$\n30.000$\n40.000$\n50.000$\n100.000$\nUnesi Iznos","Withdraw","Zatvori");
	    }
		else
		{
			ShowPlayerDialog(playerid,2000,DIALOG_STYLE_LIST ,"|° Banka °|","Deposit\nWithdraw\nKredit\nBalance","Odaberi","Odustani");
		}
	}
i have maded in dialog but i have one problem please check and tell me what to fix when he click on Deposit("Unesite Iznos") he wil type 5555555555566666666666 or 6666666666666 and he will get money or he will get -55555555555555 how to fix that?
Reply


Messages In This Thread
Help with commands: withdraw & deposit. - by GBLTeam - 09.03.2011, 12:04
Re: Help with commands: withdraw & deposit. - by alpha500delta - 09.03.2011, 12:21

Forum Jump:


Users browsing this thread: 2 Guest(s)