/withdraw bug
#1

Код:
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?
Reply
#2

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?
Reply
#3

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
Reply
#4

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.
Reply
#5

if(cashdeposit > 1000000 && cashdeposit < 999999999)
Reply
#6

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

the second case would allow them to withdraw MORE than 999999999
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)