CMD:deposit(playerid, params[])
{
new string[256];
new type;
{
if(sscanf(params, "i", type)) return SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {f00f00}/deposit <amount>");
if(type == 0)
if(GetPlayerMoney(playerid) < type)
{
GivePlayerMoney(playerid,-type);
PlayerInfo[playerid][pBankAccount] += type;
format(string, sizeof(string), "[BANK]: {Ffffff}You have successfully deposited {f00f00}$%d {FFFFFF}to your bank account.", type);
SendClientMessage(playerid, 0xf8f8f8fff, string);
}
else SendClientMessage(playerid, 0xf8f8f8fff, "ERROR: {FFFFFF}You do not have that much amount in your hand");
}
return 1;
}
CMD:withdraw(playerid,params[])
{
new string[256];
new type;
{
if(sscanf(params, "i", type)) return SendClientMessage(playerid, 0xf8f8f8fff, "Syntax: {f00f00}/withdraw <amount>");
if(type == 0)
if(PlayerInfo[playerid][pBankAccount] >= type)
{
PlayerInfo[playerid][pBankAccount] -= type;
GivePlayerMoney(playerid, type);
format(string, sizeof(string), "[BANK]: {FFFFFF}You have successfully withdrawn {f00f00}$%d {FFFFFF}from your bank account.", type);
SendClientMessage(playerid, 0xF8f8f8fff, string);
}
else SendClientMessage(playerid, 0xF8f8f8ffF, "ERROR: {FFFFFF}You do not have that much amount in your account");
}
return 1;
}
CMD:checkbalance(playerid,params[])
{
new string[256];
format(string, sizeof(string), "[BANK] {FFFFFF}You currently have $%d In your bank account.", PlayerInfo[playerid][pBankAccount]);
SendClientMessage(playerid,0xf8f8f8fff,string);
return 1;
}
PHP код:
|
Why are those there? It makes it so that pretty much anything below those lines can only be reached if the amount to deposit or withdraw is 0. Moreover, why do you call it "type" instead of "money" or "cash" or "amount"?
|