![]() |
SQLite Bank System
I know there's already one in the Code Gallery, but I feel like mine's much more simple.
Also note that this is my first script in any type of SQL, so it could probably be improved a lot. First, create the table. To do this, put the following in a new Weapon NPC: PHP Code:
Once that has been done you should delete the weapon since it doesn't server a purpose anymore. Now create a new class (for multiple locations) or a level NPC (if you want only one bank) and input the following: PHP Code:
Now you should be good to go! Remember to remind people in a sign or something of the commands "/deposit #" (to put money in the bank), "/withdraw #" (to take money out of the bank), and "/balance" (to check what's in the bank). |
Consider doing the following for balance:
NPC Code: And use the same where clause in your other select queries, instead of cycling through an array every time. As well as adding functions for each feature (Depositing, Withdrawing, Balance), so it's at least re-usable instead of keeping it nested in the onPlayerChats function. Other than that, good work. |
It's not horrible, but you definitely need to use a more efficient SELECT statement, something like:
PHP Code:
|
Quote:
Quote:
|
Quote:
You should still use functions for your bank operations. :P |
lol, "You have never used the bank yet!"
|
Quote:
Quote:
|
Quote:
|
All times are GMT +2. The time now is 05:53 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.