SA-MP Forums Archive
Little help with Bank withdraw please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little help with Bank withdraw please (/showthread.php?tid=553990)



Little help with Bank withdraw please - LeXuZ - 01.01.2015

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!


Re: Little help with Bank withdraw please - ball - 01.01.2015

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);
				}
			}
		}
	}
}



Re: Little help with Bank withdraw please - Boot - 01.01.2015

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;
    }



Re: Little help with Bank withdraw please - LeXuZ - 01.01.2015

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!


Re: Little help with Bank withdraw please - LeXuZ - 03.01.2015

Anyone know anyway of fixing this