Jump to content

[REL] Banking System 2.3


50p

Recommended Posts

Open that file (registry.db) and create a table, name it "bank_accounts" (if somehow it's not there) and add 2 fields (columns), name them: username (type of field: TEXT) and balance (type of field: NUMERIC)

well atleast the table problem is gone but now this

ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value)

ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value)

ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value)

ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value)

ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value)

ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value)

ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value)

and it doseent save my cash in the bank so every time i enter its 0$

Have you modified bank.locations.xml file? Try to clear the file and paste this:

<banks> 
    <bank name="Western Onion" > 
        <location posX="361.8298" posY="173.6187" posZ="1008.3828" /> 
        <entrance posX="2412.7126" posY="1123.8426" posZ="11.8203" teleX="387.8428" teleY="173.6187" teleZ="1008.3828" teleRot="90" teleInterior="3" /> 
        <exit posX="389.8428" posY="173.6187" posZ="1009.3828" teleX="2414.7126" teleY="1123.0426" teleZ="10.8203" teleRot="270" teleInterior="0" /> 
    </bank> 
</banks> 

The error comes up because it was meant to be "Simple Banking System" so I wasn't paying much attention to details.

Also, if you could tell me when you get this error? When you enter bank marker, entrance or exit?

And about that $0, you will always see it if you won't deposit some money first.

Another fine addition would be to include cash machines if possible, that you can place near train stations, airports, or certain stores. (I can just imagine people RPing as Bums/beggars and sitting near ATMs waiting for people to show up). I guess these would be withdrawal only.

I've added ATM thingy to the bank locations file, so you can specify if you want it to be ATM or a bank. Take a look here: http://y50p.50g.com/images/mtasa/mta-screen0051.jpg

Great! :D so when will we be able to use it? :wink:

As soon as I will add all the features I've planed, it won't take long.

great news on the ATMs and additional export functions :)

The other thing I'm looking for (and was about to work on tonight) was the other feature I suggested (though I've revised it a little since then) so that you can customise which db and which tables/columns the data is stored to, rather than hardcoding table/column references. I've come up with some rather lengthy pseudo code to achieve all that, but probably not worth me posting in here, but if you fancy discussing it I can always show you what I've come up with.

I'll think about it... but I don't use MySQL (as a few of you discussed here) and I don't choose db. Anyway, I'll think of an additional parameter for those functions that set/get bank balance.

This is probably going to be a larger re-write than you would ever consider doing, but this is basically some notes and pseudo code I wrote over lunch at work, for what would have been a banking system I was going to write, before you posted about the update. This was primarily for my own use with my own resources and mysql table structures, but was going to be written in a way that anyone else could use it, either on it's own, or with other resources, or table structures. It's a bit of a mess, as it's just notes rather than actual code, but it might help plan things?

I'm not going to implement MySQL in this resource. It's all supposed to be simple, even those people who come here asking how to start resource should be able to configure. What I'm going to do is add one more parameter (table) in some of the exported functions which will tell bank resource what's SQL table name, what are the names for account and balance fields in their tables. So for example:

local bank_resource = getResourceFromName"bank" 
local bankInSQL = { "bank_accounts", "balance", "username" } 
call( bank_resource, "withdrawMoney", player, 1000, bankInSQL ) 

And the money will be withdrawn from table named "bank_accounts" and field named "balance", it will search for user name in field "username".

Link to comment
  • Replies 152
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 month later...

Hey there.

I get three errors when saving the bank balance.

For example this:

ERROR: Database query failed: no such table: bank_accounts (INSERT INTO bank_accounts VALUES ( 'flibber100' '0' )) 

And 2 other errors, sounding the same.

Can anybody help me?

Link to comment

It seems like executeSQLCreateTable doesn't create a table. Try to create the table manually using SQLite Database Browser.

1. Using this application open registry.db file (it is located in MTA server directory). (Now in "Database Structure" tab you should see tables which are in the database)

2. If you can't see bank_accounts table, create it. (Edit -> Create Table)

3. Add 2 fields: username (type: TEXT) and balance (type: NUMERIC)

4. Save and exit.

5. Start the server.

Link to comment
about the atm thing they have done it on SAES, well obviously they had professional help from the members of the mta team on theirs

There are only two people from MTA working on SAES, and its me (ive been a member of saes/vces since it started nearly 5 years ago) and Talidan is helping on v2 which isnt out yet and we are only QA Members, as for the ATM thing, I coded it myself

Link to comment
  • 3 weeks later...
  • 7 months later...

sorry to bother u 50P but i have small problem

whenever i try to deposit money it says insufficient funds

i have tried using the PHOTOGRAPHER resource ( by SLOTHMAN ) to make money to deposit and i have tried using give_me_cash resource ( by NITOS ) as well

i have tried to make deposits of many different values ( $10 up to $10000 ) earned from photographer and given by Give_me_cash but no matter how much i have or how much i try to deposit it still says insufficient funds

i also get this error but i dont know if its related or not

[16:31:26] Starting bank 
[16:31:26] Creating new DB table bank_accounts 
[16:31:26] ERROR: ...thmatch/resources/bank/server/bank.script.server.lua:31: attempt to index field '?' (a nil value) 
[16:43:03] ERROR: ...thmatch/resources/bank/server/bank.script.server.lua:166: attempt to index field '?' (a nil value) 
[16:43:08] ERROR: ...thmatch/resources/bank/server/bank.script.server.lua:166: attempt to index field '?' (a nil value) 
[16:43:12] ERROR: ...thmatch/resources/bank/server/bank.script.server.lua:166: attempt to index field '?' (a nil value) 
[16:43:47] ERROR: ...thmatch/resources/bank/server/bank.script.server.lua:166: attempt to index field '?' (a nil value) 
[16:44:17] ERROR: ...thmatch/resources/bank/server/bank.script.server.lua:138: attempt to index field '?' (a nil value) 
[16:44:21] ERROR: ...thmatch/resources/bank/server/bank.script.server.lua:138: attempt to index field '?' (a nil value) 

i have tried running BANK resource with FREEROAM resource and BROPH resource but always same problem

thanks for any help :D

EDIT : i dont know if it makes any difference but i recently found out that you can run resources as zip files or uncompressed into folders so i have also tried running in both these ways ( zipped and unzipped into folder called bank )

Link to comment

Could you explain step by step what you did? Have you changed the code? It seems like you did. You must have changed some code which cause those error messages to appear. Why I think that is the case? Well, I looked in the "bank.script.server.lua" at line 31 and it can't be nil... regName is what the error complains about. According to executeSQLSelect on the wiki, this function doesn't return "nil" value in any case. Returned value can be a table or false (boolean), I do a check if the regName variable is bool at line 27. So I don't know how you managed to get those errors...

Nobody has had an issue with the script since the last release (it's been long).

BTW, what MTA version you're using? Is it nightly build or DP2.3?

Link to comment

wow that was fast thanks man

im using nightly version 1218

i dont think ive changed anything and i did look through the script ( i admit i am very novice scripter ) and i coudnt see what was going on

the only thing i may have changed is if i get resource uses depreceated commands when i start it in server

would it help if i posted the script here so u could see any changes

i was considering trying older version of nightly as well to see if that helps

EDIT : :oops::oops:

Very sorry 50P . i have just tried older nightly version and it works fine now ( doesnt save money when i disconnect but im sure ive seen that solved earlier so i think i can take care of that )

Once again i am sorry to have bugged u and thanks for such a fast reply

Script is AWESOME by the way

Link to comment

I haven't really used this with nightlies but I sure will update it once 1.0 comes out because I don't really see any good reason to update it now. First of all, MTA changes day after day, they change function parameters, function names, etc. Once they stop changing too many things I'll make a proper update for it so it should work with 1.0 too. Honestly, I don't know what could cause that script not to work with nightly.

Anyway, if it works for you now then I'll just wait for bug reports that people may find.

Have fun.

Link to comment
  • 3 weeks later...

I'm using MTA DP 2.3 deathmatch and so when the player walks into the bank marker he can't click on anything not even the quit button, hes like frozen at the spot and it started happening when i started my server it said "WARNING: bank.xml.server.lua: Bad argument @ 'xmlNodeFindSubNode' -line: 20" I don't know how to fix it.

Link to comment

Why did you not say you messed up with bank.locations.xml? It didn't start happening when you started server, it started when you modified the .xml file. Re-download the resource and replace bank.locations.xml.

Link to comment

What do you mean you can't click anything? Your cursor doesn't move? You don't see it at all? I can't believe there's thousands of downloads and you're the only one who can't click anything. You must have messed up something.

Link to comment

Does the button change when you hover over it? I mean the frame, text colour? Don't you get errors/warnings when you click on it? You must have screwed it yourself because nobody complained about bank for long time and this "bug" is very serious so I would have been told about it soon after release.

Link to comment

when i downloaded it i only change the loc. of the banks and thats it and when i hover my mouse over it the buttons are solid and you have to disconnect to get out of the bank screen and also this is happening with another script also and i never touched that scritp

Link to comment
  • 2 months later...

Hey Guys,

i'm new here and i am making a private MTA-Server (few month later maybe public) and so i came here to look what great scripts you are making and i found this. I like the bank system... but i don't really know how this work. Ich kopied the bank.zip to the resources and startetd the server with it.

I found the bank, stepped inside but nothing happened in there. Its the building but no point to pay money or something. Just the yellow marker for the exit.

Do i have to do something else? And maybe you can tell me more locations of banks in San Andreas.

Thanks for help

Playsinator

PS.: I'm sorry fir my english. I'm german and i'm doing my best ^^

Link to comment

Sorry to break in your discussions.

50p, i found a Bug:

This happens with MTA 1.0, using the latest Bank version for 1.0 and also my self-patched version.

as you may still know, Most player have a lot of money on our Server - and this resource already had some problems with this (99999999 max bug).

So, since 1.0 there is a new Bug: Player with a lot of money (one of them had 139282797445 $) are getting minus balance!

I had that Bug too. I logged in and found "-1447184811" on my Bank account. It seems that the money are only wrong displayed, it where still correctly in the sqllite database. I tried to fix this, but can't find the Problem...

I know, you are busy with your nice Script Editor, but can you take a look at this?

Thanks,

XetaQuake

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...