Little help with Bank withdraw please
#1

Hello, I am working on a bank system, But I am stuck on the withdraw part, I've got the code, but it doesn't seem to work properly, I've read up online about how to make bank systems and most of them didn't suit my needs, but I used a bit of code from theirs to help me out with bits such as if player types letters not numbers, When I click on withdraw, it brings me to a dialog with an input box, I type the money in, nothing happens, it doesn't send a message saying I've not go enough or that my it has gone in/out.

My code:
pawn Код:
if(response)
                {
                switch(dialogid == DIALOG_WITHDRAW)
                {
                case 1:
                {
                switch(listitem)
                {
                case 0:
                {
                if(!isnumeric(inputtext)) return SendClientMessage(playerid, -1, "Please only type numbers only");
                if(strval(inputtext) > pInfo[playerid][BMoney]) return SendClientMessage(playerid, -1, "You do not have enough money in your bank account");
                pInfo[playerid][BMoney] = (pInfo[playerid][BMoney] - strval(inputtext));
                GivePlayerMoney(playerid, strval(inputtext));
                format(ustr, sizeof ustr, "You have token out $%i", strval(inputtext));
                SendClientMessage(playerid, -1, ustr);
                }
If you're able to help that would be great! thank you!
Reply
#2

This code is weird. Probably switch/case isn't working. Try this

Код:
if(response)
{
	switch(dialogid)
	{
		case DIALOG_WITHDRAW:
		{
			switch(listitem)
			{
				case 0:
				{
					new theMoney = strval(inputtext);

					if(!isnumeric(inputtext)) return SendClientMessage(playerid, -1, "Please only type numbers only");
					if(theMoney > pInfo[playerid][BMoney]) return SendClientMessage(playerid, -1, "You do not have enough money in your bank account");

					pInfo[playerid][BMoney] -= theMoney;
					GivePlayerMoney(playerid, -theMoney);
					format(ustr, sizeof ustr, "You have token out $%i", theMoney);
					SendClientMessage(playerid, -1, ustr);
				}
			}
		}
	}
}
Reply
#3

Try this code:

pawn Код:
if(dialogid == DIALOG_WITHDRAW)
    {
    if(response)
    {
    switch(listitem)
    {
    case 0:
    {
    if(!isnumeric(inputtext)) return SendClientMessage(playerid, -1, "Please only type numbers only");
    if(strval(inputtext) > pInfo[playerid][BMoney]) return SendClientMessage(playerid, -1, "You do not have enough money in your bank account");
    pInfo[playerid][BMoney] = (pInfo[playerid][BMoney] - strval(inputtext));
    GivePlayerMoney(playerid, strval(inputtext));
    format(ustr, sizeof ustr, "You have token out $%i", strval(inputtext));
    SendClientMessage(playerid, -1, ustr);
    }
    }
    }
    return 1;
    }
Reply
#4

This is odd, it still isn't working with what you gave me and Boot what did you edit? I can't seem to see where you edited the code... thanks for trying to help anyone, still need help fixing it!
Reply
#5

Anyone know anyway of fixing this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)