You will need a registration system to save the money when they disconnect. I won't write a temp code because it will mess up if you get a registration system.
Writen from scratch here, please report any errors, not tested!
This uses DCMD, a fast command processor. Use the SEARCH function to find the define for it.
Код:
// Top of script below your #includes
new money[MAX_PLAYERS];
new string[128];
#define MAX_BANK 200000000 // 2 Million dollars, change to your linking.
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(withdraw,8,cmdtext);
dcmd(deposit,7,cmdtext);
dcmd(bank,4,cmdtext);
return 1;
}
dcmd_deposit(playerid,params)
{
new m, p;
m = GetPlayerMoney(playerid);
p = strval(params);
if(m < p) return SendClientMessage(playerid, color, "ERROR: You do not have that much cash.");
if(p > MAX_MONEY) return SendClientMessage(playerid, color, "ERROR: You cannot put that much cash in the bank.");
if(!strlen(params)) return SendClientMessage(playerid, color, "ERROR: Please enter a value!");
money[playerid] = p+money[playerid];
format(string,sizeof(string),"You've sucessfully put $%d into your bank account, your balance is now $%d.",p, money[playerid]);
SendClientMessage(playerid, color, string);
return 1;
}
dcmd_withdraw(playerid,params[])
{
new m, p;
m = GetPlayerMoney(playerid;
p = strval(params);
if(p > money[playerid]) return SendClientMessage(playerid, color, "ERROR: You do not have that much in your bank account.");
if(!strlen(params)) return SendClientMessage(playerid, color, "ERROR: Please enter a value.");
money[playerid] = money[playerid] - p;
format(string,sizeof(string),"You've sucessfully taken $%d from your bank account. your balance is now $%d.", p, money[playerid]);
SendClientMessage(playerid, color, string);
return 1;
}
dcmd_bank(playerid, params[])
{
format(string,sizeof(string),"You have $%d in your bank account.",money[playerid]);
SendClientMessage(playerid, color, string);
return 1;
}
REMEMBER: It's not tested! and it's not been writen in a pawn doc, so any errors, tell me, i'll fix them.
And you'll have to get the 24/7 locations yourself and use the
Код:
IsPlayerInRangeOfPoint
Function in an if( code.
By the way, is that picture in your sig -REALLY- necessary?