12.03.2012, 18:51
pawn Код:
dcmd_bank(playerid,params[])
{
#pragma unused params
{
new tmp[128];
new string[128];
new idx;
if(!IsPlayerInRangeOfPoint(playerid, 50.0, 1422.7039,-988.4125,1639.7843))
{
SendClientMessage(playerid, grey, " You are not at the bank !");
return 1;
}
tmp = strtok(params, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bank [amount]");
format(string, sizeof(string), " You have $%d in your bank account.", AccInfo[playerid][bank]);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
new cashdeposit = strvalEx(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bank [amount]");
format(string, sizeof(string), " You have $%d in your bank account.", AccInfo[playerid][bank]);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if(cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_WHITE, " You don't have that much !");
return 1;
}
new curfunds = AccInfo[playerid][bank];
GivePlayerMoney(playerid,-cashdeposit);
AccInfo[playerid][bank] = cashdeposit+AccInfo[playerid][bank];
format(string, sizeof(string), " Old Balance: $%d", curfunds);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " Deposit: $%d",cashdeposit);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " New Balance: $%d", AccInfo[playerid][bank]);
SendClientMessage(playerid, COLOR_WHITE, string);
SavePlayerStats(); // Your saving function here...
}
return 1;
}