pawn Код:
command(atm, playerid, params[])
{
new amount, string[128];
new me[128], playerb;
if(sscanf(params, "s[16]i", playerb ,params, amount))
{
SCM(playerid, COLOR_WHITE, "** [Usage]: /atm [withdraw/balance/deposit/transfer] [amount]");
return 1;
}
if(!strcmp(params, "withdraw", true))
{
if(amount > Player[playerid][BankMoney]) return SCM(playerid, COLOR_GREY, "You don't have that much money in your bank account.");
if(amount <= 0) return SCM(playerid, COLOR_GREY, "Invalid money amount.");
if(amount > 50000) return SCM(playerid, COLOR_GREY, "You can't deposit more than $50,000 in an ATM.");
Player[playerid][BankMoney] -= amount;
GivePlayerMoney(playerid, amount);
format(me, sizeof(me), "** %s presses a button on the ATM machine and waits for a response.", RPName(playerid));
NearByMessage(playerid, NICESKY, me);
SCM(playerid, COLOR_WHITE, "_________________________________");
format(string, sizeof(string), "You have successfully withdrawn $%d from your Bank account.", amount);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have a total of $%d remaining in your Bank account.", Player[playerid][BankMoney]);
SCM(playerid, COLOR_LIGHTBLUE, string);
}
else if(!strcmp(params, "deposit", true))
{
if(amount > Player[playerid][Money]) return SCM(playerid, COLOR_GREY, "You don't have that much money on you.");
if(amount <= 0) return SCM(playerid, COLOR_GREY, "Invalid money amount.");
if(amount > 50000) return SCM(playerid, COLOR_GREY, "You can't withdraw more than $50,000 from the ATM.");
Player[playerid][BankMoney] += amount;
GivePlayerMoney(playerid, -amount);
format(me, sizeof(me), "** %s presses a button on the ATM machine and waits for a response.", RPName(playerid));
NearByMessage(playerid, NICESKY, me);
SCM(playerid, COLOR_WHITE, "_________________________________");
format(string, sizeof(string), "You have successfully deposit $%d into your Bank account.", amount);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have a total of $%d in your Bank account now.", Player[playerid][BankMoney]);
SCM(playerid, COLOR_LIGHTBLUE, string);
}
else if(!strcmp(params, "balance", true))
{
format(me, sizeof(me), "** %s presses a button on the ATM machine and waits for a response.", RPName(playerid));
NearByMessage(playerid, NICESKY, string);
SCM(playerid, COLOR_WHITE, "_________________________________");
format(string, sizeof(string), "Your current Bank-account balance is: $%d.", Player[playerid][BankMoney]);
SCM(playerid, COLOR_LIGHTBLUE, string);
}
else if(!strcmp(params, "transfer", true))
{
if(sscanf(params, "ui", playerb, amount)) return SCM(playerid, COLOR_WHITE, "[Usage]: /atm transfer [playerid] [amount]");
Player[playerid][BankMoney] -= amount;
SCM(playerid, COLOR_WHITE, "You transferd money over to %s", RPName(playerb));
Player[playerb][BankMoney] += amount;
SCM(playerb, COLOR_WHITE, "You reveice money from %s", RPName(playerid)):
}
return 1;
}
EDIT: The code pasted above would never work.
EDIT 2: He copied/edited the code in seconds.