Bank Errors -
TheKnown - 18.09.2015
So if a player has 0 money in the bank he can still withdraw unlimited money..same with deposit..
Code:
Код:
CMD:deposit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
if(GetPlayerMoney(playerid) < 0) return SendClientMessage(playerid, COLOR_RED, "ERROR:You don't have any money on you!");
new amount;
if(sscanf(params,"nd", amount)) return SendClientMessage(playerid, -1,"USAGE: /deposit [amount]");
GivePlayerMoney(playerid, -amount);
pInfo[playerid][Bank]++;
}
return 1;
}
CMD:withdraw(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
if(pInfo[playerid][Bank] < 0) return SendClientMessage(playerid, COLOR_RED, "ERROR:You Don't Have Money In Your Bank Account!");
new amount;
if(sscanf(params,"nd", amount)) return SendClientMessage(playerid, -1,"USAGE: /withdraw [amount]");
GivePlayerMoney(playerid, amount);
pInfo[playerid][Bank]--;
}
return 1;
}
Re: Bank Errors -
Mister0 - 18.09.2015
Try this, you have this in plus if(sscanf(params,"nd", amount))
PHP код:
CMD:deposit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
if(GetPlayerMoney(playerid) < 0) return SendClientMessage(playerid, COLOR_RED, "ERROR:You don't have any money on you!");
new amount;
if(sscanf(params,"d", amount)) return SendClientMessage(playerid, -1,"USAGE: /deposit [amount]");
if(amount < 0 ) return SendClientMessage(playerid,-1,"You can not withdraw money with minus");
GivePlayerMoney(playerid, -amount);
pInfo[playerid][Bank]++;
}
return 1;
}
CMD:withdraw(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
if(pInfo[playerid][Bank] < 0) return SendClientMessage(playerid, COLOR_RED, "ERROR:You Don't Have Money In Your Bank Account!");
new amount;
if(sscanf(params,"d", amount)) return SendClientMessage(playerid, -1,"USAGE: /withdraw [amount]");
if(amount < 0 ) return SendClientMessage(playerid,-1,"You can not withdraw money with minus");
GivePlayerMoney(playerid, amount);
pInfo[playerid][Bank]--;
}
return 1;
}
Re: Bank Errors -
nezo2001 - 18.09.2015
And
PHP код:
if(GetPlayerMoney(playerid) <= 0)
Re: Bank Errors -
TheKnown - 18.09.2015
EDIT:Only deposit works..Withdraw doesn't.. am i doing something wrong in the code?
Код:
ON :OnPlayerDisconnetct:
INI_WriteInt(file,"Bank",pInfo[playerid][Bank]);//As explained above
ON: public laodaccount_user
INI_Int("Bank",pInfo[playerid][Bank]);//As explained above
Is there something wrong there?
Re: Bank Errors -
jlalt - 18.09.2015
PHP код:
CMD:deposit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
if(GetPlayerMoney(playerid) <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR:You don't have any money on you!");
new amount;
if(sscanf(params,"d", amount)) return SendClientMessage(playerid, -1,"USAGE: /deposit [amount]");
if(amount < 0 ) return SendClientMessage(playerid,-1,"You can not withdraw money with minus");
GivePlayerMoney(playerid, -amount);
pInfo[playerid][Bank]++;
}
return 1;
}
CMD:withdraw(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
if(pInfo[playerid][Bank] <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR:You Don't Have Money In Your Bank Account!");
new amount;
if(sscanf(params,"d", amount)) return SendClientMessage(playerid, -1,"USAGE: /withdraw [amount]");
if(amount < 0 ) return SendClientMessage(playerid,-1,"You can not withdraw money with minus");
GivePlayerMoney(playerid, amount);
pInfo[playerid][Bank]--;
}
return 1;
}
Re: Bank Errors -
Mister0 - 18.09.2015
PHP код:
CMD:withdraw(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781)) return SendClientMessage(playerid, -1,"You are not at the Bank");
new amount;
if(sscanf(params,"d", amount)) return SendClientMessage(playerid, -1,"USAGE: /withdraw [amount]");
if (amount> pInfo[playerid][Bank] || amount< 1) return SendClientMessage(playerid, COLOR_GRAD2, " INVALID TRANZACTION!");
GivePlayerMoney(playerid, amount);
pInfo[playerid][Bank]--;
return 1;
}
Re: Bank Errors -
TheKnown - 18.09.2015
Umm it still does the same...
Re: Bank Errors -
Aliassassin123456 - 18.09.2015
What about this one?:
PHP код:
CMD:deposit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
new amount;
if(sscanf(params, "d", amount)) return SendClientMessage(playerid, -1, "USAGE: /deposit [amount]");
if(GetPlayerMoney(playerid) < amount || amount < 1) return SendClientMessage(playerid, -1, "Error: You haven't that much money or invalid amount.");
GivePlayerMoney(playerid, -amount);
pInfo[playerid][Bank] += amount;
}
return 1;
}
CMD:withdraw(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, -2455.4519, 503.9336, 30.0781))
{
new amount;
if(sscanf(params, "d", amount)) return SendClientMessage(playerid, -1, "USAGE: /withdraw [amount]");
if(pInfo[playerid][Bank] < amount || amount < 1) return SendClientMessage(playerid, -1, "Error: You haven't that much money or invalid amount.");
GivePlayerMoney(playerid, amount);
pInfo[playerid][Bank] -= amount;
}
return 1;
}
Re: Bank Errors -
TheKnown - 18.09.2015
Nope..
Re: Bank Errors -
Aliassassin123456 - 18.09.2015
What's your trouble with this? what do you want?