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;
}
PlayerInfo[playerid][pBank] -= cashdeposit;
|
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 Код:
|
if(cashdeposit > 1000000 && cashdeposit < 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not allowed to withdraw that much");
return 1;
}
|
Originally Posted by [NL
WackoX ]
if(cashdeposit > 1000000 && cashdeposit < 999999999) |
|
Originally Posted by Thanatos
the second case would allow them to withdraw MORE than 999999999
|