Thread: Bank System
View Single Post
  #9  
Old 09-23-2006, 11:32 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Twinny View Post
Ok: How would you two do it?
Well, the way that my system works is that I have a collection of public functions in a class which is joined to the player.
PHP Code:
public function bankCreate();
public function 
bankDeposit();
public function 
bankWithdraw(); 
I also have other functions for checking if they have an account, checking the balance, etc.

I also have a DB NPC for storing the bank data, i.e.
PHP Code:
DB_Bank.("bank_" this.account) = ...; 
However, but it doesn't do any functioning itself.

Then, instead of having to pass the account name, I can just use the this. object to access the player so that you can just do this to deposit 30g:
PHP Code:
player.bankDeposit(30); 
It makes it:
  • Easier to type, and remember.
  • Easier for other people to pick up and use.
  • So that you don't have to pass the account name.
Reply With Quote