SA-MP Forums Archive
/withdraw bug - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /withdraw bug (/showthread.php?tid=84489)



/withdraw bug - tomnidi - 01.07.2009

Код:
if(strcmp(cmd, "/withdraw", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(PlayerToPoint(5.0,playerid,BankPosition[X],BankPosition[Y],BankPosition[Z]))
	    {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /withdraw [amount]");
					return 1;
				}
				new cashdeposit = strval(tmp);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "USAGE: /withdraw [amount]");
					return 1;
				}
				if(cashdeposit > 1000000 && cashdeposit < 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
				{
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not allowed to withdraw that much");
					return 1;
				}
				if(PlayerInfo[playerid][pBank] >= cashdeposit)
				{
					GivePlayerCash(playerid,cashdeposit);
					PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-cashdeposit;
					format(string, sizeof(string), "[INFO:] You have withdrawn $%d, new balance: $%d", cashdeposit,PlayerInfo[playerid][pBank]);
					SendClientMessage(playerid, COLOR_WHITE, string);
          PlayerActionMessage(playerid,15.0,"recieves a package full of money from the bank clerk.");
          OnPlayerDataSave(playerid);
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have that much in your bank!");
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not at the bank!");
			}
		}
		return 1;
	}
I can not withdraw cash that I do not have in my bank account, buy if I type /withdraw 1000000+, it gives me the cash and makes a "-" with the same ammount in my bank account.
A lot of people abused this bug in my server, so I need to find a way to fix that?
Any help please?


Re: /withdraw bug - Brendan_Thomson - 01.07.2009

I'm not quite sure whats up, but I know that
PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-cashdeposit;

can be shortened by doing

pawn Код:
PlayerInfo[playerid][pBank] -= cashdeposit;
So, your saying that if they add '+' onto the end it bugs up?


Re: /withdraw bug - tomnidi - 01.07.2009

Quote:
Originally Posted by Brendan_Thomson
I'm not quite sure whats up, but I know that
PlayerInfo[playerid][pBank]=PlayerInfo[playerid][pBank]-cashdeposit;

can be shortened by doing

pawn Код:
PlayerInfo[playerid][pBank] -= cashdeposit;
So, your saying that if they add '+' onto the end it bugs up?
No.. they just did "withdraw 9999999999999999999999" and they got the money, got the same ammount with "+" in thier bank account,sent all the "+" ammount to friends, and oppened a new char. I will try your thing right now


Re: /withdraw bug - Brendan_Thomson - 01.07.2009

pawn Код:
if(cashdeposit > 1000000 && cashdeposit < 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
                {
                  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not allowed to withdraw that much");
                    return 1;
                }
Why the && cashdeposit < *massive number* ??

if(cashdeposit > 1000000) would work fine.


Re: /withdraw bug - Andom - 01.07.2009

if(cashdeposit > 1000000 && cashdeposit < 999999999)


Re: /withdraw bug - Brendan_Thomson - 01.07.2009

Quote:
Originally Posted by [NL
WackoX ]
if(cashdeposit > 1000000 && cashdeposit < 999999999)
I still don't see the point in having it


Re: /withdraw bug - Ignas1337 - 01.07.2009

the second case would allow them to withdraw MORE than 999999999


Re: /withdraw bug - Brendan_Thomson - 01.07.2009

Quote:
Originally Posted by Thanatos
the second case would allow them to withdraw MORE than 999999999
my point exactly