ATM problem - 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: ATM problem (
/showthread.php?tid=471481)
ATM problem -
Lops - 23.10.2013
I have the problem with ATM.
If i use the ATM, want to Deposit/Withdraw money, then it allways gives me 49$ or put on the bank 49$.
Example, i want to deposit on the bank 240$, then it puts only 49$ and says, "You pu the 49$ on the bank".
Can't figure the problem out.
Maybe this code helps:
Код:
case 4665:
{
if(!response) return 1;
else
{
if(Player[playerid][BankMoney] >= strval(inputtext))
{
new string[256];
Player[playerid][BankMoney] -= strval(inputtext);
Player[playerid][Money] += strval(inputtext);
format(string, sizeof(string), "You have withdrawn $%d from your bank account. New balance: $%d.", inputtext, Player[playerid][BankMoney]);
SendClientMessage(playerid, WHITE, string);
}
else return SendClientMessage(playerid, WHITE, "You don't have that much money in your bank account.");
}
}
Re: ATM problem -
Aliassassin123456 - 23.10.2013
pawn Код:
case 4665:
{
if(!response) return 1;
else
{
if(Player[playerid][BankMoney] >= strval(inputtext))
{
new string[256];
Player[playerid][BankMoney] -= strval(inputtext);
Player[playerid][Money] += strval(inputtext);
format(string, sizeof(string), "You have withdrawn $%s from your bank account. New balance: $%d.", inputtext, Player[playerid][BankMoney]);
SendClientMessage(playerid, WHITE, string);
}
else return SendClientMessage(playerid, WHITE, "You don't have that much money in your bank account.");
}
}
OR
pawn Код:
case 4665:
{
if(!response) return 1;
else
{
if(Player[playerid][BankMoney] >= strval(inputtext))
{
new string[256];
Player[playerid][BankMoney] -= strval(inputtext);
Player[playerid][Money] += strval(inputtext);
format(string, sizeof(string), "You have withdrawn $%d from your bank account. New balance: $%d.", strval(inputtext), Player[playerid][BankMoney]);
SendClientMessage(playerid, WHITE, string);
}
else return SendClientMessage(playerid, WHITE, "You don't have that much money in your bank account.");
}
}
inputtext isn't value, it's string, we always using %s for "1" and we always using %d or %i for 1
Re: ATM problem -
Lops - 27.10.2013
It works great and thanks for your help.