PDA

View Full Version : Bank!!


03-28-2008, 09:53 AM
public function GetMoney() {
temp.data.loadVars(this.GetBankFilePath());

return (data.money);
}

public function CreateBankAccount() {
temp.data.money = 0;

data.account_opened = timevar2;
data.last_transaction = timevar2;

data.savevars(this.GetBankFilePath(), 0);
}

public function GetBankFilePath() {
return "ServerData/Bank/" @ this.account.substring(0, 1) @ "/" @ this.account @ ".txt";
}

public function ResetBank() {
this.CreateBankAccount();
}

public function SetMoney(amount) {
temp.data.loadVars(this.GetBankFilePath());
temp.money = temp.amount.substring(1);
temp.flag = temp.amount.substring(0, 1);

data.transactions.add(log);

if (flag == "-") data.money -= amount;
else if (flag == "=") data.money = amount;
else data.money += amount;

temp.flags = {"-", "+", "="};
temp.logs = {"Reduce", "Increase", "Set"};
temp.log = flags.index(flag);
log = flag @ (log == -1? "Increase": log) SPC money @ ". Total:" SPC data.money;
log.add(timevar2);

data.last_transaction = timevar2;

data.savevars(this.GetBankFilePath(), 0);
}

public function GetNetWorth() {
temp.assets = this.obtainAssets();
temp.liabilities = this.obtainLiabilities();

return (liabilities - assets);
}


^^^^^^^^^^ created for dev Litter!!

DrakilorP2P
03-28-2008, 03:22 PM
temp.assets = this.obtainAssets();
temp.liabilities = this.obtainLiabilities();

Defined where?

Tolnaftate2004
03-28-2008, 08:26 PM
obj.substring(0,1) is more succinctly put as obj.charat(0).

03-28-2008, 09:07 PM
they are my functions to obtain what the player pays out and gains he he
temp.assets = this.obtainAssets();
temp.liabilities = this.obtainLiabilities();

Defined where?


oh, thanks!!!!^^
obj.substring(0,1) is more succinctly put as obj.charat(0).

Tolnaftate2004
03-28-2008, 09:39 PM
I would also like to point out that you're using temp.log before you define it (data.transactions.add(log); and some lines down it's defined).

zokemon
03-29-2008, 04:23 AM
When making accessor functions like GetBankFilePath and such, you should return either thiso.var or just plain var as if that function was called inside a with () block, it would cause problems. Same applies to some other areas where you said stuff like this.obtainAsserts().

cbk1994
03-29-2008, 04:34 AM
Wow, you are getting good fast, Sydney!

Could use some work though, especially adding security.